Received: by 10.192.165.148 with SMTP id m20csp2149854imm; Thu, 26 Apr 2018 06:46:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/LPw9dvOnymh8WaVhWHIE1s+fnKwF7ReVmg2wABMJceUyd1Jzfaf/gNkCoQTMvOS7iCLbv X-Received: by 10.98.0.194 with SMTP id 185mr28914273pfa.238.1524750361738; Thu, 26 Apr 2018 06:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524750361; cv=none; d=google.com; s=arc-20160816; b=gABKVamLYhz7moOyYuHrlfX/Qj8sIzf0zI7FOVOeNJfXZYEjyCpLA45S12EiYzQnPW mKfYgAuGQuEo0mpFC3BFyeREidj7lRfHAaszYlzsdVmQvWbsFpmNxTAaaTOOCpdvLnLN pj84mnZOWlw4Nn8nLsspdZdAXoWsJmnKn0NliXUovPcEJz+C6QdDr/0Uf0ORIqCGSRCR /hcxNa60LfZlw/Yg52kZtQv8THI8jSqt4V/RXUy6c4kuxAzOJ6ZyULT6h9mcI9k3APAj +9n08DYDl2OOSItLmcAozFYak9PwtIxkKq5ErvBOsOVHKFr+uMG0gkAs/KW1Uu5yt4oa iE3Q== 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:dkim-signature:arc-authentication-results; bh=B+QzVTpm7z0SBCB8kwuNQqkMTh3GhmLyx5aHenAxxtI=; b=TWhl0vSwdbN1PLMfokwaOpZJz8hEbsXeTbtajkl/QbB+aDs+xZ0b9dbvJ5l7gik3Qh Sq2Pun0RJ6sPK6lrR8dEoM6OZxBe8M5bkKyNsswLnQt+qyC6gG7oxDF8nv40AkLS3mep KjGmds06dpH9IfLnb4LvE94aZISfc605LLzrXuRBgjR9OA2DOJJDcgvZIxuNI7b/Gbgi q+baecouK2+lbiyaNPYIjHJv///fdT8+J07QtPkPxUuvfDiV8ldBIPgyduIdN7LzMybo zaix2pviH7C7bYmNo1kfD9UhHupvVIFkxZzsgb/gDqCTESC167B07YggzYeYAdkhRO2Z RTuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Zb0gq2vh; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si19486606plo.88.2018.04.26.06.45.47; Thu, 26 Apr 2018 06:46:01 -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=@gmail.com header.s=20161025 header.b=Zb0gq2vh; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756326AbeDZNoY (ORCPT + 99 others); Thu, 26 Apr 2018 09:44:24 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40068 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756172AbeDZNoW (ORCPT ); Thu, 26 Apr 2018 09:44:22 -0400 Received: by mail-wm0-f68.google.com with SMTP id j5so13444724wme.5; Thu, 26 Apr 2018 06:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=B+QzVTpm7z0SBCB8kwuNQqkMTh3GhmLyx5aHenAxxtI=; b=Zb0gq2vhwkfwyKolNMKwjTMv7aBUTLt/USL8rN1A7D9K+4CKqb2LoSVlko1VMCiODp YeTvLGPJ1jLnm0XiGYsUdQ1iNFNyd5PCIo9Ww63lYIRDSB/o6SasAHnr6Mi0ckRrBAeM 4dm59PsaS7T0OwZoDm2ODOvUTzpftuFnT3dt2nbVkpDMDbdWTnI0ArYC7y1dLjGhAZnQ 3Mm+pvar/4YNiECC3zn41Cu3XY/ZrXHkF7YEO7s3DAJIFSG59uuDU+jbK2KT2CC8oEuM gHCNb/aTJOpPOhz0HxOqF4G/fSe9Nxsuy6wUbw/S8WYB1LQtYLbcwxMcxZQXKLkxT0Ka 6VTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=B+QzVTpm7z0SBCB8kwuNQqkMTh3GhmLyx5aHenAxxtI=; b=hR8hWqUYh8j0E5Kb2TzakQhFvT6iO5gdy9zgXjHRokZ7/Ny/1LUDTALvsUlVyPyJA0 cFGKWU6nBIVKglaDyDHhyADtDdgNU8GkP9gs6bE+mgebaMZF5SJsDqPW4MBheyHhTdLZ 6jG/S7H+qR6ONm7s/eNSSsQVgGsbWVC6IxF6rfcS1HVa3CHc2HzWL5n5q3fM7s2lZ2Mh cieoDg77DtQppo4zJmUFXPfnJ/LXlzphi/jiRt60ryXGvNPWnJwHXzyLNN288x536VES MyNb1ENm2tZYvR7nWbW2uq/wvsS9oddFfeVv2jAIkF4hy3OxhzRKLGNXrpOJx94RYM0J gnEw== X-Gm-Message-State: ALQs6tBCoE1/6Oc2kuP2FBNgdzHz8NVsvanPKrjKvfMTnQmFcR7RDbdt r1ha87uRvvsynnLy40yn6hc= X-Received: by 10.28.19.13 with SMTP id 13mr20246354wmt.89.1524750261478; Thu, 26 Apr 2018 06:44:21 -0700 (PDT) Received: from localhost ([51.15.41.238]) by smtp.gmail.com with ESMTPSA id y100sm30725083wmh.2.2018.04.26.06.44.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Apr 2018 06:44:20 -0700 (PDT) Date: Thu, 26 Apr 2018 14:24:06 +0100 From: Stefan Hajnoczi To: Pankaj Gupta 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@intel.com, riel@surriel.com, haozhong.zhang@intel.com, nilal@redhat.com, kwolf@redhat.com, pbonzini@redhat.com, ross.zwisler@intel.com, david@redhat.com, xiaoguangrong.eric@gmail.com, hch@infradead.org, marcel@redhat.com, mst@redhat.com, niteshnarayanlal@hotmail.com, imammedo@redhat.com, lcapitulino@redhat.com Subject: Re: [RFC v2] qemu: Add virtio pmem device Message-ID: <20180426132406.GC30991@stefanha-x1.localdomain> References: <20180425112415.12327-1-pagupta@redhat.com> <20180425112415.12327-4-pagupta@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Fig2xvG2VGoz8o/s" Content-Disposition: inline In-Reply-To: <20180425112415.12327-4-pagupta@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Fig2xvG2VGoz8o/s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Apr 25, 2018 at 04:54:15PM +0530, Pankaj Gupta wrote: > +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. Please do the fsync from a thread pool. See block/file-posix.c's aio_worker() for an example. > +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. > +#define VIRTIO_PMEM_PLUG 0 What is this? --Fig2xvG2VGoz8o/s Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJa4dL2AAoJEJykq7OBq3PIp2cH/04ij3qJX2uJVEfJckUXj9lJ fjMJsmgdYmJatxT52TPw12puheCukYnuCbsWspRls4Q2Lr0sKRZ1vQ9nObO8yTUT jtsRUwuiezUPUwih88GHt0Rud52SZtq9fCtkYf3mupjxn22n9x2xeFVMqgKvKZoJ QdfS/K5FrrD+wBAptUjTMWt7Kf0mTANUDUUfHj5zgQwT6nwHbFyImF3etC4I98Yf MSjPFw3V5mF4TYV5ZoPHXQmE6tjVj2G17SJiKfa5x53RNUMDTYD4DJaLQnCeRLLa 7ka5Z4SDUlBvZkLDEAx5VQ7rWHPjCpoddcqqXAhiDGDBb6zZAKtY7i/WUV9kxaE= =NyIA -----END PGP SIGNATURE----- --Fig2xvG2VGoz8o/s--