Received: by 10.192.165.148 with SMTP id m20csp2363361imm; Thu, 26 Apr 2018 09:45:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx48mC0tfxDRHEj1hsDC0WYdL6F5Yttm1hK92ZY9D5D8UNXxhGCDIZIFLM+wefd77rBTmYl9C X-Received: by 10.101.66.139 with SMTP id j11mr27934397pgp.370.1524761103335; Thu, 26 Apr 2018 09:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524761103; cv=none; d=google.com; s=arc-20160816; b=ElyDdLW1Dh9wLMR5leUuM9IKp77M/VLExugZGgAiWr/6wvwQDYBqaYROOygomcWv+H OuYK8bpGnKrnH7hVt44IQuikVZjyKtyzKPUvzRJPNLV2K/nQBQOB0zFWLPXhA0lPRHGV 6Nt2AKUf34rP0Syb95iqiGbvP5SxviKpdL2Kn+oiiG/mH1AQNZ9oP9UH7iV1ZJl0+l6g B0yfFelOkyojZahLhKHA9n9uNyIRgv7CfnQ+WBn5rMho5NXBgZl2CEB5vsMQ8pLp8+Jm wSa+V+55L3pvsvX5QgbPwRzO02Jf0GCSoS+OwyYtgezUARLDtxu88bNs4z8kjORHX5Qj tCEQ== 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=VgqB9Y8h5bnfhCXmkl/azRC2OmXCg32NmQwIhmM9QmU=; b=tPbndwP3x9067cN2btM/QnqdjoBayOtskL0NDiKc3As71NwrqJGK3wx+/RIJA30at7 bPjbt03edpYtnuaBhQox4z3PY2KMUurA811VE5JfSJqOZGZlraK24AUkeWK/B2z/6ZuA 9B22//z1unZgBz89KY/wdz99fMUjWTS7bv5fBTyH8ILCVMOWgjl1GaCAdG2Uyj4uKMms qE1uzNVJtvlshHFsb3/tTleEixaD+VbfA1ldYb7ZTdyVddmk85icWcZzdel2tDkMLXo6 t8zMvyXPADKFlXtpR4y/B/Ulu0//GOJqTmklXs79dLeJihrTEUCYUSwTBBdlZURWL2/L 60ng== 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 5si12883304pgi.135.2018.04.26.09.44.49; Thu, 26 Apr 2018 09:45:03 -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 S1756872AbeDZQn2 (ORCPT + 99 others); Thu, 26 Apr 2018 12:43:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41016 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756855AbeDZQnZ (ORCPT ); Thu, 26 Apr 2018 12:43:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8FD1A5F7AE; Thu, 26 Apr 2018 16:43:24 +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 72E337B523; Thu, 26 Apr 2018 16:43:24 +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 46D741808850; Thu, 26 Apr 2018 16:43:24 +0000 (UTC) Date: Thu, 26 Apr 2018 12:43:24 -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, marcel@redhat.com, nilal@redhat.com, haozhong zhang , riel@surriel.com, stefanha@redhat.com, pbonzini@redhat.com, dan j williams , kwolf@redhat.com, xiaoguangrong eric , linux-kernel@vger.kernel.org, imammedo@redhat.com Message-ID: <358601698.23011599.1524761004239.JavaMail.zimbra@redhat.com> In-Reply-To: <20180426132406.GC30991@stefanha-x1.localdomain> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-4-pagupta@redhat.com> <20180426132406.GC30991@stefanha-x1.localdomain> Subject: Re: [Qemu-devel] [RFC v2] qemu: Add virtio pmem device 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: qemu: Add virtio pmem device Thread-Index: PlRV3tv3ry9/+W0+2e0WmSRmQm7QNg== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Apr 2018 16:43:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +static void virtio_pmem_flush(VirtIODevice *vdev, VirtQueue *vq) > > +{ > > + VirtQueueElement *elem; > > + VirtIOPMEM *pmem = VIRTIO_PMEM(vdev); > > + HostMemoryBackend *backend = MEMORY_BACKEND(pmem->memdev); > > + int fd = memory_region_get_fd(&backend->mr); > > + > > + elem = virtqueue_pop(vq, sizeof(VirtQueueElement)); > > + if (!elem) { > > + return; > > + } > > + /* flush raw backing image */ > > + fsync(fd); > > fsync(2) is a blocking syscall. This can hang QEMU for an unbounded > amount of time. o.k. Main thread will block, agree. > > Please do the fsync from a thread pool. See block/file-posix.c's > aio_worker() for an example. Sure! > > > +static void virtio_pmem_get_config(VirtIODevice *vdev, uint8_t *config) > > +{ > > + VirtIOPMEM *pmem = VIRTIO_PMEM(vdev); > > + struct virtio_pmem_config *pmemcfg = (struct virtio_pmem_config *) > > config; > > + > > + pmemcfg->start = pmem->start; > > + pmemcfg->size = pmem->size; > > Endianness. Please use virtio_st*_p() instead. sure. > > > +#define VIRTIO_PMEM_PLUG 0 > > What is this? will remove Thanks, Pankaj