Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164318AbdD0W2T (ORCPT ); Thu, 27 Apr 2017 18:28:19 -0400 Received: from g2t2352.austin.hpe.com ([15.233.44.25]:32950 "EHLO g2t2352.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751488AbdD0W2L (ORCPT ); Thu, 27 Apr 2017 18:28:11 -0400 From: "Kani, Toshimitsu" To: "dan.j.williams@intel.com" CC: "linux-kernel@vger.kernel.org" , "linux-nvdimm@lists.01.org" , "linux-acpi@vger.kernel.org" , "vishal.l.verma@intel.com" Subject: Re: [PATCH] libnvdimm, pmem: fix badblocks notification crash Thread-Topic: [PATCH] libnvdimm, pmem: fix badblocks notification crash Thread-Index: AQHSv6PtVgq0uysXT06LC9cADBN5wqHZytAAgAAAoYCAAAA4AA== Date: Thu, 27 Apr 2017 22:28:08 +0000 Message-ID: <1493332056.30303.2.camel@hpe.com> References: <149333101097.4714.1923436715100717938.stgit@dwillia2-desk3.amr.corp.intel.com> <1493331874.30303.1.camel@hpe.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [15.219.163.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AT5PR84MB0258;7:9QT21gGo6qTFTtEqyrMhiERWT11PjmaqMzudjmqecrGcTtnOPZe/5u82DyPUX1a852ibu7iEzm1nLwQrZqVEndL5pmLzRVaE6TlTj70jOV3z+5laHzscjrMhxKhCgKYkByn0fYMpHXxXE+Qb3R3TTgLmExLi3Oox4FJxVnd9bZ7R4pqPqxnkLEYX9NSNYqVh+62NsFmRtw3trN3zzdzEMqfTmYVMPBIhh5OQP/PvOn6yPoLINJIEkZ3dTaZNg4LZ7KCjhbCcp9OBntGqhyDVgQ7FXnnYbROvcD8pui8yLjKolR7yhiY45imKP08gWFh/uT9b1e3m8Oe4/HqrMvXfhg== x-ms-office365-filtering-correlation-id: 6c1da79b-6c4d-4e74-745b-08d48dbcae9c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075);SRVR:AT5PR84MB0258; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(6072148);SRVR:AT5PR84MB0258;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0258; x-forefront-prvs: 029097202E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39400400002)(39840400002)(39850400002)(39860400002)(39450400003)(377424004)(377454003)(24454002)(2501003)(102836003)(189998001)(76176999)(103116003)(54356999)(81166006)(3846002)(6246003)(66066001)(8676002)(8936002)(50986999)(7736002)(305945005)(86362001)(5660300001)(3660700001)(229853002)(2900100001)(33646002)(4326008)(6486002)(6506006)(77096006)(2351001)(5640700003)(2906002)(6512007)(6436002)(53936002)(54906002)(36756003)(38730400002)(122556002)(53546009)(25786009)(3280700002)(6916009)(110136004)(2950100002);DIR:OUT;SFP:1102;SCL:1;SRVR:AT5PR84MB0258;H:AT5PR84MB0260.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <7EFCBCB0D51FFA4D99C2D8DB684A9BC8@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Apr 2017 22:28:08.7398 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR84MB0258 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 mail.home.local id v3RMSUaf015908 Content-Length: 1423 Lines: 38 On Thu, 2017-04-27 at 15:26 -0700, Dan Williams wrote: > On Thu, Apr 27, 2017 at 3:25 PM, Kani, Toshimitsu > wrote: > > On Thu, 2017-04-27 at 15:10 -0700, Dan Williams wrote: > > > The nd_pmem_notify() routine is called whenever an ARS > > > (address-range-scrub) completes to communicate results to the > > > per-namespace badblocks instances. > > > > > > When the namespace is in btt mode we crash because we do not > > > allocate a struct pmem_device instance in that case. Resulting in > > > the following crash signature: > > > > > >  BUG: unable to handle kernel NULL pointer dereference at > > > 0000000000000030 > > >  IP: nd_pmem_notify+0x30/0xf0 [nd_pmem] > > >  Call Trace: > > >   nd_device_notify+0x40/0x50 > > >   child_notify+0x10/0x20 > > >   device_for_each_child+0x50/0x90 > > >   nd_region_notify+0x20/0x30 > > >   nd_device_notify+0x40/0x50 > > >   nvdimm_region_notify+0x27/0x30 > > >   acpi_nfit_scrub+0x341/0x590 [nfit] > > >   process_one_work+0x197/0x450 > > >   worker_thread+0x4e/0x4a0 > > >   kthread+0x109/0x140 > > > > > > Given that we don't even populate the btt badblocks instance, > > > just return early and skip the device to region lookup. > > > > We populate the btt badblocks into nsio->bb, and check/clear them > > in nsio_rw_bytes(). > > Argh, yes, we don't populate them out to the disk badblocks. I'll go > with your patch. Thanks! -Toshi