Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp284797imm; Mon, 4 Jun 2018 17:47:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJPBSamnd4sjm3pDtYq79oqu4D2L7ByBc/Z9Y7rDbQrv4WQZGXraa3jqaRUDiUoPaKXPhss X-Received: by 2002:a63:7d51:: with SMTP id m17-v6mr18857840pgn.245.1528159632256; Mon, 04 Jun 2018 17:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528159632; cv=none; d=google.com; s=arc-20160816; b=wmEi204i8aX/iWiTs+J4ySvSvVt5XYDSPfhFTzZtw7w0Yn3sCBfcKKNu/u7D65hSsc N6CjORJHpbgkHcZSJlyIJR3/tPfUWrHhN8pIWX5sGJB58WLDLp6pGefzGR61jHFSGfZ8 gYnfu9A0b8gQcwhjQGG3/Qep4PYsp1meaFEv11u8KtfdtKtoLSy11wazNfz/iE9KW6wF owC5sRXpDqACqs2yi+HpA4X7/kM3/xSwgKgVFad/1o1PbT/Y4wJBMufsliRfsCgLjXDZ I5KgP+W7IvPmdWvSJD6fIxkfVZSwzuzMPbpFloAwWeybmWkR8zTE/1jY985eYX+eOBlh SdVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:arc-authentication-results; bh=C3pcBGhcD5W6CdYeFKUy6F9PWWjJPonSmDybqToDGNE=; b=gvgWrMAGJX8tzv2aAJCKMVf2pnqVmot8N1NN2brQ2ylcgtbCz513UjnsGesNgS2psz pte345eoAUjoCAZiHz5FCfv3KznaIsVPBqEGQFDd+9Oi+8A5EINcFpVtZRAZzWnexjh4 V+MocIKtIU7Sio2pemXvi7B1TJUKGIjCUK44zBUQAsKGhD5/9oXAXMSMh+mN8uHy/8+b ZpYfp4vh+EyaQoCK30Qx6FYmkQ2BCblQvKMUQR8WorrpiuQ2GRmpVtoGIAq2pm8yDRXb zGA7G40j22EA9eL+L8FVawBELhac5IzdBLFSsJywIA6DaYPvJeTX6wurR2oASsI5WN35 ulTg== ARC-Authentication-Results: i=1; mx.google.com; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d11-v6si24411475pll.255.2018.06.04.17.46.57; Mon, 04 Jun 2018 17:47:12 -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; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751368AbeFEAqa (ORCPT + 99 others); Mon, 4 Jun 2018 20:46:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53884 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751046AbeFEAq3 (ORCPT ); Mon, 4 Jun 2018 20:46:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B2C36BB42C; Tue, 5 Jun 2018 00:46:28 +0000 (UTC) Received: from localhost (unknown [10.18.25.149]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CA18205D521; Tue, 5 Jun 2018 00:46:28 +0000 (UTC) Date: Mon, 4 Jun 2018 20:46:28 -0400 From: Mike Snitzer To: Ross Zwisler , Toshi Kani , dm-devel@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH v2 5/7] dm: remove DM_TYPE_DAX_BIO_BASED dm_queue_mode Message-ID: <20180605004558.GB6898@redhat.com> References: <20180529195106.14268-1-ross.zwisler@linux.intel.com> <20180529195106.14268-6-ross.zwisler@linux.intel.com> <20180601220443.GB18712@redhat.com> <20180604232416.GB10666@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180604232416.GB10666@linux.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 05 Jun 2018 00:46:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 05 Jun 2018 00:46:28 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'msnitzer@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 04 2018 at 7:24pm -0400, Ross Zwisler wrote: > On Fri, Jun 01, 2018 at 06:04:43PM -0400, Mike Snitzer wrote: > > On Tue, May 29 2018 at 3:51pm -0400, > > Ross Zwisler wrote: > > > > > The DM_TYPE_DAX_BIO_BASED dm_queue_mode was introduced to prevent DM > > > devices that could possibly support DAX from transitioning into DM devices > > > that cannot support DAX. > > > > > > For example, the following transition will currently fail: > > > > > > dm-linear: [fsdax pmem][fsdax pmem] => [fsdax pmem][fsdax raw] > > > DM_TYPE_DAX_BIO_BASED DM_TYPE_BIO_BASED > > > > > > but these will both succeed: > > > > > > dm-linear: [fsdax pmem][brd ramdisk] => [fsdax pmem][fsdax raw] > > > DM_TYPE_DAX_BIO_BASED DM_TYPE_BIO_BASED > > > > > > > I fail to see how this succeeds given > > drivers/md/dm-ioctl.c:is_valid_type() only allows transitions from: > > > > DM_TYPE_BIO_BASED => DM_TYPE_DAX_BIO_BASED > > Right, sorry, that was a typo. What I meant was: > > > For example, the following transition will currently fail: > > > > dm-linear: [fsdax pmem][fsdax pmem] => [fsdax pmem][fsdax raw] > > DM_TYPE_DAX_BIO_BASED DM_TYPE_BIO_BASED > > > > but these will both succeed: > > > > dm-linear: [fsdax pmem][brd ramdisk] => [fsdax pmem][fsdax raw] > > DM_TYPE_BIO_BASED DM_TYPE_BIO_BASED > > > > dm-linear: [fsdax pmem][fsdax raw] => [fsdax pmem][fsdax pmem] > > DM_TYPE_BIO_BASED DM_TYPE_DAX_BIO_BASED > > So we allow 2 of the 3 transitions, but the reason that we disallow the third > isn't fully clear to me. > > > > dm-linear: [fsdax pmem][fsdax raw] => [fsdax pmem][fsdax pmem] > > > DM_TYPE_BIO_BASED DM_TYPE_DAX_BIO_BASED > > > > > > This seems arbitrary, as really the choice on whether to use DAX happens at > > > filesystem mount time. There's no guarantee that the in the first case > > > (double fsdax pmem) we were using the dax mount option with our file > > > system. > > > > > > Instead, get rid of DM_TYPE_DAX_BIO_BASED and all the special casing around > > > it, and instead make the request queue's QUEUE_FLAG_DAX be our one source > > > of truth. If this is set, we can use DAX, and if not, not. We keep this > > > up to date in table_load() as the table changes. As with regular block > > > devices the filesystem will then know at mount time whether DAX is a > > > supported mount option or not. > > > > If you don't think you need this specialization that is fine.. but DM > > devices supporting suspending (as part of table reloads) so is there any > > risk that there will be inflight IO (say if someone did 'dmsetup suspend > > --noflush').. and then upon reload the device type changed out from > > under us.. anyway, I don't have all the PMEM DAX stuff paged back into > > my head yet. > > > > But this just seems like we really shouldn't be allowing the > > transition from what was DM_TYPE_DAX_BIO_BASED back to DM_TYPE_BIO_BASED > > I admit I don't fully understand all the ways that DM supports suspending and > resuming devices. Is there actually a case where we can change out the DM > devices while I/O is running, and somehow end up trying to issue a DAX I/O to > a device that doesn't support DAX? Yes, provided root permissions, it's very easy to dmsetup suspend/load/resume to replace any portion of the DM device's logical address space to map to an entirely different DM target (with a different backing store). It's pretty intrusive to do such things, but easily done and powerful. Mike