Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp399631imm; Mon, 4 Jun 2018 20:33:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKloaRD4hJNOd9KNY8w4REUatOdMK6S+nVJdhyTT0KZYB0B0BZ/OLd9OAAeoJBkkWT59DAG X-Received: by 2002:a17:902:301:: with SMTP id 1-v6mr24546132pld.127.1528169619593; Mon, 04 Jun 2018 20:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528169619; cv=none; d=google.com; s=arc-20160816; b=feXgrolgXQDEmUWiCed0KJC5ULB8T3RKh3m3tVOuLN5ez7MBYjHJlfr5Ci4VbuzPFL v5TqIIbKZsK+wQzSd5AQeA3WrmLA4OpYuMXGL0QyaiGADytUVdNHgc3asQaY0F3SsaXE /9RsQTX+q/fVR0siogmGvmn3e3cUBS8ltNFVAdWIXGPVupJ0iPSshZcfnkad2dmXaR2I DWJfw/0Z6ZQ9zHa+uVWS4CyU1eQczgDi/KGuu7zkgFvtpAmUokxJ/p8lguuLe0T8sJ+V H1Ru/chpoiqSQxO6+wU/eC5yFalvEsowrSgoA4HSIze78Z2b05ZvMbEWY5341LBnW3Ji SGBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=eLy5LdDEG9q7Seg40lgwRmlMLAEt/zjsfxskebE6N5c=; b=xgj4Hg40/8kTBHnUV7FF9SQtxakdkzQH+yuWtkDH8ZgsCWSo00rmeJS3nOeSrUNeSa L1tRvrpuwvYEh2Hw0FliE82t5jufRg2SM3iUuLFoda+gYcFH29ZUaYlw9uim9d+CSsYr OvwgvZ1NEd0dnrfQWvWywDWuvSxloT0WxYrOO4rsCy9DN625uWQf/9mYgoB0G4AWPOSH U45E+2rxVceH3VZFpJrrbhycH+mvhf9K2cE50VieKf8tVjTvH1G/BTfDim6GgUeJdfI0 JGvElXHDXSdMFdnkxwLCQW77y6iQmIFFFcg6yWp4Jfh8XRKBuEqDI+uwL77+G6JrFCkY poJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Hv+MYXrt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23-v6si7318006pfl.8.2018.06.04.20.33.11; Mon, 04 Jun 2018 20:33:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Hv+MYXrt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751449AbeFEDce (ORCPT + 99 others); Mon, 4 Jun 2018 23:32:34 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:40475 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312AbeFEDcb (ORCPT ); Mon, 4 Jun 2018 23:32:31 -0400 Received: by mail-ot0-f193.google.com with SMTP id n1-v6so1051168otf.7 for ; Mon, 04 Jun 2018 20:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eLy5LdDEG9q7Seg40lgwRmlMLAEt/zjsfxskebE6N5c=; b=Hv+MYXrtrFL7qBmNx7iWlMhQXxKky/bl/8/iBssE4b+b9E4oBXuPnAmLi0NnqkkeBD X0ddZeEevJRTgyHPYZBOvEHg18OQf0TeJlQosuAQ83nGZhmBFuDSyvgH8t0Ut129eV+e 3HzqS8iZBCJun477id1ya7O7lA9R+8gUl+MTikZSr6Ss2KOAlO+PZisBGx8+LpTBQOyU r8/XeytwSGIR52sknohrY9YkDZB5aAtPeOnSl1JCqYOoiFJFCHt6ibIDjrsv0mwoAMfe X5qgdnTLSzSVw/kIF/Ec3U2aKhvpahFR5BnrhJzY3IayabllhT0dR+25rVDgG4XdyhPT kJjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eLy5LdDEG9q7Seg40lgwRmlMLAEt/zjsfxskebE6N5c=; b=KVXIcD4h0Q20CTnvusvYnmDzcoXTyCAF8ScgvWKkbjglB6Fb4hXzf8JgQzrwL6nvLv sDrln0hYsIDroSjUrVOT+boRseP+5T8HeCR1LIPvxB5rFtSEApG227nDhLCsr/g6xsZp 3S+YCAuo1+n1NFfNmGYat+uFzMvkxcpS4VGKYv3K+eitwxw8DWnw13xM/qrgJKeuVq/+ ZwmZWbjsAD1vvMvn/hgqSf7FCk9y8aFZcfVK50h9vrTMiPGlEikJHANixu+e+3EuE3bZ fNwl1TaKyN2LY4rSua2iFub/Mn1+bDQjBq27+JDJ/0GAqCISxu6SzjMvcDVgDo9XLtZI h+cQ== X-Gm-Message-State: APt69E2T1ZUD151/QHOjGX6+A92rVcamETlFBhveTRROufUdJRSS4FXe W2fjNvIn1xBScPhXXuQsyef/27ypOHA45yAxI5ElcQ== X-Received: by 2002:a9d:de3:: with SMTP id 90-v6mr17405316ots.117.1528169551002; Mon, 04 Jun 2018 20:32:31 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2ea9:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 20:32:30 -0700 (PDT) In-Reply-To: References: <20180529195106.14268-1-ross.zwisler@linux.intel.com> <20180529195106.14268-3-ross.zwisler@linux.intel.com> <20180529212510.GJ30110@magnolia> <20180529220114.GA13948@linux.intel.com> <20180531191332.GB7825@magnolia> <20180601012657.GQ10363@dastard> <20180601022418.GR10363@dastard> <20180603222038.GS10363@dastard> <20180604002525.GI10363@dastard> From: Dan Williams Date: Mon, 4 Jun 2018 20:32:30 -0700 Message-ID: Subject: Re: [PATCH v2 2/7] dax: change bdev_dax_supported() to support boolean returns To: Dave Chinner Cc: "Darrick J. Wong" , Mike Snitzer , linux-nvdimm , Linux Kernel Mailing List , linux-xfs , device-mapper development , linux-fsdevel , Dmitry Vyukov , Alexander Potapenko , Andrey Ryabinin Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ adding KASAN devs...] On Mon, Jun 4, 2018 at 4:40 PM, Dan Williams wrote: > On Sun, Jun 3, 2018 at 6:48 PM, Dan Williams wrote: >> On Sun, Jun 3, 2018 at 5:25 PM, Dave Chinner wrote: >>> On Mon, Jun 04, 2018 at 08:20:38AM +1000, Dave Chinner wrote: >>>> On Thu, May 31, 2018 at 09:02:52PM -0700, Dan Williams wrote: >>>> > On Thu, May 31, 2018 at 7:24 PM, Dave Chinner wrote: >>>> > > On Thu, May 31, 2018 at 06:57:33PM -0700, Dan Williams wrote: >>>> > >> > FWIW, XFS+DAX used to just work on this setup (I hadn't even >>>> > >> > installed ndctl until this morning!) but after changing the kernel >>>> > >> > it no longer works. That would make it a regression, yes? >>>> >>>> [....] >>>> >>>> > >> I suspect your kernel does not have CONFIG_ZONE_DEVICE enabled which >>>> > >> has the following dependencies: >>>> > >> >>>> > >> depends on MEMORY_HOTPLUG >>>> > >> depends on MEMORY_HOTREMOVE >>>> > >> depends on SPARSEMEM_VMEMMAP >>>> > > >>>> > > Filesystem DAX now has a dependency on memory hotplug? >>>> >>>> [....] >>>> >>>> > > OK, works now I've found the magic config incantantions to turn >>>> > > everything I now need on. >>>> >>>> By enabling these options, my test VM now has a ~30s pause in the >>>> boot very soon after the nvdimm subsystem is initialised. >>>> >>>> [ 1.523718] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled >>>> [ 1.550353] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A >>>> [ 1.552175] Non-volatile memory driver v1.3 >>>> [ 2.332045] tsc: Refined TSC clocksource calibration: 2199.909 MHz >>>> [ 2.333280] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x1fb5dcd4620, max_idle_ns: 440795264143 ns >>>> [ 37.217453] brd: module loaded >>>> [ 37.225423] loop: module loaded >>>> [ 37.228441] virtio_blk virtio2: [vda] 10485760 512-byte logical blocks (5.37 GB/5.00 GiB) >>>> [ 37.245418] virtio_blk virtio3: [vdb] 146800640 512-byte logical blocks (75.2 GB/70.0 GiB) >>>> [ 37.255794] virtio_blk virtio4: [vdc] 1073741824000 512-byte logical blocks (550 TB/500 TiB) >>>> [ 37.265403] nd_pmem namespace1.0: unable to guarantee persistence of writes >>>> [ 37.265618] nd_pmem namespace0.0: unable to guarantee persistence of writes >>>> >>>> The system does not appear to be consuming CPU, but it is blocking >>>> NMIs so I can't get a CPU trace. For a VM that I rely on booting in >>>> a few seconds because I reboot it tens of times a day, this is a >>>> problem.... >>> >>> And when I turn on KASAN, the kernel fails to boot to a login prompt >>> because: >> >> What's your qemu and kernel command line? I'll take look at this first >> thing tomorrow. > > I was able to reproduce this crash by just turning on KASAN... > investigating. It would still help to have your config for our own > regression testing purposes it makes sense for us to prioritize > "Dave's test config", similar to the priority of not breaking Linus' > laptop. I believe this is a bug in KASAN, or a bug in devm_memremap_pages(), depends on your point of view. At the very least it is a mismatch of assumptions. KASAN learns of hot added memory via the memory hotplug notifier. However, the devm_memremap_pages() implementation is intentionally limited to the "first half" of the memory hotplug procedure. I.e. it does just enough to setup the linear map for pfn_to_page() and initialize the "struct page" memmap, but then stops short of onlining the pages. This is why we are getting a NULL ptr deref and not a KASAN report, because KASAN has no shadow area setup for the linearly mapped pmem range. In terms of solving it we could refactor kasan_mem_notifier() so that devm_memremap_pages() can call it outside of the notifier... I'll give this a shot.