Received: by 10.192.165.148 with SMTP id m20csp770903imm; Wed, 25 Apr 2018 07:26:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZonfBq1OkrK16dJRZd5If5D3YrX67HfRFxWrwyjCPVIJsCWMaWfhiIuGCXJxjn5+PlS5hfv X-Received: by 2002:a17:902:aa03:: with SMTP id be3-v6mr8538102plb.215.1524666399651; Wed, 25 Apr 2018 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524666399; cv=none; d=google.com; s=arc-20160816; b=fJ9q+AN4Ul/BcuWX+1qGomy955gcUlLPiErViYpWCyUnA3qcQp6OVXZcvikLXuT8Fl SGU7KOjQeGoXyT989tunAOL0ZQt0+0zQTf7GN/GfgDL31p9KOflTRsqdD4sZaAJJTuGv YlfKAhkiuYn9uUsHbgmlu+vwXA1rhYkWzUTWs8Jx9LLZT4CLfJHUbkRhWSK9G72cz8Ov t5V2xL9Y+10Io5PyISkohqeFnc6okBAbMpV90QKf/xSS0aaZLBm49iRIrzLCrS+HQYZQ QqvqHidXmPUfZNYwYtS262ybP0360Of232ny09v78i6sFK4q7tqAidP36iZ92oCN34dZ xWMQ== 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=RpqMHxogp2OjGhvlivHx0lkv7E5fSmPHXf+J3GrZcPQ=; b=gkDXBopwfAnDN4yzsqrtnD9+QF2tqAuIppNfp9FzoGdvNc9wRW6esSTIiLy12YsH4s zYw5nrFH6a+pgVxOC2Omigm5gF1pJ8chBJJ4F6q71Ccii0kiEmRVYzyJhGoIDN9O8oNu AAhAWd8htT/WnbPcnuE5TGjmhMTeP1oFOvkbvFeHJ9UiT+LJo8torIyKe1OwafoicyHk uwYmg3fmMhjwOGtkXXW2Gsvcp6baJTdO4D2UCI/4SxLvxeE3IFAvUwqOeIIEhloSkp0J sHK73uOFZcKSj6h4/0IM1iitoHKdcomASRNykzLWHlmVfNFIAQlPxc+EqLmQxAZKWAO+ ZiWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=p/XTM3Gs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ba2-v6si16488589plb.110.2018.04.25.07.26.24; Wed, 25 Apr 2018 07:26: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=p/XTM3Gs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754618AbeDYOX4 (ORCPT + 99 others); Wed, 25 Apr 2018 10:23:56 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:36300 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754131AbeDYOXy (ORCPT ); Wed, 25 Apr 2018 10:23:54 -0400 Received: by mail-oi0-f68.google.com with SMTP id v2-v6so7253245oif.3 for ; Wed, 25 Apr 2018 07:23:54 -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=RpqMHxogp2OjGhvlivHx0lkv7E5fSmPHXf+J3GrZcPQ=; b=p/XTM3Gs8J4TzazSiSoI0GK/e9JWap7hvACrZ/YuA1ZbuSxPrb3nQppP5HLu+mRIBA juOHxP49aVm8+E2ofzet7slvK1LncGuAlk2w0Wy7OozZ8uxM2lmvknB9lJ4mZFzxKJCo RNDEH5aVOpaBSlBBqa4cI6pYAVoMaF2itwZ7wXkmWuLWmQBNGhc1dI8YybBXEyIHEX7l L9kFei007XcCXU6gbBaG2AcItJW20uBxgdJ4PlKf74ixp8HBRwSf93CLFUuBHRTWi46+ yJdexTm0SdKVTpVJyTA54RzZQ0PGAI3GcOCDPDyPNSfipMGDIjEuWGRSdh6RgNYVcG6M d8jw== 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=RpqMHxogp2OjGhvlivHx0lkv7E5fSmPHXf+J3GrZcPQ=; b=avTydRhtPmcohQb9O/HqLGcs0dS2dgTXN3i9n5i21VbHGodzC9bx99l1hiDyjA4CJk pTGXd6ZlvVHxrEXC4gfTKqNFHNzOihXyUPm/2Blus2BE48LcQcTCp9N5HZzjFlQX7lmn dNBlX+XZrKwMDk1t2CEGiR+jVLAVomv9S7XvCkY+Tm7u6yAwof5WFUoSU+lR35YUQzk5 F4/R9B+Srex3vnbAmxvqzsroipEdM2B+kmjepAHm1QKwzOZQlDGeJHBJcwcPV223KUUy Nm0sRfBt1UuX0hvKm5EWNafpdeDlURZnCELodtJ5a2Y9YNgm+gJ4Qjanfi7NhED9wlb/ vRIg== X-Gm-Message-State: ALQs6tDCpQnleB0lkgJ0mQ3kW6o8wWR7OERyiZ7QqJBfCPHqSE+X2YgL eAU0MSP6+XNs+DmzuWiZTVzPviOPV+TalQf24agC4g== X-Received: by 2002:aca:ab46:: with SMTP id u67-v6mr17844638oie.272.1524666233877; Wed, 25 Apr 2018 07:23:53 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2d36:0:0:0:0:0 with HTTP; Wed, 25 Apr 2018 07:23:53 -0700 (PDT) In-Reply-To: <20180425112415.12327-3-pagupta@redhat.com> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-3-pagupta@redhat.com> From: Dan Williams Date: Wed, 25 Apr 2018 07:23:53 -0700 Message-ID: Subject: Re: [RFC v2 2/2] pmem: device flush over VIRTIO To: Pankaj Gupta Cc: Linux Kernel Mailing List , KVM list , Qemu Developers , linux-nvdimm , Linux MM , Jan Kara , Stefan Hajnoczi , Rik van Riel , Haozhong Zhang , Nitesh Narayan Lal , Kevin Wolf , Paolo Bonzini , "Zwisler, Ross" , David Hildenbrand , Xiao Guangrong , Christoph Hellwig , Marcel Apfelbaum , "Michael S. Tsirkin" , niteshnarayanlal@hotmail.com, Igor Mammedov , lcapitulino@redhat.com 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, Apr 25, 2018 at 4:24 AM, 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; > + } > + I'd rather introduce a ->flush() operation hanging off of 'struct nd_region' so that this multiplexing can be a static setting.