From nobody Wed May 8 02:46:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1673276993; cv=none; d=zohomail.com; s=zohoarc; b=EIw86SN1f9/kq98CFV+YruRgAxCaUsLGecSRiqygiNA+IY6pZq5h4vTBpmWuQka/hOT5oqsuV3X5wu1fkc3PDRMUhIm/3+SV7BPeAnu53OS64lk5YO/zK0jA7/UyhAz71tOhaKKXJGNil3YRcNi1TXVtsaPhwa4QwqftnhYXAz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673276993; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=bvld8zPnYDTnQIG1YqFCYb/KZpQyo3ITt9siNGCo5AU=; b=h6rWymcVfyzAQue+LeLVl3mLORO0s870oIZoXDmUnl943c48eLApaU3GFiMNpIBPG0GkbdGU8VvYQAfyrt6344D8KcNMwcrDYWkxIXgWHEvix0H+Bb55Tetmahz07qIBCzVwelG7njJM879lFtEhBecU7K1+No25EqauJ38vZXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1673276993733461.6470616765753; Mon, 9 Jan 2023 07:09:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.473731.734462 (Exim 4.92) (envelope-from ) id 1pEtmA-0004lL-KX; Mon, 09 Jan 2023 15:09:26 +0000 Received: by outflank-mailman (output) from mailman id 473731.734462; Mon, 09 Jan 2023 15:09:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEtmA-0004lE-HZ; Mon, 09 Jan 2023 15:09:26 +0000 Received: by outflank-mailman (input) for mailman id 473731; Mon, 09 Jan 2023 15:09:25 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pEtm9-0004l8-R5 for xen-devel@lists.xenproject.org; Mon, 09 Jan 2023 15:09:25 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9a20b14f-902f-11ed-91b6-6bf2151ebd3b; Mon, 09 Jan 2023 16:09:24 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id BF9EF34300; Mon, 9 Jan 2023 15:09:23 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 788C2134AD; Mon, 9 Jan 2023 15:09:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id diIQHCMuvGORRQAAMHmgww (envelope-from ); Mon, 09 Jan 2023 15:09:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9a20b14f-902f-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1673276963; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bvld8zPnYDTnQIG1YqFCYb/KZpQyo3ITt9siNGCo5AU=; b=vFJ4c9PD8hUN1mARIMwxWF3d/NZ/pc8pC3MQlSRQRs0Sikg/ojs58lhAE4+cVRT9SEL5Lt UqCOuBfA+OZ0KtIVPDjs94DZnYPv5X6A8k7wQ1G8tbRh3i+f1FV1MsMlcHcXUyFptlc1T+ M4AJqrOad/ZUJ+3AhGSlF0oacbYL6LM= From: Juergen Gross To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: xen-devel@lists.xenproject.org, Juergen Gross , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: [PATCH] x86/mm: fix poking_init() for Xen PV guests Date: Mon, 9 Jan 2023 16:09:22 +0100 Message-Id: <20230109150922.10578-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1673276995050100001 Content-Type: text/plain; charset="utf-8" Commit 3f4c8211d982 ("x86/mm: Use mm_alloc() in poking_init()") broke the kernel for running as Xen PV guest. It seems as if the new address space is never activated before being used, resulting in Xen rejecting to accept the new CR3 value (the PGD isn't pinned). Fix that by adding the now missing call of paravirt_arch_dup_mmap() to poking_init(). That call was previously done by dup_mm()->dup_mmap() and it is a NOP for all cases but for Xen PV, where it is just doing the pinning of the PGD. Fixes: 3f4c8211d982 ("x86/mm: Use mm_alloc() in poking_init()") Signed-off-by: Juergen Gross --- arch/x86/mm/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index d3987359d441..5f8ba537d9d3 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -804,6 +804,9 @@ void __init poking_init(void) poking_mm =3D mm_alloc(); BUG_ON(!poking_mm); =20 + /* Xen PV guests need the PGD to be pinned. */ + paravirt_arch_dup_mmap(NULL, poking_mm); + /* * Randomize the poking address, but make sure that the following page * will be mapped at the same PMD. We need 2 pages, so find space for 3, --=20 2.35.3