From patchwork Tue Aug 30 01:00:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 12958581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3051EECAAD2 for ; Tue, 30 Aug 2022 01:01:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16EF66B0074; Mon, 29 Aug 2022 21:01:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 15DD9940008; Mon, 29 Aug 2022 21:01:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F18C2940007; Mon, 29 Aug 2022 21:01:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E19D66B0073 for ; Mon, 29 Aug 2022 21:01:33 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BE1FB8031E for ; Tue, 30 Aug 2022 01:01:33 +0000 (UTC) X-FDA: 79854456066.02.653C33E Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf18.hostedemail.com (Postfix) with ESMTP id 2D77D1C0017 for ; Tue, 30 Aug 2022 01:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661821293; x=1693357293; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q72u8o9NplBRndRYgPTxCNaKqaPHER7MLnoX2dvImDc=; b=QnHPGmN+FRHx0q9eYA0ZfC+lZo+QhNWYnvH7PVG3t/btYygJ6BeXbzeO naLqPEs1QzmTNL4GF5RKRipt4sDIYsiG8Lb2m7hdJ++NsxP2cWrWr0wvq xpm1kKJVkeua/S1wvyvo+KDVUR79jTWftFlf4KsS86wAqIh+eN7rFnjZe BHlthFyOY106w6qlqmtxy2HmGoC0qO3ZGocSoqZA350HAbz2cwECyb1WG ei6idjrLP31Ck2JHrOp2ZTnCKZ5iFIZIljMcUp6K3wF+8DwyHSd5Froj5 JQ07vxiA/DA53Irtl1PywniKR1qTKJF6pvm4sGpWY9mXFiRSh7sEA7OvE A==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="381342281" X-IronPort-AV: E=Sophos;i="5.93,273,1654585200"; d="scan'208";a="381342281" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 18:01:31 -0700 X-IronPort-AV: E=Sophos;i="5.93,273,1654585200"; d="scan'208";a="787305212" Received: from fpalamon-mobl.amr.corp.intel.com (HELO box.shutemov.name) ([10.252.54.23]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 18:01:27 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 6425A1040C2; Tue, 30 Aug 2022 04:01:24 +0300 (+03) From: "Kirill A. Shutemov" To: Dave Hansen , Andy Lutomirski , Peter Zijlstra Cc: x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Alexander Potapenko , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv8 01/11] x86/mm: Fix CR3_ADDR_MASK Date: Tue, 30 Aug 2022 04:00:54 +0300 Message-Id: <20220830010104.1282-2-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> References: <20220830010104.1282-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661821293; a=rsa-sha256; cv=none; b=0vGfSJRekA99Aqu7gbYw1k2pOYkFAuvV2yUn7kyvn6LME9kHL3A31aXZePD1m/F8yGc6A4 P3jlXkN425shfW68lbqA37R75GmubwfpSQ7DSn+CrD/ul4vGIPTaHfjwLvfRRjVAmTo6ia Txd6bq2gThOcH5lSoc9aERcoMUPBGAk= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=QnHPGmN+; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none); spf=none (imf18.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=kirill.shutemov@linux.intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661821293; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6mUU88d77bz9mORxAl7NMj1cyDeY2JAozvJp4Bvmrgc=; b=I16PDAUjq8m+dM6KL8SktusIgNgw0+y22qqh841i4sMjCAncjBTeiu7t+tuwUimGzDgrtr PMyNJcrUJG+VePNg++g7TmRFhmGsjqCBkC4BNN28xgZ5Ajdpy/17BAZc/FNO8TXMhnrfQT XZE4k1bGan5y+vaGEnWJ2vgw7e54o2E= X-Stat-Signature: 8ubgz4p58esrjao47q6jnk6igjdsoupo X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2D77D1C0017 Authentication-Results: imf18.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=QnHPGmN+; dmarc=fail reason="No valid SPF" header.from=intel.com (policy=none); spf=none (imf18.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=kirill.shutemov@linux.intel.com X-Rspam-User: X-HE-Tag: 1661821292-805175 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The mask must not include bits above physical address mask. These bits are reserved and can be used for other things. Bits 61 and 62 are used for Linear Address Masking. Signed-off-by: Kirill A. Shutemov Reviewed-by: Rick Edgecombe Reviewed-by: Alexander Potapenko Tested-by: Alexander Potapenko Acked-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/processor-flags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/processor-flags.h b/arch/x86/include/asm/processor-flags.h index 02c2cbda4a74..a7f3d9100adb 100644 --- a/arch/x86/include/asm/processor-flags.h +++ b/arch/x86/include/asm/processor-flags.h @@ -35,7 +35,7 @@ */ #ifdef CONFIG_X86_64 /* Mask off the address space ID and SME encryption bits. */ -#define CR3_ADDR_MASK __sme_clr(0x7FFFFFFFFFFFF000ull) +#define CR3_ADDR_MASK __sme_clr(PHYSICAL_PAGE_MASK) #define CR3_PCID_MASK 0xFFFull #define CR3_NOFLUSH BIT_ULL(63)