Received: by 10.192.165.148 with SMTP id m20csp2360360imm; Thu, 26 Apr 2018 09:42:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/TokXdOmI9nnXUIuDrLxv4Y+LsIcH1WMlEAUfgN3aiVNsEShdsoUl7eafqqV/8alU8GMWP X-Received: by 10.99.111.201 with SMTP id k192mr28292495pgc.143.1524760935445; Thu, 26 Apr 2018 09:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524760935; cv=none; d=google.com; s=arc-20160816; b=TMzSmyPoVEF+CtnX7xbtj8g8nh27KakexprtSz0YmcEKiwsVUFQEEF2vsraOCbWaAi rb1wbpO97pzYGxz8cr/QVDvjybO96Th0b7j59pdLE5N9ci1QPoMOn321JAfdZFq10Bf/ cqwsMXoI0hhaF928gbSTzB5T18xml/WYjfUxk6vq9gmNHwSAPMs/cIXIOG291g52gGcW HSimnQged0CQ1MLMAyJosD4oNN4I+FGbHqB2PcEld/W8pzPQ7RrxiuOShxcX146/lKca 1hFpp9CShJ/lBjqDk0EM5OIJwlLE3LNfZUrDbc/VB8qh/0+GO5lfqD7YtKGvUIWEQdED U2YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:arc-authentication-results; bh=AEtx1ZuIGumNVg4yvYQW7cadJFZWnFCpfDIGsjJDJ6M=; b=hGOU9vgBPEDkvkt4jEx+hOl7sbnz+Q3DVJ38BVl0fSSN61BDVZ3uueICRDSUNkuswo DZxe8Z+oIdreg9arKsA/ul56oKvuKJFOcj1EtvBtEQ1uYDglHIOZpbZYH9ypO+C85bNM y2GGrsX706s4VTZL8E/pekQZtTRIlaZ/dZwpuRlCJDLujakiuPGSsOfsPdM+QE403Cxb pCKF/mfpHF/fb2MaCRLaRtxy/jSxVKhC+5VAYeuL9UBjeCIG0N4Q4KcGWsbvcnh3Fq1h dWS9A99nKjCUPEGtUgBDuYByvMdUK0Ra+6v9g0fJ32gWOZ0MF+2BxnJwbNbLEsIBgc4V ClBw== 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 u193si11419034pgc.186.2018.04.26.09.42.00; Thu, 26 Apr 2018 09:42:15 -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 S1756605AbeDZQk4 (ORCPT + 99 others); Thu, 26 Apr 2018 12:40:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754462AbeDZQky (ORCPT ); Thu, 26 Apr 2018 12:40:54 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4E2683003A34; Thu, 26 Apr 2018 16:40:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 237F0611A9; Thu, 26 Apr 2018 16:40:54 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8C4B4180215F; Thu, 26 Apr 2018 16:40:53 +0000 (UTC) Date: Thu, 26 Apr 2018 12:40:53 -0400 (EDT) From: Pankaj Gupta To: Stefan Hajnoczi Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, qemu-devel@nongnu.org, linux-nvdimm@ml01.01.org, linux-mm@kvack.org, jack@suse.cz, stefanha@redhat.com, dan j williams , riel@surriel.com, haozhong zhang , nilal@redhat.com, kwolf@redhat.com, pbonzini@redhat.com, ross zwisler , david@redhat.com, xiaoguangrong eric , hch@infradead.org, marcel@redhat.com, mst@redhat.com, niteshnarayanlal@hotmail.com, imammedo@redhat.com, lcapitulino@redhat.com Message-ID: <58645254.23011245.1524760853269.JavaMail.zimbra@redhat.com> In-Reply-To: <20180426131517.GB30991@stefanha-x1.localdomain> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-3-pagupta@redhat.com> <20180426131517.GB30991@stefanha-x1.localdomain> Subject: Re: [RFC v2 2/2] pmem: device flush over VIRTIO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.119, 10.4.195.10] Thread-Topic: pmem: device flush over VIRTIO Thread-Index: LQYKnvVqMrEPJ59FVtpvxGsK/zFRrw== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 26 Apr 2018 16:40:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > On Wed, Apr 25, 2018 at 04:54:14PM +0530, Pankaj Gupta wrote: > > This patch adds functionality to perform > > flush from guest to hosy over VIRTIO > > when 'ND_REGION_VIRTIO'flag is set on > > nd_negion. Flag is set by 'virtio-pmem' > > driver. > > > > Signed-off-by: Pankaj Gupta > > --- > > drivers/nvdimm/region_devs.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c > > index a612be6..6c6454e 100644 > > --- a/drivers/nvdimm/region_devs.c > > +++ b/drivers/nvdimm/region_devs.c > > @@ -20,6 +20,7 @@ > > #include > > #include "nd-core.h" > > #include "nd.h" > > +#include > > > > /* > > * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is > > @@ -1074,6 +1075,12 @@ void nvdimm_flush(struct nd_region *nd_region) > > struct nd_region_data *ndrd = dev_get_drvdata(&nd_region->dev); > > int i, idx; > > > > + /* call PV device flush */ > > + if (test_bit(ND_REGION_VIRTIO, &nd_region->flags)) { > > + virtio_pmem_flush(&nd_region->dev); > > + return; > > + } > > How does libnvdimm know when flush has completed? > > Callers expect the flush to be finished when nvdimm_flush() returns but > the virtio driver has only queued the request, it hasn't waited for > completion! I tried to implement what nvdimm does right now. It just writes to flush hint address to make sure data persists. I just did not want to block guest write requests till host side fsync completes. Operations(write/fsync) on same file would be blocking at guest side and wait time could be worse for operations on different guest files because all these operations would happen ultimately on same file at host. I think with current way, we can achieve an asynchronous queuing mechanism on cost of not 100% sure when fsync would complete but it is assured it will happen. Also, its entire block flush. I am open for suggestions here, this is my current thought and implementation. Thanks, Pankaj