From mboxrd@z Thu Jan 1 00:00:00 1970 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB9C8C2BB85 for ; Fri, 21 Jun 2024 18:00:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKiYL-0003bE-KF; Fri, 21 Jun 2024 14:00:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiYJ-0003aQ-HS for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:59:59 -0400 Received: from mgamail.intel.com ([198.175.65.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKiYG-0004B8-56 for qemu-devel@nongnu.org; Fri, 21 Jun 2024 13:59:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718992796; x=1750528796; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=gwxfVzuXwIzsAitT2FKb5pw2WkGN2+ydwR7mtdnWVmc=; b=BKZ6z6nGeoQtNA3iY/RmlugX8v4PRkB5taRQC/hiNTkbpek9lhcn1gfD t4Zc8/GP9erV9MtTBuxUPwxFp2HU2hzEMfDj6xBt+1t7ZUZk5N2wRymKB KrZWCI8wolYuMEKGNNeUmA0Fytd7wNOdnk7JQgufcIiED8vYBsZsEQD2r eI0ZY/yvaWsRhKlvcnkGkXd+7+QSkJe8e6fomL2bA3TIcxTDbyx5JzyUZ JDZs9GLS+h8YlZt5Vlhz3+B9qi2El0T45mU+ySs9LhRvN2+uwutscKvOD JaWz0CfQAUyLbzw+ea/jZFpKDjbS5bDBq640+D7VkrAVNOICv05uj4TGc g==; X-CSE-ConnectionGUID: /NI5NgvBQxCfTBsLxwJiig== X-CSE-MsgGUID: KwvDMU2MS6Kp0tN6/i+3gQ== X-IronPort-AV: E=McAfee;i="6700,10204,11110"; a="33497706" X-IronPort-AV: E=Sophos;i="6.08,255,1712646000"; d="scan'208";a="33497706" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2024 10:59:53 -0700 X-CSE-ConnectionGUID: ldddngJoRTu+7E9UVJoutQ== X-CSE-MsgGUID: PIwp18MWSDOYcp39Y27JQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,255,1712646000"; d="scan'208";a="47579878" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa003.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 21 Jun 2024 10:59:53 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 21 Jun 2024 10:59:52 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 21 Jun 2024 10:59:52 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.45) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 21 Jun 2024 10:59:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VDcPysyL1CYBHGzKL7gZoVWRN2GUQTzFXo88vHyUb8P6pNQKDXUqGLQzpPV6vQTf4bNU3t2AIlPZtpRwqX/TlVYR+YUfupHiUsENHXM/W/e3zGYrrFV3Pd3rtRoJdejQ4BfypglJvizu6lSLZlsEpmfx0ZzjrfH+Bs49vzMpzP+Z0I6TG2DThyshC5HEW1oE/QU+H7a4Bb8BHVUsEyJjx0A5DUHp8xJ/92OSBV1ar63V6EdtCEcgvJy767cGTAzbzmcB0c/bZ91fccUw33GcL5FTdjzJzr/4bG60hwvfRlQRny1CC1jU7mKckOO7tXy0B+sQWCMj3Yu3LJP/rgXM3A== 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=wevQysr0nHN4aWSQUBiGku5yOthrKoXFko6oqsVsxhg=; b=bLRtCD8JEJ/h+9LPVYrbqXHS6e9Y5xXEOsGnieeZpP4FCL/KmjJ86+YRGpk4ybSPDiGaErR3tiWQAdS2ahx7cI9QA0Enw65aW3A9IP3iMpz2rQY/Rb8PwxGLimZy9+47D3y5+fWO1j5jnWwU81I27+PmgXfjD3eaCV9kfWA6EiL6z4VyQyI3OUnE9izT7qh3x8yecnOftRr140cBgmkRgjbD2tTkrUFdgyBmyUTu2iom1yNjM54lxcSb7OOSffwRXdX9oDXVTG8+MIk+7Kn/YQaugnoyjrgFEaPWFA8ift+uj8cBeb7qNVfJuZbYPXxfN9s7GrF7emR/fz47dfXZKA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH8PR11MB8107.namprd11.prod.outlook.com (2603:10b6:510:256::6) by SA1PR11MB8374.namprd11.prod.outlook.com (2603:10b6:806:385::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.22; Fri, 21 Jun 2024 17:59:49 +0000 Received: from PH8PR11MB8107.namprd11.prod.outlook.com ([fe80::6b05:74cf:a304:ecd8]) by PH8PR11MB8107.namprd11.prod.outlook.com ([fe80::6b05:74cf:a304:ecd8%6]) with mapi id 15.20.7633.021; Fri, 21 Jun 2024 17:59:49 +0000 Date: Fri, 21 Jun 2024 10:59:46 -0700 From: Dan Williams To: Jonathan Cameron , Shiyang Ruan CC: , , , , , , , , Borislav Petkov , Tony Luck , James Morse , "Mauro Carvalho Chehab" , Robert Richter , , Miaohe Lin , "Naoya Horiguchi" , Subject: Re: [RFC PATCH] cxl: avoid duplicating report from MCE & device Message-ID: <6675bf92116ed_57ac294a@dwillia2-xfh.jf.intel.com.notmuch> References: <20240618165310.877974-1-ruansy.fnst@fujitsu.com> <20240620180239.00004d41@Huawei.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240620180239.00004d41@Huawei.com> X-ClientProxiedBy: MW4PR03CA0329.namprd03.prod.outlook.com (2603:10b6:303:dd::34) To PH8PR11MB8107.namprd11.prod.outlook.com (2603:10b6:510:256::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR11MB8107:EE_|SA1PR11MB8374:EE_ X-MS-Office365-Filtering-Correlation-Id: cc749220-cdfc-41b4-fffa-08dc921bf18f X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|366013|1800799021; X-Microsoft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nGuMjnqWpN86V35owZkuLYZRD04j8IVtQRNFs11EQ?= =?us-ascii?Q?Grb+5AOc6hA7TKXYNPCgqVJZFi/s7sveioiyW5u4FSJ0voAh6WXh7QAbtdP6?= =?us-ascii?Q?uwyP3gqXQ968D8stZmT9Cb88dKgjB++3dVCGkGo9ltj6+b32sOgl7MAXCdtT?= =?us-ascii?Q?b+11w32Qo1pjR71VVPTbWCaSViYJfN4IcFr2CPSDY6PLq2MBTQHcA7ITB2F0?= =?us-ascii?Q?r8PgWdFFwB1PKQsjuhzi75asO6s3XqHwLVjHM1SU7IZEcbSD1vPztlmeeqM1?= =?us-ascii?Q?oZ6VnuWL/gLcmSJmen2jCU1aYqiEmsYSvtAxmWL63cJ7vidQOwpPdSQUk0yv?= =?us-ascii?Q?2KIg1J4C3MMnh9eGgfU1ZC09BQRcSPmh0/RZ4TUOFkmfpAUodYny04JNw2sk?= =?us-ascii?Q?rPa3YkobbW6s2AheUeed?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH8PR11MB8107.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(376011)(7416011)(366013)(1800799021); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?hqc5L/3aO9d5+x423sfEjhe3I7wQD3wmoIBkFygqbd/GfPpDvefarQB8vGxT?= =?us-ascii?Q?Wn86UL0mA06kA0a8nQEI/P5ubrUTlQEknjW8wTXo9GMQht/F2UIdPhZBet4l?= =?us-ascii?Q?8vf7DthQoir0DAIMWpB0jsyCmz3sZFqi0goqdhHHBI9Jzx6iq+/HZTdY01Pd?= =?us-ascii?Q?TjCKcmMKSp6c8tlBHmXaH0vot1ZLouDwXXRR7FvcmriwXAn5KGkzdXkuQ9GO?= =?us-ascii?Q?l9nclPgvHlGlL3u4AN9YHNNA/sllCHUF3Z7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?8TjQyDuHoYgGZsYdTlUuG3CDW1L4bv3P8HdqY0uAhNWvg0Fmso9pvoMAowlR?= =?us-ascii?Q?vbMpykHjAp1hl8kHkc36ru8j5q6siO5pk6kyw9dsBiVp2c7ZcYHeS8U1oRfd?= =?us-ascii?Q?V4AyCd69XAXAmPiyMhZRwf9L0ZqflFeK9SFNPMr8hf7Hgo73xziMJAuNLwIC?= =?us-ascii?Q?otDLNHC/n5a9SmvR5yuLitmqWBqPqPz6Stwew3SdBu6an+wclVpjA9fEBlem?= =?us-ascii?Q?y0GmfekAKpnLve1bCYAY3d6eMDo5YEITEGn33Q4+3Z6q1YTOaPcEu0RomxiM?= =?us-ascii?Q?DT/DuKho30odYAHh5tmVsRSAcMj8mM9Vlm8HGiwAZdk4W9tUa0ok4ZKAU4Av?= =?us-ascii?Q?agXqglsgooO8VXA/EqjAAsGs8dDjTcAwvpEnL2UYwifkJH/q7rXaXatjIt/5?= =?us-ascii?Q?seuwezWSm5xtpYVVK79yTqA8hLSd+y9/0FZag3bnsCX9nXJOfbaF/aW4R42O?= =?us-ascii?Q?ig=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: cc749220-cdfc-41b4-fffa-08dc921bf18f X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB8107.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2024 17:59:49.5481 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BN93KaI8gKKNcVoxnqbhBN+yT15aawKCrai01foH2617Tmt5cDcGiKRpJM5lJRMrdAVPkby5Qed9loaheHZQcUXnRZsCNjL+MFGtwCbhNzE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8374 X-OriginatorOrg: intel.com Received-SPF: pass client-ip=198.175.65.10; envelope-from=dan.j.williams@intel.com; helo=mgamail.intel.com X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Jonathan Cameron wrote: > On Wed, 19 Jun 2024 00:53:10 +0800 > Shiyang Ruan wrote: > > > Background: > > Since CXL device is a memory device, while CPU consumes a poison page of > > CXL device, it always triggers a MCE by interrupt (INT18), no matter > > which-First path is configured. This is the first report. Then > > currently, in FW-First path, the poison event is transferred according > > to the following process: CXL device -> firmware -> OS:ACPI->APEI->GHES > > -> CPER -> trace report. This is the second one. These two reports > > are indicating the same poisoning page, which is the so-called "duplicate > > report"[1]. And the memory_failure() handling I'm trying to add in > > OS-First path could also be another duplicate report. > > > > Hope the flow below could make it easier to understand: > > CPU accesses bad memory on CXL device, then > > -> MCE (INT18), *always* report (1) > > -> * FW-First (implemented now) > > -> CXL device -> FW > > -> OS:ACPI->APEI->GHES->CPER -> trace report (2.a) > > * OS-First (not implemented yet, I'm working on it) > > -> CXL device -> MSI > > -> OS:CXL driver -> memory_failure() (2.b) > > so, the (1) and (2.a/b) are duplicated. > > > > (I didn't get response in my reply for [1] while I have to make patch to > > solve this problem, so please correct me if my understanding is wrong.) > > > > This patch adds a new notifier_block and MCE_PRIO_CXL, for CXL memdev > > to check whether the current poison page has been reported (if yes, > > stop the notifier chain, won't call the following memory_failure() > > to report), into `x86_mce_decoder_chain`. In this way, if the poison > > page already handled(recorded and reported) in (1) or (2), the other one > > won't duplicate the report. The record could be clear when > > cxl_clear_poison() is called. > > > > [1] https://lore.kernel.org/linux-cxl/664d948fb86f0_e8be294f8@dwillia2-mobl3.amr.corp.intel.com.notmuch/ > > > > Signed-off-by: Shiyang Ruan > > So poison can be cleared in a number of ways and a CXL poison clear command > is unfortunately only one of them. Some architectures have instructions > that guarantee to write a whole cacheline and can clear things as well. > I believe x86 does for starters. Yes, movdir64b. > +CC linux-edac and related maintainers / reviewers. > linux-mm and hwpoison maintainer. > > So I think this needs a more general solution that encompasses > more general cleanup of poison. I think unless the device has "List Poison" coverage for volatile ranges that the kernel should not worry about tracking this itself. Perhaps what is needed is that after successful memory_failure() handling when the page is known to be offline the device backing the memory can be notified that it is safe to repair the page and but it back into service, but I expect that would be comparison of the device's own poison tracking relative to the notification of successful page offline. > > Trivial comments inline. > > Jonathan > > > > --- > > arch/x86/include/asm/mce.h | 1 + > > drivers/cxl/core/mbox.c | 130 +++++++++++++++++++++++++++++++++++++ > > drivers/cxl/core/memdev.c | 6 +- > > drivers/cxl/cxlmem.h | 3 + > > 4 files changed, 139 insertions(+), 1 deletion(-) > > > > diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h > > index dfd2e9699bd7..d8109c48e7d9 100644 > > --- a/arch/x86/include/asm/mce.h > > +++ b/arch/x86/include/asm/mce.h > > @@ -182,6 +182,7 @@ enum mce_notifier_prios { > > MCE_PRIO_NFIT, > > MCE_PRIO_EXTLOG, > > MCE_PRIO_UC, > > + MCE_PRIO_CXL, > > MCE_PRIO_EARLY, > > MCE_PRIO_CEC, > > MCE_PRIO_HIGHEST = MCE_PRIO_CEC > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > > index 2626f3fff201..0eb3c5401e81 100644 > > --- a/drivers/cxl/core/mbox.c > > +++ b/drivers/cxl/core/mbox.c > > @@ -4,6 +4,8 @@ > > #include > > #include > > #include > > +#include > > +#include > > #include > > #include > > #include > > @@ -880,6 +882,9 @@ void cxl_event_trace_record(const struct cxl_memdev *cxlmd, > > if (cxlr) > > hpa = cxl_trace_hpa(cxlr, cxlmd, dpa); > > > > + if (hpa != ULLONG_MAX && cxl_mce_recorded(hpa)) > > + return; > > + > > if (event_type == CXL_CPER_EVENT_GEN_MEDIA) > > trace_cxl_general_media(cxlmd, type, cxlr, hpa, > > &evt->gen_media); > > @@ -1408,6 +1413,127 @@ int cxl_poison_state_init(struct cxl_memdev_state *mds) > > } > > EXPORT_SYMBOL_NS_GPL(cxl_poison_state_init, CXL); > > > > +struct cxl_mce_record { > > + struct list_head node; > > + u64 hpa; > > +}; > > +LIST_HEAD(cxl_mce_records); > > +DEFINE_MUTEX(cxl_mce_mutex); > > + > > +bool cxl_mce_recorded(u64 hpa) > > +{ > > + struct cxl_mce_record *cur, *next, *rec; > > + int rc; > > + > > + rc = mutex_lock_interruptible(&cxl_mce_mutex); > > guard(mutex)(&cxl_mce_muted); Agree, _interruptible is really only suitable for user ABI facing locks, not kernel internal helper functions, but this comment is moot if this tracking switches to xarray. > > > + if (rc) > > + return false; > > + > > + list_for_each_entry_safe(cur, next, &cxl_mce_records, node) { > > + if (cur->hpa == hpa) { > > + mutex_unlock(&cxl_mce_mutex); > > + return true; > > + } > > + } > > + > > + rec = kmalloc(sizeof(struct cxl_mce_record), GFP_KERNEL); > > + rec->hpa = hpa; > > + list_add(&cxl_mce_records, &rec->node); > > + > > + mutex_unlock(&cxl_mce_mutex); > > + > > + return false; > > +} > > + > > +void cxl_mce_clear(u64 hpa) > > +{ > > + struct cxl_mce_record *cur, *next; > > + int rc; > > + > > + rc = mutex_lock_interruptible(&cxl_mce_mutex); > > Maybe cond_guard(). cond_guard() was rejected, you meant scoped_cond_guard()? But, then I think _interruptible is not appropriate here.