Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544AbdHDVs3 (ORCPT ); Fri, 4 Aug 2017 17:48:29 -0400 Received: from g4t3425.houston.hpe.com ([15.241.140.78]:46014 "EHLO g4t3425.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbdHDVs0 (ORCPT ); Fri, 4 Aug 2017 17:48:26 -0400 From: "Kani, Toshimitsu" To: "bp@alien8.de" CC: "linux-edac@vger.kernel.org" , "lenb@kernel.org" , "mchehab@kernel.org" , "tony.luck@intel.com" , "linux-kernel@vger.kernel.org" , "rjw@rjwysocki.net" , "linux-acpi@vger.kernel.org" Subject: Re: [PATCH v2 7/7] edac drivers: add MC owner check in init Thread-Topic: [PATCH v2 7/7] edac drivers: add MC owner check in init Thread-Index: AQHTDKUAfktjLOT49USn5fr8A7X0qaJz4Q0AgADZxwA= Date: Fri, 4 Aug 2017 21:48:23 +0000 Message-ID: <1501882730.2042.123.camel@hpe.com> References: <20170803215753.30553-1-toshi.kani@hpe.com> <20170803215753.30553-8-toshi.kani@hpe.com> <20170804083922.GC15617@nazgul.tnic> In-Reply-To: <20170804083922.GC15617@nazgul.tnic> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=toshi.kani@hpe.com; x-originating-ip: [15.219.147.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DF4PR84MB0185;6:ETmixhnPkKhJww+b5Lul97m1TMWAjHmkPMGxWbw4lGHhLctrl6/A8t5KhiYLUmFzL8eaF+QGdIhe+Tmdwd6ANoUkrfW7IsvztIdBa7e8OCuXoI1vFwRNxZaQDZfAqjjk4XcZgAvBh3wRKJsXRojACQN0LGggEMEgU38Dl//TitiPbtAebojbfgZ7mbOTvaRZzMQhKEkpjVL1fw0y00xKWt6tzEJopX2vr75yvWgdKIJ7YeWq1g37edBdmHCyo+wIPJgBcRSzPi0uX2mpzAiknTTP32xNuB5ZE9eJlMOh3Ib7KvcRAL85eBZnlY+omhLO6GruouVH2Z36cYghqDVjWw==;5:9RdXhpjE6SS3piHoQIjLgaaZmdUtjHzqYhZPLFv8dvnLU11aUlkqC//ghrH6qRBp68y134yxX/RjLGjCV4I523tOAEiNqrkMF0CHKnpl5RJdGmy42Dv+K6QKQ4RMJ7RPU+f8tl5UtfUVugXRRn6vLA==;24:A5/eHewOzltP3ydLZ6Vv5MkDBU0kckgQQUmxE1ENwEHAkc/uhE+2i2Y40huaEzkrU+9pQmLj/kRs+Sk7BuzaV2q/XIQKmZZCXQreBqpJzsU=;7:Zm7kBlDRlRhPODJE8wJVPil7bet1czLVceKYJUdU2JgS3KjzxGMpLRuplEJACwJp4Fm2ICBRevOb8EDlw62PMHKk2WBD69YZO+aXQSI2J+QFr8B7M8fO1dVF8ZxQTXHPBxn6hDxClqU+mbDJ1A+3EW+b7aCZctQOJbewrmanjdayD4jMRP8CQp3sctbjGKjJh87EKcrzky+GFH1nJ7NKmyRVRS0EFXi9fuQz9mvMZ1E= x-ms-office365-filtering-correlation-id: d0acacef-959b-4c63-6fc1-08d4db828798 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603031)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DF4PR84MB0185; x-ms-traffictypediagnostic: DF4PR84MB0185: x-exchange-antispam-report-test: UriScan:(227479698468861)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6055026)(6041248)(20161123564025)(20161123558100)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DF4PR84MB0185;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DF4PR84MB0185; x-forefront-prvs: 0389EDA07F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39850400002)(39400400002)(39450400003)(39840400002)(39860400002)(189002)(199003)(377424004)(24454002)(97736004)(66066001)(6506006)(14454004)(101416001)(68736007)(4326008)(2950100002)(6916009)(189998001)(229853002)(86362001)(3846002)(110136004)(102836003)(6486002)(6116002)(77096006)(50986999)(2900100001)(76176999)(54356999)(53936002)(38730400002)(1730700003)(8676002)(6246003)(81166006)(81156014)(8936002)(5660300001)(36756003)(5640700003)(6436002)(106356001)(54906002)(6512007)(2906002)(105586002)(478600001)(7736002)(3660700001)(33646002)(305945005)(2351001)(3280700002)(2501003)(25786009)(103116003);DIR:OUT;SFP:1102;SCL:1;SRVR:DF4PR84MB0185;H:DF4PR84MB0187.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <59BB3133F3048847B830758BF13F5805@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Aug 2017 21:48:23.1665 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0185 X-OriginatorOrg: hpe.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v74LmZ2h008072 Content-Length: 3497 Lines: 103 On Fri, 2017-08-04 at 10:39 +0200, Borislav Petkov wrote: > On Thu, Aug 03, 2017 at 03:57:53PM -0600, Toshi Kani wrote: > > Change generic x86 edac drivers, which probe CPU type with > > x86_match_cpu(), to call edac_check_mc_owner() in their > > module init functions.  This allows them to fail their init > > at the beginning when ghes_edac is enabled.  Similar change > > can be made to other edac drivers as necessary. > > > > This is an optimization and there is no functional change. > > > > Signed-off-by: Toshi Kani > > Suggested-by: Borislav Petkov > > Cc: Borislav Petkov > > Cc: Mauro Carvalho Chehab > > Cc: Tony Luck > > --- > >  drivers/edac/amd64_edac.c |    3 +++ > >  drivers/edac/pnd2_edac.c  |    7 ++++++- > >  drivers/edac/sb_edac.c    |    7 +++++-- > >  drivers/edac/skx_edac.c   |    6 +++++- > >  4 files changed, 19 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c > > index 3aea556..cdb40d6 100644 > > --- a/drivers/edac/amd64_edac.c > > +++ b/drivers/edac/amd64_edac.c > > @@ -3444,6 +3444,9 @@ static int __init amd64_edac_init(void) > >   if (amd_cache_northbridges() < 0) > >   return -ENODEV; > >   > > + if (!edac_check_mc_owner(EDAC_MOD_STR)) > > + return -EBUSY; > > + > > That needs to happen first in the init function. Not sure if anyone cares, but I thought it should return with -ENODEV when this modules found no target, and -EBUSY when it found a target but it's busy. Hence, this ordering. > >   opstate_init(); > >   > >   err = -ENOMEM; > > diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c > > index 8e59949..a5b7855 100644 > > --- a/drivers/edac/pnd2_edac.c > > +++ b/drivers/edac/pnd2_edac.c > > @@ -45,6 +45,8 @@ > >  #include "edac_module.h" > >  #include "pnd2_edac.h" > >   > > +#define PND2_MOD_NAME "pnd2_edac.c" > > EDAC_MOD_STR and look how the other drivers define it, i.e., without > the ".c" OK, I will change to use EDAC_MOD_STR and remove ".c". > > + > >  #define APL_NUM_CHANNELS 4 > >  #define DNV_NUM_CHANNELS 2 > >  #define DNV_MAX_DIMMS 2 /* Max DIMMs per channel */ > > @@ -1313,7 +1315,7 @@ static int pnd2_register_mci(struct > > mem_ctl_info **ppmci) > >   pvt = mci->pvt_info; > >   memset(pvt, 0, sizeof(*pvt)); > >   > > - mci->mod_name = "pnd2_edac.c"; > > + mci->mod_name = PND2_MOD_NAME; > >   mci->dev_name = ops->name; > >   mci->ctl_name = "Pondicherry2"; > >   > > @@ -1513,6 +1515,9 @@ static int __init pnd2_init(void) > >   if (!id) > >   return -ENODEV; > >   > > + if (!edac_check_mc_owner(PND2_MOD_NAME)) > > + return -EBUSY; > > Also first thing to do in the function. > > > + > >   ops = (struct dunit_ops *)id->driver_data; > >   > >   /* Ensure that the OPSTATE is set correctly for POLL or > > NMI */ > > diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c > > index 80d860c..71bd66e 100644 > > --- a/drivers/edac/sb_edac.c > > +++ b/drivers/edac/sb_edac.c > > @@ -36,7 +36,7 @@ static LIST_HEAD(sbridge_edac_list); > >   * Alter this version for the module when modifications are made > >   */ > >  #define SBRIDGE_REVISION    " Ver: 1.1.2 " > > -#define EDAC_MOD_STR      "sbridge_edac" > > +#define SBRIDGE_MOD_NAME    "sb_edac.c" > > Why? EDAC_MOD_STR is just fine. I simply kept what it has today. Will remove ".c". Thanks, -Toshi