Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2849106imm; Fri, 20 Jul 2018 06:05:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdgnG8FuzLbbBkB9aZTtLlHR0dL1HOp5ujElxX6hFq+BbBFFZ+zy2UrJXeuSYqvKC+y56oP X-Received: by 2002:a17:902:6ac3:: with SMTP id i3-v6mr2063365plt.252.1532091943741; Fri, 20 Jul 2018 06:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532091943; cv=none; d=google.com; s=arc-20160816; b=AmDDctX9XbsiSppDSQa5vj1NPeMhX/MxVQbGmTWnMxH2WLK1XHknzVRUUEk8s/ZTxj m+IBmZySCr+EuxsVxgCMyh4Lcicjtnb4TDU9aJ77dCbp/TzWs5eanTP6cp0NogyvO+CI YLcdCr7MEvuR7kAd4fsU8BzwAg/H4wvqT2VglprHlOeBH1dL6Ygowneyupa9jRqDZd5T FUDIT7icoacVYMe8v9gsknHKVzir+MFEEsN4Xe/gTbV7lA9lAeix8ock5qSepFPTgCPn L6B4omOGz35s+sdQ9W6efFzi5ix19XaRe9j6xOS34OGqtjzO+yoW4dyNwRthiQjU8WKe ZzHQ== 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=VWNJhc8wuQWPRsq7yZFOik+HDBYHNzzsoK/fADl0hTo=; b=B1X/StHTP5yBVi0EDAYvtugs/kIaoqKF2PjUAEq7DD865c5GaEjhm1v6RuigORcMNE osGL9Bus2dl6lC3TUKCecw0JcMWYe3XjFvf8X6j+tJpM7/IbhpTw6bueOK1xPuD3cFbk J1TgOqhxbbN7ydTBijiK3ioX7cqwdqpHeOOodtC2DEf+bUywtp/ONzEM4oifOtswKWlv Um+UclDaQkmAW3HEsnHutVaoupFqlx1v0AIx8x7ThJPvfO35O2CIt8NbMmpQVTkwuQsl UkPwemX5kkRO1/p2SLe7ifCaveYNdsPhtB/ejSg285ZT1mTUzRmZG2fd1MFd1zvp7rkK GGbw== 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 z20-v6si1921018pfj.337.2018.07.20.06.05.29; Fri, 20 Jul 2018 06:05:43 -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 S1731379AbeGTNw1 (ORCPT + 99 others); Fri, 20 Jul 2018 09:52:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730996AbeGTNw0 (ORCPT ); Fri, 20 Jul 2018 09:52:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA0AF307D86F; Fri, 20 Jul 2018 13:04:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC24E5C1A1; Fri, 20 Jul 2018 13:04:15 +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 928694BB78; Fri, 20 Jul 2018 13:04:15 +0000 (UTC) Date: Fri, 20 Jul 2018 09:04:15 -0400 (EDT) From: Pankaj Gupta To: Luiz Capitulino Cc: Stefan Hajnoczi , kwolf@redhat.com, haozhong zhang , jack@suse.cz, xiaoguangrong eric , kvm@vger.kernel.org, riel@surriel.com, linux-nvdimm@ml01.01.org, david@redhat.com, ross zwisler , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, hch@infradead.org, imammedo@redhat.com, mst@redhat.com, niteshnarayanlal@hotmail.com, pbonzini@redhat.com, dan j williams , nilal@redhat.com Message-ID: <1832644023.52851886.1532091855557.JavaMail.zimbra@redhat.com> In-Reply-To: <20180719084819.730b7971@doriath> References: <20180713075232.9575-1-pagupta@redhat.com> <20180713075232.9575-4-pagupta@redhat.com> <20180718085529.133a0a22@doriath> <367397176.52317488.1531979293251.JavaMail.zimbra@redhat.com> <20180719121635.GA28107@stefanha-x1.localdomain> <20180719084819.730b7971@doriath> Subject: Re: [Qemu-devel] [RFC v3] qemu: Add virtio pmem device MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.65.193.70, 10.4.195.18] Thread-Topic: qemu: Add virtio pmem device Thread-Index: lg4rWpxgdnhQI+PfnM/uab2D63zWJw== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 20 Jul 2018 13:04:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > > + > > > > > +typedef struct VirtIOPMEMresp { > > > > > + int ret; > > > > > +} VirtIOPMEMResp; > > > > > + > > > > > +typedef struct VirtIODeviceRequest { > > > > > + VirtQueueElement elem; > > > > > + int fd; > > > > > + VirtIOPMEM *pmem; > > > > > + VirtIOPMEMResp resp; > > > > > +} VirtIODeviceRequest; > > > > > + > > > > > +static int worker_cb(void *opaque) > > > > > +{ > > > > > + VirtIODeviceRequest *req = opaque; > > > > > + int err = 0; > > > > > + > > > > > + /* flush raw backing image */ > > > > > + err = fsync(req->fd); > > > > > + if (err != 0) { > > > > > + err = errno; > > > > > + } > > > > > + req->resp.ret = err; > > > > > > > > Host question: are you returning the guest errno code to the host? > > > > > > No. I am returning error code from the host in-case of host fsync > > > failure, otherwise returning zero. > > > > I think that's what Luiz meant. errno constants are not portable > > between operating systems and architectures. Therefore they cannot be > > used in external interfaces in software that expects to communicate with > > other systems. > > Oh, thanks. Only saw this email now. > > > It will be necessary to define specific constants for virtio-pmem > > instead of passing errno from the host to guest. > > Yes, defining your own constants work. But I think the only fsync() > error that will make sense for the guest is EIO. The other errors > only make sense for the host. Agree. Thanks, Pankaj