Received: by 10.192.165.148 with SMTP id m20csp723179imm; Fri, 27 Apr 2018 06:33:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqMHo1aIQOcZshGn0q8ciUTw0quj12LFmzft6i5VNLqmjFYFOfU5N7+TyKS4sMSGdhefxpp X-Received: by 2002:a17:902:1347:: with SMTP id r7-v6mr2334132ple.62.1524836009898; Fri, 27 Apr 2018 06:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524836009; cv=none; d=google.com; s=arc-20160816; b=FZHWrvbxuqtsBUPVUyEiroMub8u9DRHJuVD6IuAKVK+CVSsdh2EKNRll+Xc+YCdhG3 PfYz/H4SWBQhaNzYUtzOaiF7jiVedpBYDVDlJW4pZmpqPtqZ77uEH3jNqu0sKIiY1202 IloWMRBpZFxQdB15Nf47Xq8+nXZcXacpHKYaPUfwIQ6qbr13Nnn6QTKf0ons4jZscSl9 Tg5/gK5EUlpEfbxTEGTV3rD0FgbdQ2gowpu6gtAkSSkSLwJ1YMDrrX0eHUntZoUyklMk lOgIY2GKB1HIfKB4vROzCA8WPWXkGBj0EzQfI5yjpivSCAlDOJtzeTiOeP8J8N0W76Dk EtRQ== 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:cc :to:from:date:arc-authentication-results; bh=hfkVUyzNyqq8uiucm/tGlRg0iyTydgsBfu1HrXvV7mo=; b=uWGCor8l3niTodtLEdo7gpdVD0Lv/LoY3AW5JcR1bQecwt1q0lVb4QIfcoFuLAH3+0 UZQqfNVhdo5B0Z1fp7E1tart7Rd6m/1l7kztirlVuuZ3focTaYu11RitnGLWPrMRwpe7 DUAX4sk/IJelwb6hHvKBsONFqI5DjlF4VWftn/021FHahtKQP6TcztiK7neHWfPrwKHF H4/PtliFsv3E8B/e+f21aBtzGJizuH2CAnN6/hgcmzC1rzPbyYf1je+1mF6f8jyl8Opp J5DS6ue8T6HZYWZ6HviUZ5N7aiB8ZjO5BskqL2Ke1/VIZ4IqYY5E1JMt6DpPvICYN1z/ Ty/w== 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 p8-v6si1257047plk.441.2018.04.27.06.33.14; Fri, 27 Apr 2018 06:33:29 -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 S1758381AbeD0NcI (ORCPT + 99 others); Fri, 27 Apr 2018 09:32:08 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758277AbeD0NcH (ORCPT ); Fri, 27 Apr 2018 09:32:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 678E04015A4B; Fri, 27 Apr 2018 13:32:06 +0000 (UTC) Received: from localhost (unknown [10.36.118.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85789AB3F7; Fri, 27 Apr 2018 13:31:47 +0000 (UTC) Date: Fri, 27 Apr 2018 14:31:46 +0100 From: Stefan Hajnoczi To: Pankaj Gupta Cc: Stefan Hajnoczi , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, qemu-devel@nongnu.org, linux-nvdimm@ml01.01.org, linux-mm@kvack.org, kwolf@redhat.com, haozhong zhang , jack@suse.cz, xiaoguangrong eric , riel@surriel.com, niteshnarayanlal@hotmail.com, david@redhat.com, ross zwisler , lcapitulino@redhat.com, hch@infradead.org, mst@redhat.com, imammedo@redhat.com, marcel@redhat.com, pbonzini@redhat.com, dan j williams , nilal@redhat.com Subject: Re: [Qemu-devel] [RFC v2 1/2] virtio: add pmem driver Message-ID: <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZoaI/ZTpAVc4A5k6" Content-Disposition: inline In-Reply-To: <197910974.22984070.1524757499459.JavaMail.zimbra@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 27 Apr 2018 13:32:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 27 Apr 2018 13:32:06 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ZoaI/ZTpAVc4A5k6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 26, 2018 at 11:44:59AM -0400, Pankaj Gupta wrote: > > > + int err; > > > + > > > + sg_init_one(&sg, buf, sizeof(buf)); > > > + > > > + err =3D 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); > >=20 > > 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. >=20 > I thought about it to some extent, and wanted to go ahead with simple ver= sion first: >=20 > - I think file 'inode -> locking' sill is there for request on single fil= e. > - 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.=20 > We just want most recent flush to assure guest writes are synced proper= ly. >=20 > Important point here: We are doing entire block fsync for guest virtual d= isk. I don't understand your answer. Is locking necessary or not? =46rom the virtqueue_add_outbuf() documentation: * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted). Stefan --ZoaI/ZTpAVc4A5k6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJa4yZCAAoJEJykq7OBq3PIfAEH/3CKVcVGxsuzmV7lgfXlV3nb 96loKX3VPv78+trdSImeDZ+PYUzATi5humWaCgcbM/QHrpDhsmKxh/Cu+a2ynVeI 5QQ2E2tvlqBC7MO2NTy1Qty2UEPy3p5x7Qqz/SsCs4k1j6c2i0eBTC4LxJNmtgQI Ipy0wz76skwaGeo3yrcRGha8CxbHZDQQIELuvroOo9RMifqUWyY66s7VGHA9CDLd /URZJGr4qS4RlK1Xk2fyFQWLZTijCEcWvZGSP9rWcuZtWzTHeOEm7SjY3jZghlbg CLKTy6+fxRirY8yEsQKI9rpfGUNTJ0ny/vvg8nsSPXtz0EmmRd85aDOtY+5Cb4E= =fxXv -----END PGP SIGNATURE----- --ZoaI/ZTpAVc4A5k6--