Received: by 10.192.165.148 with SMTP id m20csp1707330imm; Sat, 28 Apr 2018 03:52:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoKyWDCjP9vvYF6qpWLTgBCDA8QN+cb3SS0CRt1fZV0+lRL/N9dyDGxv5NoFPqQ9dR70j1I X-Received: by 2002:a17:902:9344:: with SMTP id g4-v6mr5668899plp.10.1524912758733; Sat, 28 Apr 2018 03:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524912758; cv=none; d=google.com; s=arc-20160816; b=BvM6Oht9mNxYNIvsq2Lbaki8aY+TiLALGWJC8f0tOluKZfWf6bujlazk6mpyHujOk6 IQytvlpu4uNf6YrzwTH/0aEAOFigx6Wg/MTmJw7tlA3+SOlt6Yox+la3ljW3Wp/FvWze YOWnmjW70s6ONED+UxYIlagRd44y0CPz2MrPS5tZIRLNaM+eKtPUf7HIjzglqS8qRH/e 1PuPRkKblFFXVf7ZbmxWXtnlsHcV4OD6OC8zvozWVEKFMqvA9fC4OJ9p5voV+ap8sANt DCL2O5Um+6kwAsGOjEsEZuTM8qNyVPzsY9iUIgoXIt+GuTMsSiq3aHnicafwtd5erCV2 ZXow== 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=co5TQwLGuGn2zbuExFMpn8Wt6nDh6R76w0sY79ZjFPU=; b=EY/1HGDv/5Rd/HQWEZPLM8SYtTxj6BoPsWLzWKYjN02q9D1JkARER2tgFvNt+YfD6x vjsncT7Yigvzvh0Z9W/yOQ/xRCbG2IppCr2qJEdpW9ys8T+Gpmf100k33CUsLNAzlIRk ZyLTGohah3pd/4W57AeFdRhivhYnK6FP1cVjidUZJN+ohpmbYmCdvAfdu5fTmS5G+jaq rUaJcZ+51qadsYafDaGk+O/jAg7rDuFTjmkaJX7tN8uRCCKP/x2gu35jRbqaXVvIS5kF ec+TNWHwAppLwcDpA+xwAoHEUrVS2dpMMzLyiJl5xga3p5Mk9F8YOBqKsjotXKJL9MDR 5Y1A== 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 f7-v6si3295626plb.285.2018.04.28.03.51.50; Sat, 28 Apr 2018 03:52:38 -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 S1759844AbeD1Kso (ORCPT + 99 others); Sat, 28 Apr 2018 06:48:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759651AbeD1Ksm (ORCPT ); Sat, 28 Apr 2018 06:48:42 -0400 Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7470930FA048; Sat, 28 Apr 2018 10:48:42 +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 3905E1C05A; Sat, 28 Apr 2018 10:48:42 +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 97289180596F; Sat, 28 Apr 2018 10:48:41 +0000 (UTC) Date: Sat, 28 Apr 2018 06:48:41 -0400 (EDT) From: Pankaj Gupta To: Stefan Hajnoczi Cc: jack@suse.cz, kvm@vger.kernel.org, david@redhat.com, linux-nvdimm@ml01.01.org, ross zwisler , qemu-devel@nongnu.org, lcapitulino@redhat.com, linux-mm@kvack.org, niteshnarayanlal@hotmail.com, mst@redhat.com, hch@infradead.org, Stefan Hajnoczi , marcel@redhat.com, nilal@redhat.com, haozhong zhang , riel@surriel.com, pbonzini@redhat.com, dan j williams , kwolf@redhat.com, xiaoguangrong eric , linux-kernel@vger.kernel.org, imammedo@redhat.com Message-ID: <1266554822.23475618.1524912521209.JavaMail.zimbra@redhat.com> In-Reply-To: <20180427133146.GB11150@stefanha-x1.localdomain> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-2-pagupta@redhat.com> <20180426131236.GA30991@stefanha-x1.localdomain> <197910974.22984070.1524757499459.JavaMail.zimbra@redhat.com> <20180427133146.GB11150@stefanha-x1.localdomain> Subject: Re: [Qemu-devel] [RFC v2 1/2] virtio: add pmem driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.38, 10.4.195.28] Thread-Topic: virtio: add pmem driver Thread-Index: yfnsc35dwFGDNzCGklJwWeo1J1CSKA== X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sat, 28 Apr 2018 10:48:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > + int err; > > > > + > > > > + sg_init_one(&sg, buf, sizeof(buf)); > > > > + > > > > + err = virtqueue_add_outbuf(vpmem->req_vq, &sg, 1, buf, GFP_KERNEL); > > > > + > > > > + if (err) { > > > > + dev_err(&vdev->dev, "failed to send command to virtio pmem > > > > device\n"); > > > > + return; > > > > + } > > > > + > > > > + virtqueue_kick(vpmem->req_vq); > > > > > > Is any locking necessary? Two CPUs must not invoke virtio_pmem_flush() > > > at the same time. Not sure if anything guarantees this, maybe you're > > > relying on libnvdimm but I haven't checked. > > > > I thought about it to some extent, and wanted to go ahead with simple > > version first: > > > > - I think file 'inode -> locking' sill is there for request on single file. > > - For multiple files, our aim is to just flush the backend block image. > > - Even there is collision for virt queue read/write entry it should just > > trigger a Qemu fsync. > > We just want most recent flush to assure guest writes are synced > > properly. > > > > Important point here: We are doing entire block fsync for guest virtual > > disk. > > I don't understand your answer. Is locking necessary or not? It will be required with other changes. > > From the virtqueue_add_outbuf() documentation: > > * Caller must ensure we don't call this with other virtqueue operations > * at the same time (except where noted). Yes, I also saw it. But thought if can avoid it with current functionality. :) Thanks, Pankaj