From patchwork Mon Jul 15 19:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13733836 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 F3A8FC3DA63 for ; Mon, 15 Jul 2024 19:22:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07DE26B009D; Mon, 15 Jul 2024 15:22:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF5AC6B009E; Mon, 15 Jul 2024 15:22:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF8126B00A0; Mon, 15 Jul 2024 15:22:04 -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 ADFC86B009E for ; Mon, 15 Jul 2024 15:22:04 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5E4D01401EA for ; Mon, 15 Jul 2024 19:22:04 +0000 (UTC) X-FDA: 82342957368.20.61272C9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 5713F1C0023 for ; Mon, 15 Jul 2024 19:22:02 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YlaI9QPa; spf=pass (imf18.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=1721071284; 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=TFEuzrgphkpyKgRaMn/StFmQ1IWZKcW4qj9eIjoToHw=; b=AhcQ0027ZOzKNnKpqZ6UJCRwFqMlS4F88YFVO2wPPHIB7w2H1bWM2qHZvK2p4A6qCwbICq OVfCEq5MQw1mmdgtInotUJ8Jhw9o31SGIOTRXxSHKiGfdHWXT1JAphPlkaIQKm/CVYbkth kFRw9iLC+lCh8uuMSRhyJ/F2u8zLhaM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721071284; a=rsa-sha256; cv=none; b=1S2mfdkHProlA/uZ6EFDewd7et24/myONOQoigpqvoZc3MdI/mE7P+l+zQytR9hLBzbWXb bHKrGb0bh7DlZ3Z/OXqkJsYjn3CDoS565cqQGPI3fTSSNe4L6aH0UbX1eS6BfrY2Mo/QtT gMkBIpn74cw6EhSD7N0z9IaDjbkVIqI= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YlaI9QPa; spf=pass (imf18.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=1721071321; 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=TFEuzrgphkpyKgRaMn/StFmQ1IWZKcW4qj9eIjoToHw=; b=YlaI9QPacGnYVr/+RnEiIT09nODOOTEdtPukn5sWIXwqUSuKDtXvuSrXRSwI+KJ19gY++7 DZtPAWVpO23v28zS0z9IpLf965eJgVdtxdBOGpp2JUZK5KUOBbAH/pxkssMwXVDSkRUFWn c41ttFOjsWy+MKnEbCXhlK0ruKTPEvA= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-BFsfOldZNnKJnaMuUuJmlg-1; Mon, 15 Jul 2024 15:21:59 -0400 X-MC-Unique: BFsfOldZNnKJnaMuUuJmlg-1 Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-5ce529cca68so557233eaf.2 for ; Mon, 15 Jul 2024 12:21:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721071317; x=1721676117; 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=TFEuzrgphkpyKgRaMn/StFmQ1IWZKcW4qj9eIjoToHw=; b=bScSLWgUIJixlAbuBYfT7SMRyakBwYcYD9HxChuBv0SNdWSDydxP6Ya56veW7c7K77 r76R2yPzX9DdDiTiR0T14Sv17NRRMpWoB5EN4p/3m12SH5Y5xOAaXHqXdBYSZJxuORy9 UG7+o6auiQ4hQhatSGFz1hoLxNAU5b3cZhi3xA+AFvZPkdwJQuRVuO/a0IGPXzh1Z0L/ oo76Vy/7NvM3eWa7B2oHQs4A63yWepHS/6T+QybcSVsALbXRoq63/K1GJBermdpBw1Qp Ydsj083cAkBU4GmHvJIUwVEml+0sIUQTTVD0N/Q3rtHK4KGHeZXOsN1Hk1LqqTlRkbBd N1EQ== X-Gm-Message-State: AOJu0YxHo4GgAq8p5KdRSKXJMafcr75pL3sLlSiKP9jdsgLNN24dkkJa X5wuuyzhvuFpnHxnOOX6f0shrE7fQt0Ht7azt3aJ0+K61st/HQ5pdxIiYZAg64e4kHgImnWWwAX nQkTnAYX20oGmQePN5KIYTZ5M0lj+peP2p7Xx3ugt3m3TR0NnQisTZE64r6WuoI1q0GZBhvDfl7 vFxXPadHqGDbvxr1+MyJJr+olWKbdX7Q== X-Received: by 2002:a4a:4308:0:b0:5c7:aeba:77a0 with SMTP id 006d021491bc7-5d25035be58mr500674eaf.0.1721071317138; Mon, 15 Jul 2024 12:21:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHclECHVFRdVYbFwnrtKH3lJcHIiAHM9jyDo1qTRx8+nslWI3GA72lYOtCld/HD9tYeAzQ33w== X-Received: by 2002:a4a:4308:0:b0:5c7:aeba:77a0 with SMTP id 006d021491bc7-5d25035be58mr500637eaf.0.1721071316695; Mon, 15 Jul 2024 12:21:56 -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 6a1803df08f44-6b761978d30sm24039356d6.31.2024.07.15.12.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 12:21:56 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Dave Jiang , Rik van Riel , Dave Hansen , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Matthew Wilcox , Rick P Edgecombe , peterx@redhat.com, Oscar Salvador , Mel Gorman , Andrew Morton , Borislav Petkov , Christophe Leroy , Huang Ying , "Kirill A . Shutemov" , "Aneesh Kumar K . V" , Dan Williams , Thomas Gleixner , Hugh Dickins , x86@kernel.org, Nicholas Piggin , Vlastimil Babka , Ingo Molnar Subject: [PATCH v3 5/8] mm/x86: Make pud_leaf() only cares about PSE bit Date: Mon, 15 Jul 2024 15:21:39 -0400 Message-ID: <20240715192142.3241557-6-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240715192142.3241557-1-peterx@redhat.com> References: <20240715192142.3241557-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Stat-Signature: 8jy5rgbg9qd4bmeoxag9fagz9sraog8w X-Rspamd-Queue-Id: 5713F1C0023 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1721071322-714452 X-HE-Meta: U2FsdGVkX19aEDoQwhT2ZX/FM0RI5gYzbUHiyywPFvdPiNnaelsjch/IwB7UbuURif8Oyhh/yABwvlpk6+wAS5stYipx1Ld8ixAu5dH5QehEH2+keoN+t1Df2Sp47cG7CrgUVH6SID3TAXGxuvHDqr7eVObTmjM5HDHjB2Y5Djn5XnnCzQYaUpbtq6f89iNEMVoPgqzANwjs5bZiqzQ7MUakiIaJnLpyWn0PGACF94kUIqMYxwTZLlWaXbSabJ77DyokYNHT4l7TTqN4cqS8rtRHetwkQG/8lNYw2b/+/rjldRohiaJQ2RIeJ8QmDrcU66ClTQOXhmxMjLNnURJzvH+Nro2ubdWnFc7dWA1yT4C8Iqk6bgL6qqtTdNzL0VRO0v8J/Fj0BUECy42cV7aknztCA55+ssC2gOfivLN3DnPWmHx7YLj/kOvEVielhg655EGTwyUuufVb+17G81zwJSH3ipB95qpLSaDk34FNOu75+rkzZ+/0ITIetUuzfDJAqLUXXcItmzZRm+T3PLTY+3DpnN+PEOYBbb/IfD6Pcc3X1pmFLg39Mm54mOl0oqPQ2JQ0mTuSHY1njq6K4Mtb9RT5Jy2JCVJVgIHQOmO2dexhhqpP0LasV1J7X8hxHFRzL43W19lBAnWc2+GaXFRDOi3OrWEbQjAtpH/Km+L89ihJCWfsYUYb7AMGsiluGpQi55NsBz9NkEovAd8Gx0S3+ylzCT90FyILZ9LpGc5KPS3WLDXHnNswZe2NGzvSq53psvdQhYiujez3+pQaSx2EAeP93UcPuSLKNeL8ZDn99zbwPbEA/RzbOxIcp5/3L6DtcQlxhzJH5JrUOSvmWy6uz/FIXgUR9CwGOL6hMhPmahW66Seck61NkeVjL4lrpsDtcvtSjQQCuJtGnBvPvn1QvUg9v3zmF3t5KJSnJxsQ3rCKEkXuxx96wtpxra02KIkeWPH1y+shIdG6BjSR5G0 kYtUMeSL xAM17SbDhx5yCvFkzs2AMj7n+EJTyC2ZDLS/ISUgu/sm5WNPkYrj/gehNETB+dvY/7+JFlrrGtoRn3WYhSlGYVk4Ev7B4BFtYqpaXyEH4G5TmkxOrE2pIhmigataLvVKJbZR+R4P//h99BBUm+lTgU3JWe0IRRni7CYliRGsCsueBl/9FHNX3zrMS8tx9T25dpKkFE7d/C42n31uFSGAEIz0sbcYDObN4MntiRtctLQVtAhbjI0/eQB21sJFEZsLHgjaA5yN/62dsnQYSqhTWryd/oin4PiL7KhwQo5mHNryBdAYaw4ZfGC/5G2/fRRxjcCUXKeDPVVSsiUaw1bcnvspVuL7nHXyt+/cFbIPpu2dkEZXsh0yeFtOlorPA8HG7YHsvWV4d4iz5b0/0MWsfTphwmy/lqxakkNP9ibis6yEdtn4iFeI48nZTvY29vKXyLHUC4z2XMOMJ7LVjgiugIJy2yg== 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 Acked-by: Dave Hansen Signed-off-by: Peter Xu Reviewed-by: David Hildenbrand --- 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)