Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp25705lqt; Wed, 5 Jun 2024 15:59:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWeU9hDNhoYIlWrscloXYHqao8ihlOWZgeYtiG/bTjCFLIEg8SAjJ4SDP21dHyKsFyq2XTcOsGnia31Ku6ld/bRpwncOV54jBxwggU9wQ== X-Google-Smtp-Source: AGHT+IHqADqEOLSVB44/Y9KYg3INAB3J7qLtGRiLHZfIk5tRVhZ/nubnUdnGkYgc0aqZwN4bGx3d X-Received: by 2002:a05:6214:438a:b0:6ae:2da4:fd74 with SMTP id 6a1803df08f44-6b02031a085mr33801496d6.6.1717628399745; Wed, 05 Jun 2024 15:59:59 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b04f964021si1225816d6.270.2024.06.05.15.59.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 15:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=N0osHU+Z; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-203379-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203379-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 680C11C21B39 for ; Wed, 5 Jun 2024 22:59:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 344BC1607B0; Wed, 5 Jun 2024 22:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="N0osHU+Z" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F1FE29AF for ; Wed, 5 Jun 2024 22:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.74 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717628393; cv=fail; b=b8NrTJhb2z5/uXLB8V1HdC1YjXY+fcGIH2wK7wV3z9EwVysnFIrlsxLAAHVHHqLe/8OLu6OblAnIi3dGQTGHrIflyO4lnDAEQ3IoPebopw1OOrY5PrIasMrPb1GD0ny1L2QKEu0ZJ5Cmvwza6WHbwRwjQnrA8oGeL7nzkZA4qVU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717628393; c=relaxed/simple; bh=NBJv7JcMm+UvTm3JXfE6TwnxftY9UJ9jurrVX3T9Yj4=; h=References:From:To:Cc:Subject:Date:In-reply-to:Message-ID: Content-Type:MIME-Version; b=V6B+wYRonz1GDYLKKAAbmFy2sUPTdvzsK2d/qxMIbFksfoKWh+wIdsRETNO9n+bo7pJJZFR7RTyCJtk8hNet50KFxa3jm/qFgvYBpcVqCFsAmgM7ar/aBWNxToAJ2VK6/J4GtcQAxnJpp2H12qhAevH6pWBpFkYgojOITjyMS68= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=N0osHU+Z; arc=fail smtp.client-ip=40.107.243.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fqt56xHGzE7Nszk+LbHDR5izoEeT5gjXZ3kmnu5PT0m+51hl37L8rSeE5ANp5kiJmCXqUOobUjxT9fMg8Nnr9VoBrj5K66bJkbiNkq54Ce0M0ktAzj+YvFptTzCKRwQfq8L+2OWjH4ZW9Rygg30QTWDsJ1rLUziDghVmxI40+5jM3EYfuVGbgdGHuMkyNeecXjoIHLpodL+sGdx1Y630y90U4qtEYQ5AwV52kKI/kWLmeF9FpgBcC+z+J3LNTVPKClqukvIAz/5i9l7rN4KjwgPkV1uiJyD/MoR/k1PfziaQe6GTI17PRXbk19i1ei2m7AEYsOb/dQxM2SZ6zlCnGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p0OUqTCNsCkQCb4T8uKFQI5gFjrJrjuno7hJLWl+Ees=; b=HBMpQ2PZVFKscnoToDkclAynJ6mzau/YJvdz9GpgdOM1tTguiZA8sP9EMoSxdGNLDQNC3t3tt7rv+tYt6fiAW8u7FpNH4+aftJjnRxGIi7Dcz2mfxkKHKGKbkTBnXhivOJzlOL3+VLLZJFYVvWUClNPmQiGdb6jYj4BDpeDqSwA0pylR9wHdU1CaQocb/VorFWlnV6Ns8QLj9vL6q3efsokdBLh7d8zp8S99Dnr5cVzjgoX4r72pC/EvtS7E9KBYr1F2fmYtpYsjq74KlSVYzi1Pl479dPoJXKFOj9bINEnfn0XjppaeylHxDoyGmGGTcQpgu6HpydWEnL6S4RtupQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p0OUqTCNsCkQCb4T8uKFQI5gFjrJrjuno7hJLWl+Ees=; b=N0osHU+ZGbjo3KUPYrHCTadeNWBauW1Cxe+oy+Ft1F0HCATqAb+clAgz8rIg84NDxUZ8f+2o5Cm61DX68WWbeamGbsrAboLaBY++8FbWJbd4rYkRzc2175NasB7SJWagfCBmeTzjFvCP4gg2vqMqvkcc9fG7gd7FYr8JTQAXvRH+f8zZ3ov1/HIqWRzOemyABDGCHgaUXKMUKUn17CAfj2NMxqwq/O1jd71nyYsasVHleCwGs0dFr3meyIOcELafu4SuNiTuhcyXxS8uRl/2E2UDCNrlVrM8tfFIZIUylAa6pfeWsOOVFwaVbJoBqqo/7v28Y3lm34ab8g1Na5Kuyg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) by CH3PR12MB7500.namprd12.prod.outlook.com (2603:10b6:610:148::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.32; Wed, 5 Jun 2024 22:59:46 +0000 Received: from DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe]) by DS0PR12MB7726.namprd12.prod.outlook.com ([fe80::953f:2f80:90c5:67fe%6]) with mapi id 15.20.7633.021; Wed, 5 Jun 2024 22:59:45 +0000 References: <20240605212146.994486-1-peterx@redhat.com> <6660ec883d31c_1ad63294f4@dwillia2-mobl3.amr.corp.intel.com.notmuch> User-agent: mu4e 1.10.8; emacs 29.1 From: Alistair Popple To: Dan Williams Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , peterx@redhat.com, Pasha Tatashin Subject: Re: [PATCH] mm/page_table_check: Fix crash on ZONE_DEVICE Date: Thu, 06 Jun 2024 08:58:08 +1000 In-reply-to: <6660ec883d31c_1ad63294f4@dwillia2-mobl3.amr.corp.intel.com.notmuch> Message-ID: <87wmn3q9lv.fsf@nvdebian.thelocal> Content-Type: text/plain X-ClientProxiedBy: SYBPR01CA0004.ausprd01.prod.outlook.com (2603:10c6:10::16) To DS0PR12MB7726.namprd12.prod.outlook.com (2603:10b6:8:130::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB7726:EE_|CH3PR12MB7500:EE_ X-MS-Office365-Filtering-Correlation-Id: 9be240e3-63d7-41a4-5dc7-08dc85b33122 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Fcrcji4PVDLdFQmS3kdFmSItH6X35fF0XKXwjXCltU6x0qsPqmIeWYhxqvOo?= =?us-ascii?Q?txkxUlf/CBPO5vBkBePSr7tEDOxDV3r7jwRodh4oJNPa+BKJlysc7wuMKUyP?= =?us-ascii?Q?1r4AH2huvDQb0hAHdUQ2lsTjW92Q41MssCjjPfAmaKlaRCvyd9FiMrZMkSrW?= =?us-ascii?Q?3mxjCh91OZjvqDmvcNHQVcgJXUaK8dJi1jCikNoJkHXBfgyiFuBy4dA3muJi?= =?us-ascii?Q?bWWm6f13Oo0JS7Y66qMlDU/o3zXTg4C4cJbooGeQnpFX3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+2AHw/7SUdVkikl2rXKpr8bUjI8YApoiX19NkPB1?= =?us-ascii?Q?RZfIWhjOU7AMP5gRPSlqNvMeDGBkAkiwjpl8d69H0QDJ662JQi4IAseM19aS?= =?us-ascii?Q?W8tcqZKWo9sR5BpvXBWEsbILLJdekF6cjxqOH/KVVfj3KPi4UC6rMEgqAQ9s?= =?us-ascii?Q?zMNqhzqD83C3ZCqNvJFo3gAp?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB7726.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Jkr9o0go2kYZPwJ9wOKdjsU9Oz7pdJu0RarkyZ4RdNAkBTcYMbPpTb/USm1i?= =?us-ascii?Q?lPhwmJ+4NPMeEN0tx8BN7+jxCVWBIEy5w8FvOa4/Oen67jyLnooz3dRw25hk?= =?us-ascii?Q?w9GerXOCDqt9ukeP/7JBIcksbi0mCZy/HBdpEZDUU2dZmvXtN1GbKyrN7bOC?= =?us-ascii?Q?9a47xWRIQ4RPxgdH47HQP6AXt79PC+XOStFUybGKBp+5L4qixJn9X96t43RV?= =?us-ascii?Q?0BLEjcFTP4kAzs6MDjDUlQ/M/sivspGqCJ+6DlObCnZhsLEvauacyFAAgYOg?= =?us-ascii?Q?v4PgMJEIPJR3EUkVpNav+kqEjBIks/ud8Ur7Cx9wGbeFY5yakQsYwejRhkCG?= =?us-ascii?Q?VFckTNo36JTRQIe4Lx0m7GYi4NX8z/87uPTHTenan5hiN2h3GW/kMpUbTW4Q?= =?us-ascii?Q?3t1ivltIJUAan1fEXXCG+1Asn2tHLNdKsdpvh1eebYgWjB+i0tnO0p54HZYw?= =?us-ascii?Q?kwqp0N/coi288hmBKTyUmJnQt7NsyEIp4/J7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6oNKt6Z0a51uDNmmS6IAwzIqMff9z1HAfCW2jeqsUNYUev8lVjE7?= =?us-ascii?Q?4W4WXooXKVyI/iODcJAbK+OEAfm76SnHrxrv/DUgD0jv9f6z88AXP6w51qbQ?= =?us-ascii?Q?f7xYb3woa2AVJk+iDpllzs/s6jPDK51G/SxLGufhvrEiyu164RiEgwd3g3ND?= =?us-ascii?Q?D0EIrBsJKo5h66WCU1O/k9AJzstxAalzyqHv9iI2?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9be240e3-63d7-41a4-5dc7-08dc85b33122 X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB7726.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2024 22:59:45.0930 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qrj+hPQf3Sepr4L+8ZkQ9jkZDzRl3X7sY7YAF2XSmbz2Dfh0EkI1etL4XpfUzsJ9zwvFOiDJWz4loFBob+r8yg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7500 Dan Williams writes: > [ add Alistair ] > > Peter Xu wrote: >> Not all pages may apply to pgtable check. One example is ZONE_DEVICE >> pages: they map PFNs directly, and they don't allocate page_ext at all even >> if there's struct page around. One may reference devm_memremap_pages(). >> >> When both ZONE_DEVICE and page-table-check enabled, then try to map some >> dax memories, one can trigger kernel bug constantly now when the kernel was >> trying to inject some pfn maps on the dax device: >> >> kernel BUG at mm/page_table_check.c:55! >> >> While it's pretty legal to use set_pxx_at() for ZONE_DEVICE pages for page >> fault resolutions, skip all the checks if page_ext doesn't even exist in >> pgtable checker, which applies to ZONE_DEVICE but maybe more. > > This looks correct to me, and needed in the near term. You can add: > > Reviewed-by: Dan Williams > > In the long term, the page_ext check may not be needed. I.e. the reason > I added Alistair was in case his work to make DAX pages behave like > typical pages for reference counting would also make them behave the > same for the presence of page_ext. It doesn't currently. However I did run into this bug while I was developing those so please add: Reviewed-by: Alistair Popple