From patchwork Fri Jun 21 14:25:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13707657 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 29CF2C27C4F for ; Fri, 21 Jun 2024 14:25:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 923E18D0178; Fri, 21 Jun 2024 10:25:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85E208D0176; Fri, 21 Jun 2024 10:25:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D6E78D0178; Fri, 21 Jun 2024 10:25:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4968A8D0176 for ; Fri, 21 Jun 2024 10:25:23 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E9E1D120F99 for ; Fri, 21 Jun 2024 14:25:22 +0000 (UTC) X-FDA: 82255118484.20.26AD6C3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id D66711C0007 for ; Fri, 21 Jun 2024 14:25:20 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MNDVFhGd; spf=pass (imf20.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718979911; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=k2ztUKph00cBWbOmplix2Q4QYxHwnhS7TcGpCnDIOcM=; b=LjD0yErpJEkkr1ECPS/8t4CFUqaDhSUkbVtyYonPyEQajjqTsYcMQnmzFDTG6IWyxKvLD7 X7UpK/hXXPCbZd+ua9lrUcD1Gedw4TDFr5Db0YBW+66twXT3IrknygcvBw0RvcBAs6XOuy q/7LtT1DYRjydfXbTiZPIyIx5karcUI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718979911; a=rsa-sha256; cv=none; b=RMq/kakwfv+23GB1CXDBMyJ2lMtHG8OEVzFp8Snwd3hmi2ib9WAzKORUcNiIUBlOwO6d2O 4ZscvI4xSo35qafRwfGPrP7KZ4as5w+Mk3Ym6Wl5ug+w3iei5EmhYk/K8rVjxnfezU7lvA qOJET0whMX5yrCafOP3O6yAm+BGF4rY= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MNDVFhGd; spf=pass (imf20.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718979920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k2ztUKph00cBWbOmplix2Q4QYxHwnhS7TcGpCnDIOcM=; b=MNDVFhGd7Yxed17ZEE7bDdfEt9tuVHoTDmEYpBH/JRDVSb6r3nZN6uQtdyu/qqrhr5UKl/ j2yXuerZLYaDyE9OMqyRSK9esBLBbbt0ES6ayw2os9ZEXYtsMvQ7pF3mQGEhNZsanPdAIc E+JRZxrCrhly+c8p3gZH79tcH+e6VIE= Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-570-Fjt1vY9BMZuQRd-RNN3E5A-1; Fri, 21 Jun 2024 10:25:18 -0400 X-MC-Unique: Fjt1vY9BMZuQRd-RNN3E5A-1 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-25cc7a26048so509902fac.2 for ; Fri, 21 Jun 2024 07:25:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718979918; x=1719584718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k2ztUKph00cBWbOmplix2Q4QYxHwnhS7TcGpCnDIOcM=; b=ggs+Hd/DaL96R+7sxB3BB7vRzqQnYJ41MHMcEprryk7yzafie2YP+74GBaKQNllsMp pXfU2tHBRn+PjwUcwWoACsHU58iTePwBsgRdSUkPXsOflgQ2zqclN6ipfgbCDwQrD+1y 55WD4PrfUUrlEwO9X/QYsQfMS0SJnoISE6Of2Xz3qZLaTCizcprtAowINqO8YeBADr5h lonSupciZFQS+UvYnHDmIOu7BfY085bSSrjnkbAt6m+z/aRqG4K1GG3y2aO4VW1OvGXS 9P23HAXqUV2Nq49VTMiSRIJNv8ViGomLN/9XYYLvuGa7HTQlMO3HxqFShMoOr1jhzH8u UTKQ== X-Forwarded-Encrypted: i=1; AJvYcCUfvyZC6pC5aUojnsuILQJlyv1am9r51/QsSSCZxA1IEdb5SvhF8yGtM0I0URR8rAvgBci+9RGjs3avo2iXE2Am2Fo= X-Gm-Message-State: AOJu0YwhSvSZDxL3Ai1vxJQOIYfGTAKirFkaqMlzFbJcmWy/QNwa5djj VN5Nm968aYYzW6xI02Yk7tcrnJiwEcppHBxUs0rcqIIlFqV07z/zHwRhTljiPGg/eK+6+ZXC8XB Im6FaxkUjT+wDJ/uwXsZpTtNVmHRoqoojdCnbbfiHAUL+sngH X-Received: by 2002:a05:6871:14f:b0:254:cae6:a812 with SMTP id 586e51a60fabf-25c94d8a94emr9065105fac.3.1718979917840; Fri, 21 Jun 2024 07:25:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpfu3cPye3+7RpVIl2JRxNk+CTOiRpoiTdFmb6dpb/ERi8sD9JFsePfCkLHiFMYZR2Pz0U9w== X-Received: by 2002:a05:6871:14f:b0:254:cae6:a812 with SMTP id 586e51a60fabf-25c94d8a94emr9065078fac.3.1718979917305; Fri, 21 Jun 2024 07:25:17 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79bce944cb2sm90564785a.125.2024.06.21.07.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 07:25:16 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: x86@kernel.org, Borislav Petkov , Dave Jiang , "Kirill A . Shutemov" , Ingo Molnar , Oscar Salvador , peterx@redhat.com, Matthew Wilcox , Vlastimil Babka , Dan Williams , Andrew Morton , Hugh Dickins , Michael Ellerman , Dave Hansen , Thomas Gleixner , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Rik van Riel , Mel Gorman , "Aneesh Kumar K . V" , Nicholas Piggin , Huang Ying Subject: [PATCH 5/7] mm/x86: Make pud_leaf() only cares about PSE bit Date: Fri, 21 Jun 2024 10:25:02 -0400 Message-ID: <20240621142504.1940209-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240621142504.1940209-1-peterx@redhat.com> References: <20240621142504.1940209-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: D66711C0007 X-Stat-Signature: qhz4kt4yi5twxrae6jakz1bpt1rqw34s X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718979920-475229 X-HE-Meta: U2FsdGVkX18p1NFupIVDuQEzlESC55YNPXny6LVGr7ccz/NObYiRt+StmxcZIfr3FOjttazMIkqZ16+nN+R4q917yhdNnmF0c3mu6dq+NADXXwozHlRhFb7JjSrBl4MEZEpyKMTa/lqj5H5c7y7tZKLWIsxcdfBQW81R4AxXo5CJbbKeNKGq+tfIEZuXViiWWd5WNcsW0og1m1DyhqH5I7ZeNYZF79H/lv7cyxtbjnwqo+CmX0EyuqCxlhYUvfRm6YBZ+kZESFtgbQZjeODMKkDZIHVKkar1/dqfV/rgXumERdaCettulgSYlFLvLnegr1yDu+o3bAJ81sCDPy7av5iG+oAftdiN77RbfH3aA9kq0QJV+/5uW+Tt+NLvNoK++MrLpC6T+5h8uedp3ikT28JLobdspPhMvm1aTKZOSrHN4aOX5rWFAxUfpK2gvuJfPu7INtk3MQ6wfg4WGfRUD13FBHamG7EyzqM2/p+9E74ODvL02SIDVR+37CwVEt8QC70yQN849Q6S5/lbWWz4PAtyKCfMH81B5M5D85K80EmjP04X3GHgvH5Aj7nRLDOx1fuIQWqBYmv7LdpzZ4SZGUwIlIT8/ewIOLmo347dTU4uYdtLMz6DUTlgTE1O2FQCMdVpHe214KarT7ERMxMx7f5gcKXSm+gWdcdDYFTL2fhUMdofikwZU0CjJqU3Vv4Y5FYBoZj8b1glMpyQctQ/YmuP3b2D4wr2I6K0MR/pWoNJZFzQcdbKI2TwqTwpC3YbsTwGVPspJtL4p4qHIjafAao2sqFjECXArf8LDjATIziq1XzQeXS9wMM7+/0lIK1CNU3CmjuVH63Hm+DGXWucJTf3U3rovTOFWkJACZY6tBPkTsNTTTrZ5HDcKyMM9hrxjI/U+htntLsbijR6LrgldUN03Haff5KnSTKHHBNIijon467IR+nXZu4zuHTSbITlexiepWQQPmOd2QxNhJD yF2gE0i8 6HXh8lvvXCEveyD7TCF09q+YZhFC21VcN9q7r/K/Avh6iEEVOGRbPLv2MFe9vB2NmMQVvy9NAM/oBdEPw4PGIZZNgGyEpA6EolfrtnH7SC/WdEK76hDqTzUXaz7G4IkBQDIxBMHyfiO+W28TRYuK20vuyjky0BdqI/HxIRhBVlbH4LyIfEVvEswG3CoCggoI6nC1vKBHv4T3/uHvEsC2nrr/XEyIu0dNNEryrpD3MoI43aukRc3EtBcoEv98M6L4cMYgGG5ksUCwCEBr0LCwrGc+Lg1ICgGRDsPmx3OzgTUPffeXn9JagVbBKwIdBiZQpuGRr4pwZX2qfCT6ZXvmRgpRXHAHEcc+bBErImUg36pC/J7Ill1N1vRZVtkP1L/NKlq18FB6y6gbxw4P5eUeOQfm+YQrDQQcwJiMl3Bqw2ZlgGf9dWEEJJIsXTXHcWDYpNKbI0GOvjVUg9ir/zI/LvDyfhw== 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: List-Subscribe: List-Unsubscribe: An entry should be reported as PUD leaf even if it's PROT_NONE, in which case PRESENT bit isn't there. I hit bad pud without this when testing dax 1G on zapping a PROT_NONE PUD. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Signed-off-by: Peter Xu Acked-by: Dave Hansen --- arch/x86/include/asm/pgtable.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 65b8e5bb902c..25fc6d809572 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1073,8 +1073,7 @@ static inline pmd_t *pud_pgtable(pud_t pud) #define pud_leaf pud_leaf static inline bool pud_leaf(pud_t pud) { - return (pud_val(pud) & (_PAGE_PSE | _PAGE_PRESENT)) == - (_PAGE_PSE | _PAGE_PRESENT); + return pud_val(pud) & _PAGE_PSE; } static inline int pud_bad(pud_t pud)