Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp779645rwe; Wed, 24 Aug 2022 08:52:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR6XCx8b4bJsZOcT0JOz4wFzb+gMadPe0Gw2x8M+rR1bX/9GiG3ViQBZlKzXEIrd+ZtRwOt5 X-Received: by 2002:a17:907:75e8:b0:73d:53dc:661d with SMTP id jz8-20020a17090775e800b0073d53dc661dmr3222845ejc.738.1661356340525; Wed, 24 Aug 2022 08:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661356340; cv=none; d=google.com; s=arc-20160816; b=xoeD1sIPS5WeUf4+CFar195/mRvDg9nvitPQIZxAzfoLPYI+RYj81khrz8noL/Bc6B Jj0qVkG4nW1xYONuaPDLsF8OjIlFefg31YAvpYxidOctHvbGO0uDsZpUBz3jIqj34R5Z 1S6DUMIZbFApGY84o9d/se9VPLtxMEW6r4nbklqzjNBdXJJwyZMVSxRQ+1bidFSYPwqa /VfggNuD5G67vcRg8eigR+MAle5wdt625f5n/GIRt1t5WYGHcF/CaSDMF3rgEk0/AS6T 4vWQWrMHLjGWMHVk0fPI+IaCWynmVjVvV8Q6G7/fxzfEaMtwJ99sRk0Rqmt74goY8U51 eA1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JYAdElWSvwdqbqowgbtvuq6MWUw4TqGpXu8bQC/7Pm0=; b=kbpQzVydkAt4G4UW4YOR8VnK44u++5lTvh+LzezZd3igB0BLGAOZBLbfoNoLfFfCZ1 ToCLow++gYFqVhGE5k8CZpQnWxMNKoyw5pAQW4P2fjKNPnKToP6nkILW2vwo99tz2p79 Czh7hvwtrA027zx1Bjf8CO2nkW+3ZoELxiVDoYFMCC5PUJIJU1bglk6QcOryo8t/UFCA aTGhn4xs0pPUcQ8K53GqRwqTgSDg0izmD+b15siTRZ8+sOGWq7Zsu/7OXnHRym+2Cu2h PPIZNPXLxdW9UFH03GdvNsYOX14SpHvObegUgWzwGvbcAGAoMGfJAEb/w5WmVeIwq0HZ QCZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=UvaT53Lw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne18-20020a1709077b9200b007307fd1b9bbsi2084757ejc.589.2022.08.24.08.51.54; Wed, 24 Aug 2022 08:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=UvaT53Lw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237858AbiHXPht (ORCPT + 99 others); Wed, 24 Aug 2022 11:37:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237255AbiHXPhX (ORCPT ); Wed, 24 Aug 2022 11:37:23 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC344D273; Wed, 24 Aug 2022 08:37:22 -0700 (PDT) Received: from zn.tnic (p200300ea971b9859329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:971b:9859:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id EBDF71EC0532; Wed, 24 Aug 2022 17:37:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1661355437; 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:in-reply-to:in-reply-to: references:references; bh=JYAdElWSvwdqbqowgbtvuq6MWUw4TqGpXu8bQC/7Pm0=; b=UvaT53Lw6sp3lDU5FY7nZjsV1hbuTZWYAMmqdC8eKRyh9ltPO6tLwxIlwKk+8WTRQWWyyA AMVCFJSIqSBkfPt8bkMdizEECMfOW+s1lKwp+rXmY5TNNh3+/CH31j9ASnJsPM2WPV/yIF o75/irqxga5m3fD7BkiINcNIrsXo/Xg= Date: Wed, 24 Aug 2022 17:37:12 +0200 From: Borislav Petkov To: Jia He Cc: Len Brown , James Morse , Tony Luck , Mauro Carvalho Chehab , Robert Richter , Robert Moore , Qiuxu Zhuo , Yazen Ghannam , Jonathan Corbet , Jan Luebbe , Khuong Dinh , Kani Toshi , Ard Biesheuvel , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, devel@acpica.org, "Rafael J . Wysocki" , Shuai Xue , Jarkko Sakkinen , linux-efi@vger.kernel.org, nd@arm.com, "Paul E. McKenney" , Andrew Morton , Neeraj Upadhyay , Randy Dunlap , Damien Le Moal , Muchun Song , linux-doc@vger.kernel.org, stable@kernel.org Subject: Re: [RESEND PATCH v3 3/9] EDAC/ghes: Make ghes_edac a proper module to remove the dependency on ghes Message-ID: References: <20220822154048.188253-1-justin.he@arm.com> <20220822154048.188253-4-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220822154048.188253-4-justin.he@arm.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2022 at 03:40:42PM +0000, Jia He wrote: > Commit dc4e8c07e9e2 ("ACPI: APEI: explicit init of HEST and GHES in > apci_init()") introduced a bug that ghes_edac_register() would be invoked > before edac_init(). Because at that time, the bus "edac" hadn't been even > registered, this created sysfs /devices/mc0 instead of > /sys/devices/system/edac/mc/mc0 on an Ampere eMag server. > > To remove the dependency of ghes_edac on ghes, make it a proper module. Use > a list to save the probing devices in ghes_probe(), and defer the > ghes_edac_register() to module_init() of the new ghes_edac module by > iterating over the devices list. > > Co-developed-by: Borislav Petkov > Signed-off-by: Borislav Petkov > Signed-off-by: Jia He > Fixes: dc4e8c07e9e2 ("ACPI: APEI: explicit init of HEST and GHES in apci_init()") > Cc: stable@kernel.org Why is this marked for stable? The prerequisite patches are needed too. I guess this needs to be communicated to stable folks somehow by doing Cc: stable@kernel.org # needs commits X, Y, ... but I guess the committer needs to do that because only at commit time will X and Y be known... So, is there any particular reason why this should be in stable? > @@ -1442,7 +1449,9 @@ static int ghes_remove(struct platform_device *ghes_dev) > > ghes_fini(ghes); > > - ghes_edac_unregister(ghes); > + mutex_lock(&ghes_devs_mutex); > + list_del_rcu(&ghes->elist); Is that list RCU-protected? > + mutex_unlock(&ghes_devs_mutex); > > kfree(ghes); ... > @@ -566,3 +549,35 @@ void ghes_edac_unregister(struct ghes *ghes) > unlock: > mutex_unlock(&ghes_reg_mutex); > } > + > +static int __init ghes_edac_init(void) > +{ > + struct ghes *g, *g_tmp; > + > + if (!IS_ENABLED(CONFIG_X86)) > + force_load = true; No, this is not how this works. > + ghes_devs = ghes_get_devices(force_load); > + if (!ghes_devs) > + return -ENODEV; You simply need to check force_load here. > + list_for_each_entry_safe(g, g_tmp, ghes_devs, elist) { > + ghes_edac_register(g->dev); > + } > + > + return 0; > +} -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette