Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1059164imm; Wed, 17 Oct 2018 12:37:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV60yr2hWL35oB+5nuDSa8nj+kMpa5VGU9EMhaUmcf9Bi8TC3ZHs4Ukjt2Weg5OGgHvuQgTHt X-Received: by 2002:a63:e347:: with SMTP id o7-v6mr26182141pgj.251.1539805061300; Wed, 17 Oct 2018 12:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539805061; cv=none; d=google.com; s=arc-20160816; b=Q9hzKl1lKcOl/hiPtHO4OWadEgDCsoPar3OJJuz78D1E8kH38Z+/+CcDdtdFLHC2sP q6kktaXofJ0Wf0FxK1R1uhUahrckYBOophrwlFjHDFgoRc8PLmMYz7JWWrW4qB6pB2R+ SDRkxganIAaNF7S80o/hqxA/wiVSC2E98qGRQLrnhJLqZczZoRZBFcppDRpbI9DfA7eY xcWX1hBYHSbytGXIiaIbRQaQ1aRXin5U0vtFFOpSQCze0UOedQGoYyjLyInhvAfPXjRq Kc5ZVOhAZj7ZlUSyTi6xh42OWBdVDCwl0GY7h+7k9L4M1k/ClqzllhzmMwLQv9YZRJa5 2yVg== 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=X5EPERwG7Rt2FJx6jlrxgsAT7CqRWmgc1U9eT9124S0=; b=grKfKVhj70jLXo4pRZOtYdQ9/enW0+XrpAT5aRULm41VJg36zUf3kwNX2EqZHKwdKH y9WvO56FfXp6r2JmhzqaN1tTnirKVt7eyYvuzHAbP9QVpzgutiTlkjQ8xkJ6rWc2TIVT 5aib9jIt2Y4GCrZVqgOGzKPCP4j+/Ji/GknHVfgGHbu3tEOYu3DPQdaw0wbe1Ptu6+wi 1fmZd1Qy9FghBgg4c4F+p+x2rXzj4dX8aqu7+OIkdOFe/3ArKwhBoyk9N+Tt6viRfTAN ZL9cfe2XftnJrj2ApGVSHDwaIhV+Dx9f5O/MKFuZw1ZOJ4B1nOuxG+qt8w/bUAxrmSHf 5B8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=0BNZ+DZd; 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 w134-v6si20785609pfd.55.2018.10.17.12.37.25; Wed, 17 Oct 2018 12:37:41 -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=0BNZ+DZd; 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 S1728344AbeJRDeO (ORCPT + 99 others); Wed, 17 Oct 2018 23:34:14 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:36752 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728129AbeJRDeN (ORCPT ); Wed, 17 Oct 2018 23:34:13 -0400 Received: by mail-ot1-f67.google.com with SMTP id x4so25998927otg.3 for ; Wed, 17 Oct 2018 12:37:02 -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=X5EPERwG7Rt2FJx6jlrxgsAT7CqRWmgc1U9eT9124S0=; b=0BNZ+DZdn3Sfab3DPt4S44cQaaXv5eKcABUuMKFJ44wtAAYHjQk0/kSOed0d3Y7SJk CxbLndA1ROAnvg4wOs1k1nBnCSzkQxHVXAnum4HYB62oOno1Mbtn50cR5E/ofIrvtU3L NE2d+PwcjFGH72doPWBL5R7V3kNeX1qZ/edFw003FNmFXN6lFKrdh7lVyKtHUgDVTq/Z D7FDdz9LBGDvaeq9afZK1cBkepzciBHBuLhzz37q199DfHigYWnriT/KoG/0wtRfx19k GRr5cTW1VgBn9NUkGA5cbOLGNQhHMrWPH9Jj5brUq5hBJ2PUoMPJCONcRr/TH8C9Uimf 7Cjw== 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=X5EPERwG7Rt2FJx6jlrxgsAT7CqRWmgc1U9eT9124S0=; b=AOiL32WlfXEFUJJGdPgsDNo0+Cl8FA/17UgbQ4iXND8nOi5kIVPk85On2bkJ0wqebh hOtyiu230t7JyIRM63VjpGlgxQsdf7sOR7LyNr6A7g3AlR4sC4n6TDuqf0hiWxBohprq ISuypGapNhlH84wMn46b9Yr/I2cQEGRFPoe9o+G9Z4YDd0tddUXx+/VD/Nz0NBEEw4Wc r663OFYjM65NQeJt/DyOzY9NxZJLj/sbd50M2oKgljYOegwV1XT0aaBP1xqraF02lhQr CZiIbkbJlHYRhxmmi46ZIERdUq1DHeFE8T8Q10lv3NK3aSmTDrfxvZK5wm4fCtWecYZ5 QKtA== X-Gm-Message-State: ABuFfoi/oIBxcLLOodVLkLWihQbmdtPTj0wE4bgYm7NExWSSN6UaMcQ0 cRShJe+Zrp1x0fqjsF3g/GaZKaIAWHYIW+s+nffTWw== X-Received: by 2002:a9d:4d0a:: with SMTP id n10mr16341195otf.95.1539805022185; Wed, 17 Oct 2018 12:37:02 -0700 (PDT) MIME-Version: 1.0 References: <20181013050021.11962-1-pagupta@redhat.com> <20181013050021.11962-3-pagupta@redhat.com> <431127218.21694133.1539803509205.JavaMail.zimbra@redhat.com> In-Reply-To: <431127218.21694133.1539803509205.JavaMail.zimbra@redhat.com> From: Dan Williams Date: Wed, 17 Oct 2018 12:36:51 -0700 Message-ID: Subject: Re: [Qemu-devel] [PATCH v2 2/2] virtio-pmem: Add virtio pmem driver To: Pankaj Gupta Cc: Kevin Wolf , Jan Kara , Xiao Guangrong , KVM list , Rik van Riel , linux-nvdimm , David Hildenbrand , Linux Kernel Mailing List , Dave Jiang , Qemu Developers , Christoph Hellwig , Vishal L Verma , Igor Mammedov , "Michael S. Tsirkin" , Stefan Hajnoczi , zwisler@kernel.org, lcapitulino@redhat.com, Paolo Bonzini , Nitesh Narayan Lal 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 Wed, Oct 17, 2018 at 12:11 PM Pankaj Gupta wrote: > > > > > On Fri, Oct 12, 2018 at 10:01 PM Pankaj Gupta wrote: > > > > > > This patch adds virtio-pmem driver for KVM guest. > > > > > > Guest reads the persistent memory range information from > > > Qemu over VIRTIO and registers it on nvdimm_bus. It also > > > creates a nd_region object with the persistent memory > > > range information so that existing 'nvdimm/pmem' driver > > > can reserve this into system memory map. This way > > > 'virtio-pmem' driver uses existing functionality of pmem > > > driver to register persistent memory compatible for DAX > > > capable filesystems. > > > > > > This also provides function to perform guest flush over > > > VIRTIO from 'pmem' driver when userspace performs flush > > > on DAX memory range. > > > > Before we can move forward with this driver we need additional > > filesystem enabling to detect when the backing device is fronting DAX > > pmem or a paravirtualized page cache through virtio-pmem. Any > > interface that requires fsync() and a round trip to the hypervisor to > > flush host page cache is not DAX. > > I saw your proposal[1] for new mmap flag MAP_DIRECT. IIUIC mapping should fail for > MAP_DIRECT if it requires explicit flush or buffer indirection. So, if we disable > MAP_SYNC flag for virtio-pmem this should fail MAP_DIRECT as well? Otherwise > without MAP_DIRECT, virtio-pmem should be defaulted to VIRTIO flush mechanism. Right, although I wouldn't worry about MAP_DIRECT in the short term since we're still discussing what the upstream interface. Regardless of whether MAP_DIRECT is specified or not the virtio-flush mechanism would always be used for virtio-pmem. I.e. there is no possibility to get full DAX operation with virtio-pmem, only the page-cache bypass sub-set. Taking a look at where we could inject this check for filesystems it's a bit awkward to do it in xfs_file_mmap() for example because we do not have the backing device for the extents of the inode. So at a minimum you would need to investigate calling xfs_inode_supports_dax() from that path and teaching it about a new dax_device flag. I'm thinking the dax_device flag should be called DAXDEV_BUFFERED to indicate the presence of software buffering on a device that otherwise supports bypassing the local page cache.