Received: by 10.223.185.116 with SMTP id b49csp5673474wrg; Tue, 27 Feb 2018 18:39:42 -0800 (PST) X-Google-Smtp-Source: AH8x226Vo4uzT0HK/fPXz2IB6qCuPq0y8fvYfovO532/ZOuNoW+y1iM2qhyI1iIfvCbRFrRiGPtE X-Received: by 10.99.127.65 with SMTP id p1mr12902526pgn.50.1519785581964; Tue, 27 Feb 2018 18:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519785581; cv=none; d=google.com; s=arc-20160816; b=UVEyinCxTW2RtwXA00Fy4ssM/KzWz4cCVfyth/iPDmJQUUpX0FG4YG6YxV53+pdjvT 7cGutxv/97/XiKmn4865JwBrPj7Kq9VsT/GkB0LdyJIB7PFSDnPeeBrgfjfzM7LCdvYA TQO3GoFMUSaolzhDPJNHrJBOCDaYDl3oB7ssZS4MNuJBLDdj0+eX3ZMI+NdV9BLzOMWi Hlo0Fg3ILV6JO+waFaWKmw/EDDBkTjFiMzfv88e96Nw6sM5Yk5nAqVFGNBwteDTnabCi rFzHkOjeaS3l4/kHwfxWg2Qw3h2uDljoXCBNQh7xvJeAuVbkS286h2ziDcJO19soLnX5 rF6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=fiTu+Vu2wD8KjAgAcC8eOaB9D5X7GXkdUKQe1sAPS1o=; b=sGNFWpVgucfiUUNGDkNV6gHSJ9pO2EwgXZe6a/M6dwD4ctNXp6JpNsWh7UKiyPfg17 0gLNzQNWsabZvBNNW6da34YNmDn9KXvNObmtAJcHjZr+y1ri/W6LAPbT17D/dy91He8i CiPiusWUTFMxM1WdlhXlNGWFFjVoifDFTO3Ucw/6JpnlIxLdEKNzOaMXAAw8HtWQBLXl clFuI+FNYYVBzKMUdIVGeZzlUoBY16jeMzu22ela3h8Gk8HLezGcj527wwTwcOoI0Z/l +gLoRhhhABhevpQQHetGIlxMVX1B/b2dI6haYwNemHN5u/VB1Jr7cGOg0PftuRQWjp/L In6w== 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 u6-v6si449234pld.129.2018.02.27.18.39.25; Tue, 27 Feb 2018 18:39:41 -0800 (PST) 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 S1751733AbeB1Cir (ORCPT + 99 others); Tue, 27 Feb 2018 21:38:47 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57760 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751463AbeB1Ciq (ORCPT ); Tue, 27 Feb 2018 21:38:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE7A087ABA; Wed, 28 Feb 2018 02:38:45 +0000 (UTC) Received: from [10.72.12.137] (ovpn-12-137.pek2.redhat.com [10.72.12.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AE8110B0F32; Wed, 28 Feb 2018 02:38:38 +0000 (UTC) Subject: Re: [PATCH RFC 2/2] vhost: packed ring support To: Tiwei Bie Cc: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, wexu@redhat.com, jfreimann@redhat.com References: <1518575829-1431-1-git-send-email-jasowang@redhat.com> <1518575829-1431-3-git-send-email-jasowang@redhat.com> <20180227090319.h7hxmxp5rpozrb5s@debian> From: Jason Wang Message-ID: <4a77554f-a4ce-a1d7-97c4-ffeb56bf1c90@redhat.com> Date: Wed, 28 Feb 2018 10:38:36 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180227090319.h7hxmxp5rpozrb5s@debian> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 28 Feb 2018 02:38:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 28 Feb 2018 02:38:45 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jasowang@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018年02月27日 17:03, Tiwei Bie wrote: > On Wed, Feb 14, 2018 at 10:37:09AM +0800, Jason Wang wrote: > [...] >> +static void set_desc_used(struct vhost_virtqueue *vq, >> + struct vring_desc_packed *desc, bool wrap_counter) >> +{ >> + __virtio16 flags = desc->flags; >> + >> + if (wrap_counter) { >> + desc->flags |= cpu_to_vhost16(vq, DESC_AVAIL); >> + desc->flags |= cpu_to_vhost16(vq, DESC_USED); >> + } else { >> + desc->flags &= ~cpu_to_vhost16(vq, DESC_AVAIL); >> + desc->flags &= ~cpu_to_vhost16(vq, DESC_USED); >> + } >> + >> + desc->flags = flags; > The `desc->flags` is restored after the change. Right, will fix. >> +} >> + >> +static int vhost_get_vq_desc_packed(struct vhost_virtqueue *vq, >> + struct iovec iov[], unsigned int iov_size, >> + unsigned int *out_num, unsigned int *in_num, >> + struct vhost_log *log, >> + unsigned int *log_num) >> +{ >> + struct vring_desc_packed desc; >> + int ret, access, i; >> + u16 avail_idx = vq->last_avail_idx; >> + >> + /* When we start there are none of either input nor output. */ >> + *out_num = *in_num = 0; >> + if (unlikely(log)) >> + *log_num = 0; >> + >> + do { >> + unsigned int iov_count = *in_num + *out_num; >> + >> + i = vq->last_avail_idx & (vq->num - 1); > The queue size may not be a power of 2 in packed ring. Will fix this too. Thanks > Best regards, > Tiwei Bie