From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: thoughts stac/clac and get user for vhost Date: Wed, 26 Dec 2018 10:06:59 -0500 Message-ID: <20181226100341-mutt-send-email-mst@kernel.org> References: <20181225113301-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org To: Jason Wang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38578 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbeLZPHA (ORCPT ); Wed, 26 Dec 2018 10:07:00 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 09909C057F21 for ; Wed, 26 Dec 2018 15:07:00 +0000 (UTC) Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Dec 26, 2018 at 12:03:50PM +0800, Jason Wang wrote: > > On 2018/12/26 上午12:41, Michael S. Tsirkin wrote: > > Hi! > > I was just wondering: packed ring batches things naturally. > > E.g. > > > > user_access_begin > > check descriptor valid > > smp_rmb > > copy descriptor > > user_access_end > > > But without speculation on the descriptor (which may only work for in-order > or even a violation of spec). Only one two access of a single descriptor > could be batched. For split ring, we can batch more since we know how many > descriptors is pending. (avail_idx - last_avail_idx). > > Anything I miss? > > Thanks > just check more descriptors in a loop: user_access_begin for (i = 0; i < 16; ++i) { if (!descriptor valid) break; smp_rmb copy descriptor } user_access_end you don't really need to know how many there are ahead of the time as you still copy them 1 by one. > > > > So packed layout should show the gain with this approach. > > That could be motivation enough to finally enable vhost packed ring > > support. > > > > Thoughts? > >