From patchwork Wed Aug 16 17:31:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 9904389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CBB7C60231 for ; Wed, 16 Aug 2017 17:32:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B63A328949 for ; Wed, 16 Aug 2017 17:32:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB15328A2E; Wed, 16 Aug 2017 17:32:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AEC928949 for ; Wed, 16 Aug 2017 17:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751943AbdHPRcC (ORCPT ); Wed, 16 Aug 2017 13:32:02 -0400 Received: from mail.skyhub.de ([5.9.137.197]:34292 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbdHPRcC (ORCPT ); Wed, 16 Aug 2017 13:32:02 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7lq_6b4a85v3; Wed, 16 Aug 2017 19:32:00 +0200 (CEST) Received: from pd.tnic (p2003008C2F2EF700683C5B4E29586D59.dip0.t-ipconnect.de [IPv6:2003:8c:2f2e:f700:683c:5b4e:2958:6d59]) (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 5F60B1EC073A; Wed, 16 Aug 2017 19:32:00 +0200 (CEST) Date: Wed, 16 Aug 2017 19:31:53 +0200 From: Borislav Petkov To: Steven Rostedt Cc: "Luck, Tony" , "Kani, Toshimitsu" , "rjw@rjwysocki.net" , "lenb@kernel.org" , "mchehab@kernel.org" , "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "linux-edac@vger.kernel.org" Subject: Re: [PATCH v2 4/7] ghes_edac: avoid multiple calls to dmi_walk() Message-ID: <20170816173153.gl4gx2bo7pvfjha7@pd.tnic> References: <1502736750.2042.145.camel@hpe.com> <20170814193432.mjldfhfal5ba5dt7@pd.tnic> <1502741290.2042.147.camel@hpe.com> <20170814203942.6t3mrq3hc324blab@pd.tnic> <1502810766.2042.149.camel@hpe.com> <20170815154815.wy3dqwb4yi3feahg@intel.com> <20170816082931.p6rpvtlxwt5nccxr@pd.tnic> <20170816095901.33b0d4c2@gandalf.local.home> <20170816140350.o573iksqgkj4m5xu@pd.tnic> <20170816102249.0c0d8d12@gandalf.local.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170816102249.0c0d8d12@gandalf.local.home> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 16, 2017 at 10:22:49AM -0400, Steven Rostedt wrote: > Maybe keep that original mutex just in case. Let's do the elegant thing: diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c index d4089c2980ef..386e04a7bda0 100644 --- a/drivers/edac/ghes_edac.c +++ b/drivers/edac/ghes_edac.c @@ -28,6 +28,7 @@ struct ghes_edac_pvt { char msg[80]; }; +static atomic_t ghes_init = ATOMIC_INIT(0); static struct ghes_edac_pvt *ghes_pvt; /* @@ -426,7 +427,7 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) /* * We have only one logical memory controller to which all DIMMs belong. */ - if (ghes_pvt) + if (atomic_inc_return(&ghes_init) > 1) return 0; /* Get the number of DIMMs */