From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751561AbdISWG1 (ORCPT ); Tue, 19 Sep 2017 18:06:27 -0400 Received: from g2t1383g.austin.hpe.com ([15.233.16.89]:54032 "EHLO g2t1383g.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbdISWGZ (ORCPT ); Tue, 19 Sep 2017 18:06:25 -0400 From: "Saldivar, Maurice A." To: "dan.j.williams@intel.com" , "linux-nvdimm@lists.01.org" CC: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , "vishal.l.verma@intel.com" Subject: Re: [PATCH 2/2] libnvdimm, namespace: fix btt claim class crash Thread-Topic: [PATCH 2/2] libnvdimm, namespace: fix btt claim class crash Thread-Index: AQHTMYGmQZ7fW2ah00OBp3ATP++JYqK8wgUA Date: Tue, 19 Sep 2017 22:06:21 +0000 Message-ID: <1505858348.3864.8.camel@hpe.com> References: <150585068899.18066.14107564726083870194.stgit@dwillia2-desk3.amr.corp.intel.com> <150585069444.18066.1329567407748978657.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <150585069444.18066.1329567407748978657.stgit@dwillia2-desk3.amr.corp.intel.com> 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=maurice.a.saldivar@hpe.com; x-originating-ip: [15.203.233.79] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;TU4PR84MB0191;6:CCFZILKRxZuF5cmQlZnuhIviiyWuXdM7dMGDgFkoTHV882wyoVHGPvNUeZyzokqLbZ1wRoYQ60BlyyOUNzzcgFoEy6vFtmSLX2MJbEYf33sUqMTaz6kjg3PGBfnxR9uYxKEKmwVO8f9MaRbaaewSVw2/D4pYY8Z12gbFXlc1hayk2CoxbXHC+jp9I/1peoiRZifEODl6tZxG0qd73+ZtItNlgUh2Pf58h7j73yTDtPUMqGleNB8xBITRqmVb7JV+2K7YtiJtXY5y2c1Uyj4GnNPo6ADgErNF0K6ymOVqP3ULgwXZz2+Zh8VG6Q4DJ6ugWYNAg2/1YCPKshP4btWFPQ==;5:FVfYGpLNqUDKniDu7Dg78sSoJGKocqmxfaxR3Xk/ZI0lUoRs1kmY0/sHoS/YTytZbWpWWcQ9HOb2ubgP+d+hy4b3/it1tVkv+QqxqigEZZi/rev4xIOYLHK6AX1FrjjiA8nFDvTNNjgl+IS/74Fgkw==;24:yNiHOXwZdsa2dfGM1A1HOAPP+eb5Re9cIvcDWxKqxmTKrP2ZR7qaTGoBh9sh7bNpF9B+CRj8h0taga99Vm7ODREla3QfwHqzwtcw38qF0DU=;7:sM4TeutKSd9X+duwrR9Aqw1j3aC6kzSd2CX9XripvZTKuQ56S7SXr2Ts6P5CJ+OOEyJqvbQA9ntvORjON8I9aon8bry9jGEb5ODgDP5d8Cte5VN2REFzXxEoxuDUNSDjjhEiLGc0Bk4Vb4soxFviLo5cMACDzul2z4u+PRPfFJRYUBCc1nsRn7rBT8+miGAm0yL5hq2LI0tb/FMgSv1mpNQAy2ivtjvy0xnB/fiBYYk= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 7edf1797-a0c9-4315-ee5e-08d4ffaaa964 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(48565401081)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:TU4PR84MB0191; x-ms-traffictypediagnostic: TU4PR84MB0191: x-exchange-antispam-report-test: UriScan:(227479698468861)(20558992708506)(9452136761055)(228905959029699); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:TU4PR84MB0191;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:TU4PR84MB0191; x-forefront-prvs: 04359FAD81 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(376002)(346002)(189002)(199003)(24454002)(377424004)(7736002)(3846002)(6116002)(14454004)(2900100001)(36756003)(6436002)(103116003)(6506006)(86362001)(101416001)(106356001)(229853002)(102836003)(54906003)(2501003)(53936002)(105586002)(189998001)(97736004)(478600001)(6512007)(25786009)(50986999)(76176999)(8676002)(316002)(54356999)(5660300001)(81166006)(81156014)(33646002)(6486002)(4326008)(305945005)(68736007)(6246003)(3660700001)(8936002)(77096006)(66066001)(3280700002)(2906002)(2950100002)(110136005);DIR:OUT;SFP:1102;SCL:1;SRVR:TU4PR84MB0191;H:TU4PR84MB0190.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: <68F72D9660D1F94088366C698FD6E9E4@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2017 22:06:21.6007 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR84MB0191 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 v8JM6Wpu027164 I applied this and the kernel patch and was successfully able to configure an NVDIMM-N into sector mode. I do have a question about specific behavior I observed. Before I was able to configure an NVDIMM into any mode from any mode. With these patchs if I go to sector mode and try going to memory or dax mode it fails with:  # ndctl create-namespace -f -e namespace0.0 -m memory   Error: namespace0.0: sector_size: 4096 not supported failed to reconfigure namespace: Invalid argument   but if I go sector->raw-> I can get into other modes fine. Was this the intended behavior?  Sincerely,  Maurice   On Tue, 2017-09-19 at 12:51 -0700, Dan Williams wrote: > Maurice reports: > >     BUG: unable to handle kernel NULL pointer dereference at > 0000000000000028 >     IP: holder_class_store+0x253/0x2b0 [libnvdimm] > > ...while trying to reconfigure an NVDIMM-N namespace into 'sector' / > 'btt' mode. The crash points to this line: > >     (gdb) li *(holder_class_store+0x253) >     0x7773 is in holder_class_store > (drivers/nvdimm/namespace_devs.c:1420). >     1415            for (i = 0; i < nd_region->ndr_mappings; i++) { >     1416                    struct nd_mapping *nd_mapping = > &nd_region->mapping[i]; >     1417                    struct nvdimm_drvdata *ndd = > to_ndd(nd_mapping); >     1418                    struct nd_namespace_index *nsindex; >     1419 >     1420                    nsindex = to_namespace_index(ndd, ndd- > >ns_current); > > ...where we are failing because ndd is NULL due to NVDIMM-N dimms not > supporting labels. > > Long story short, default to the BTTv1 format in the label-less / > NVDIMM-N case. > > Fixes: 14e494542636 ("libnvdimm, btt: BTT updates for UEFI 2.7 > format") > Cc: > Cc: Vishal Verma > Reported-by: Maurice A. Saldivar > Signed-off-by: Dan Williams > --- >  drivers/nvdimm/namespace_devs.c |    9 +++++++++ >  1 file changed, 9 insertions(+) > > diff --git a/drivers/nvdimm/namespace_devs.c > b/drivers/nvdimm/namespace_devs.c > index 1427a386a033..3e4d1e7998da 100644 > --- a/drivers/nvdimm/namespace_devs.c > +++ b/drivers/nvdimm/namespace_devs.c > @@ -1417,6 +1417,15 @@ static int btt_claim_class(struct device *dev) >   struct nvdimm_drvdata *ndd = to_ndd(nd_mapping); >   struct nd_namespace_index *nsindex; >   > + /* > +  * If any of the DIMMs do not support labels the > only > +  * possible BTT format is v1. > +  */ > + if (!ndd) { > + loop_bitmask = 0; > + break; > + } > + >   nsindex = to_namespace_index(ndd, ndd->ns_current); >   if (nsindex == NULL) >   loop_bitmask |= 1; >