Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3491967ybi; Tue, 2 Jul 2019 08:39:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx93TdggJlXw0QWqoGdXPtScUE1BrK+slc8v8EOqBRbnHid31H3oKkeX+p+66I8BiuE2+gK X-Received: by 2002:a63:224a:: with SMTP id t10mr31191462pgm.289.1562081949545; Tue, 02 Jul 2019 08:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562081949; cv=none; d=google.com; s=arc-20160816; b=hK9pJwewjIOSyJkFkqGBnATynog2yTjd5zu8UTtAD+CKBa7XHkdf4gybu//cT97pgd iia58edFITaZ7Jz+navj53onG3oU+QWqHhSvZOETRa9aMtPV3ecKxSxD+q3YgeMcRevV pOUfxTdD4rJoL/V4xmyh7AqBR4tb4nufGuly5F8dc8QxFggBoiHpO67Mh7gmhfeVKFBi 5QEhrW8C9krPGLy84kyevVIltR2xpXHvIfxHanHk5b4DtkkQCIi6+DHMsLWPRKPinvMV 5G8oKvxWegdkR4irYfWalvkZ9410Vx/wXbXE6yIb3nizEwrpYZbF/DpDiX8hAsOqOuLR qE5A== 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 :in-reply-to:references:mime-version:dkim-signature; bh=ATmVU16yayuH858JtpQ8da12QUT0HIEkBZC0SnOh7VQ=; b=OdgWqMhWobqpua6ZrsxkKaB6O0oQPtTf4Ipur5kwZ7TAE92bf9UXK53/tuH7nTy724 mdpwzcePhoODuPG0zS1UOwxp3JKhJy7PQm/hfi+pve8qsbKORTuBPNoQREErjLYb8deJ pTPKcBtiOzP7tPJAff9ZT4GNynWYeid0OrUM3kCkUbmhuqch7xMZVzEC9ApIJpeweSzq ENQdCJX0wzlgw23KNU0yfWM9NSmE2hYRDpA2bhqgDHW/1w+tLLo/wy9aj9hyVu7R+t7c MpNctv0WsK5vOy/93/PP8XsbERWcpJGJjmdwzDz6oqIzdPMICHdVMNP2lkNTKBknQ/eh XKiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=lWkCRmDV; 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 f17si2398159pjq.18.2019.07.02.08.38.53; Tue, 02 Jul 2019 08:39:09 -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=lWkCRmDV; 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 S1726930AbfGBPiE (ORCPT + 99 others); Tue, 2 Jul 2019 11:38:04 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:44495 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbfGBPiE (ORCPT ); Tue, 2 Jul 2019 11:38:04 -0400 Received: by mail-oi1-f193.google.com with SMTP id e189so13353958oib.11 for ; Tue, 02 Jul 2019 08:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ATmVU16yayuH858JtpQ8da12QUT0HIEkBZC0SnOh7VQ=; b=lWkCRmDV2TTrVlfmg/FthFEquAfSnTCno0dxpAMUwrCCGDKTnkTRoXST11SO8f7+Tj uLeH3pNIUdwbwIKw9S2b2u9/5GT+4Cd/DQWVJu00PiNqkIqKZT3dG3HSbfE+lOZH996I trzHcR8MBfHQF8/mw7CdCjBtEpjmMjDT7HHB1rhi1/vT+2K8mXSrNaoJRq28qvxBwYmB cZG8TsM5i0PbkuR8K6WNwpeWJRLEmDsvRGmSVEsZEIJpdJDZUOK7He1/4bSzSHiRpel6 HXuZMpntGPdgHNqEKJv0EbB7LUZ1Vzya7oGE+yGXGO1ybjcsDyuJoGIpg1qd7MMvN0r6 uV4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ATmVU16yayuH858JtpQ8da12QUT0HIEkBZC0SnOh7VQ=; b=WQZ4ZnijfMjCbi6+62V5kbfUTQ2NI2bgLKZROvm+zKqppYpPzZUVh3wbhrgsZyzGd9 g4NkI9xqy1DfwUc9oi5QiCH9rHZ8/xxlo8rzS/uy5RldorIHi+isek6hTEJSJieWivkn Xwg2Jb71cDtcqYVOYrfjK3Iqs0jHR7MldBNXlihzoESeIIpPwA3rXnFLstTfkS1SPnm6 xqqTfAFvGxD/J7pXcr8z4CI2vaaYD23R7AggCUg3ExwHHAArPOrDZ9zrZCG6kBtiWdeJ 2l1ZhEbb3fbUN7xVO6RxdD+egl5+rHig0J1U978lYqb62hvJWpCpRbhW1gcPK9vrhPIn uKSQ== X-Gm-Message-State: APjAAAWQ92R1PK5yWZPQkQ2WkVWMhh0q3i+9QRWD6tWeC79KIR95fMUe m85+lfxdKZog6QMaw6Ag3GeH1nwf+DZegGL9NpvB7A== X-Received: by 2002:aca:ba02:: with SMTP id k2mr3189786oif.70.1562081883341; Tue, 02 Jul 2019 08:38:03 -0700 (PDT) MIME-Version: 1.0 References: <20190627195948.GB4286@bombadil.infradead.org> <20190629160336.GB1180@bombadil.infradead.org> <20190630152324.GA15900@bombadil.infradead.org> <20190702033410.GB1729@bombadil.infradead.org> In-Reply-To: <20190702033410.GB1729@bombadil.infradead.org> From: Dan Williams Date: Tue, 2 Jul 2019 08:37:52 -0700 Message-ID: Subject: Re: [PATCH] filesystem-dax: Disable PMD support To: Matthew Wilcox Cc: Seema Pandit , linux-nvdimm , Linux Kernel Mailing List , stable , Robert Barror , linux-fsdevel , Jan Kara 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 On Mon, Jul 1, 2019 at 8:34 PM Matthew Wilcox wrote: > > On Sun, Jun 30, 2019 at 02:37:32PM -0700, Dan Williams wrote: > > On Sun, Jun 30, 2019 at 8:23 AM Matthew Wilcox wrote: > > > I think my theory was slightly mistaken, but your fix has the effect of > > > fixing the actual problem too. > > > > > > The xas->xa_index for a PMD is going to be PMD-aligned (ie a multiple of > > > 512), but xas_find_conflict() does _not_ adjust xa_index (... which I > > > really should have mentioned in the documentation). So we go to sleep > > > on the PMD-aligned index instead of the index of the PTE. Your patch > > > fixes this by using the PMD-aligned index for PTEs too. > > > > > > I'm trying to come up with a clean fix for this. Clearly we > > > shouldn't wait for a PTE entry if we're looking for a PMD entry. > > > But what should get_unlocked_entry() return if it detects that case? > > > We could have it return an error code encoded as an internal entry, > > > like grab_mapping_entry() does. Or we could have it return the _locked_ > > > PTE entry, and have callers interpret that. > > > > > > At least get_unlocked_entry() is static, but it's got quite a few callers. > > > Trying to discern which ones might ask for a PMD entry is a bit tricky. > > > So this seems like a large patch which might have bugs. > > > > > > Thoughts? > > > > ...but if it was a problem of just mismatched waitqueue's I would have > > expected it to trigger prior to commit b15cd800682f "dax: Convert page > > fault handlers to XArray". > > That commit converts grab_mapping_entry() (called by dax_iomap_pmd_fault()) > from calling get_unlocked_mapping_entry() to calling get_unlocked_entry(). > get_unlocked_mapping_entry() (eventually) called __radix_tree_lookup() > instead of dax_find_conflict(). > > > This hunk, if I'm reading it correctly, > > looks suspicious: @index in this case is coming directly from > > vm->pgoff without pmd alignment adjustment whereas after the > > conversion it's always pmd aligned from the xas->xa_index. So perhaps > > the issue is that the lock happens at pte granularity. I expect it > > would cause the old put_locked_mapping_entry() to WARN, but maybe that > > avoids the lockup and was missed in the bisect. > > I don't think that hunk is the problem. The __radix_tree_lookup() > is going to return a 'slot' which points to the canonical slot, no > matter which of the 512 indices corresponding to that slot is chosen. > So I think it's going to do essentially the same thing. Yeah, no warnings on the parent commit for the regression. I'd be inclined to do the brute force fix of not trying to get fancy with separate PTE/PMD waitqueues and then follow on with a more clever performance enhancement later. Thoughts about that?