From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YL9Ts-0003G9-G7 for qemu-devel@nongnu.org; Tue, 10 Feb 2015 06:59:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YL9Tm-0004Kn-Mf for qemu-devel@nongnu.org; Tue, 10 Feb 2015 06:59:52 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:7569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YL9Tl-0004JJ-UO for qemu-devel@nongnu.org; Tue, 10 Feb 2015 06:59:46 -0500 Message-ID: <54D9F294.2090000@huawei.com> Date: Tue, 10 Feb 2015 19:59:16 +0800 From: Linhaifeng MIME-Version: 1.0 References: <1423547293-8448-1-git-send-email-haifeng.lin@huawei.com> <20150210084632.GA8397@redhat.com> <54D9DCF8.2000106@huawei.com> <20150210104126.GE9505@redhat.com> In-Reply-To: <20150210104126.GE9505@redhat.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 1/2] vhost-user: support SET_MEM_TABLE waite the result of mmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: arei.gonglei@huawei.com, qemu-devel@nongnu.org On 2015/2/10 18:41, Michael S. Tsirkin wrote: > On Tue, Feb 10, 2015 at 06:27:04PM +0800, Linhaifeng wrote: >> >> >> On 2015/2/10 16:46, Michael S. Tsirkin wrote: >>> On Tue, Feb 10, 2015 at 01:48:12PM +0800, linhaifeng wrote: >>>> From: Linhaifeng >>>> >>>> Slave should reply to master and set u64 to 0 if >>>> mmap all regions success otherwise set u64 to 1. >>>> >>>> Signed-off-by: Linhaifeng >>> >>> How does this work with existig slaves though? >>> >> >> Slaves should work like this: >> >> int set_mem_table(...) >> { >> .... >> for (idx = 0, i = 0; idx < memory.nregions; idx++) { >> .... >> mem = mmap(..); >> if (MAP_FAILED == mem) { >> msg->msg.u64 = 1; >> msg->msg.size = MEMB_SIZE(VhostUserMsg, u64); >> return 1; >> } >> } >> >> .... >> >> msg->msg.u64 = 0; >> msg->msg.size = MEMB_SIZE(VhostUserMsg, u64); >> return 1; >> } >> >> If slaves not reply QEMU will always wait. > > Are you sure existing slaves reply? No.May be the existing slaves need add reply in their codes. > >>>> --- >>>> docs/specs/vhost-user.txt | 1 + >>>> 1 file changed, 1 insertion(+) >>>> >>>> diff --git a/docs/specs/vhost-user.txt b/docs/specs/vhost-user.txt >>>> index 650bb18..c96bf6b 100644 >>>> --- a/docs/specs/vhost-user.txt >>>> +++ b/docs/specs/vhost-user.txt >>>> @@ -171,6 +171,7 @@ Message types >>>> Id: 5 >>>> Equivalent ioctl: VHOST_SET_MEM_TABLE >>>> Master payload: memory regions description >>>> + Slave payload: u64 (0:success >0:failed) >>>> >>>> Sets the memory map regions on the slave so it can translate the vring >>>> addresses. In the ancillary data there is an array of file descriptors >>>> -- >>>> 1.7.12.4 >>>> >>> >>> >> >> -- >> Regards, >> Haifeng > > . > -- Regards, Haifeng