Received: by 10.213.65.68 with SMTP id h4csp429638imn; Fri, 16 Mar 2018 07:31:50 -0700 (PDT) X-Google-Smtp-Source: AG47ELuMA4DYOtWIV92bjpwN5m3kOdpoU4RBdiniSnEITcfQM4JOafNyF272b3hXkOaodgIpbAUY X-Received: by 2002:a17:902:2b84:: with SMTP id l4-v6mr2456488plb.338.1521210710815; Fri, 16 Mar 2018 07:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521210710; cv=none; d=google.com; s=arc-20160816; b=Y9xs3CxY78ziBwzvqDb8DTptC1/KNI+9ulNzKHiBL1AQi1VtQBvtzJBOj0xq8Y4a8W rNOyJCeMCa1AsF5nt1C2O7jCuY+PZlY3dD4ZpS7L3Os6H3Kh5rsI1g2KFJLwyo+OQuX/ naLTkzEz9CnPA1inC8Pb3nL/GYuaKev0msuLKeiwHJFq5/E6aDKobx/+UKe6q7kdzVZ7 MjKSuLequ0CBUoFCzZPzoLskqQI5yg6R9aU2R1rj8p/77QFm12URr9wy1IBD0pY8WtrM 8nzv/IVM5cRBzR7+rSqFEXbu4alZaSLeCXeGDDO17uPmC3ujVUeWOXeGdmj8KVXAri0Z dv1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=+UQ+unz4Yz/7Q+nKdWWUvqjgkvhWCUwlgBwoNkCuaRo=; b=ds8GHk0okZHIQ26sefWtTNg2mzr2Ysb7LhTnrjh6vT84738LNAspgB56mUsIsfC2oM d8+RKyHNht/7gW0lSeOJPPPSLYMvQwXxkGGcqCezgz7NmXxmWqW7bKVHFht9+pNt9cMy xINQHY9kkdztib672m+DM+ukkQsoK9Xg1usDy3xq946B+Y/3yShcKRbMgMJG0zwmToP0 QvySgI0cTFRLWVk1x35aJrNPbwcIQVMX1uSslysRca3ZQUqowyjeh9HMd72XylKXkBX5 BDKSuMi4u8WxrbifIJ7gNj27TTcWfmQIkIlNlRz6K3K85uwKEBbM8i2GoJ9ZEcvrmx6O UPbw== 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 z22-v6si4868622plo.28.2018.03.16.07.31.35; Fri, 16 Mar 2018 07:31:50 -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 S1752073AbeCPOaH (ORCPT + 99 others); Fri, 16 Mar 2018 10:30:07 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35650 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751079AbeCPOaE (ORCPT ); Fri, 16 Mar 2018 10:30:04 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6F517C6CC; Fri, 16 Mar 2018 14:30:03 +0000 (UTC) Received: from redhat.com (ovpn-124-13.rdu2.redhat.com [10.10.124.13]) by smtp.corp.redhat.com (Postfix) with SMTP id 8C37C215CDAF; Fri, 16 Mar 2018 14:30:02 +0000 (UTC) Date: Fri, 16 Mar 2018 16:30:02 +0200 From: "Michael S. Tsirkin" To: Jason Wang Cc: Tiwei Bie , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, wexu@redhat.com, jfreimann@redhat.com Subject: Re: [PATCH RFC 2/2] virtio_ring: support packed ring Message-ID: <20180316145702-mutt-send-email-mst@kernel.org> References: <20180223111801.15240-1-tiwei.bie@intel.com> <20180223111801.15240-3-tiwei.bie@intel.com> <8f73267a-e20e-de64-d8e0-3fd608dbf368@redhat.com> <20180316061047.o2xdyuqhak3mzjyw@debian> <0a0ecf42-8f7f-9387-8ca4-cb65d0835b56@redhat.com> <20180316074028.lun2jy45qqnfeymw@debian> <02a3da02-8226-ba4e-1b47-d25755b2c429@redhat.com> <20180316100413.vtqwatregzrmhvt3@debian> <094ca28b-d8af-bf7a-ea7e-0d0bf7518bda@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <094ca28b-d8af-bf7a-ea7e-0d0bf7518bda@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 16 Mar 2018 14:30:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 16 Mar 2018 14:30:03 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 16, 2018 at 07:36:47PM +0800, Jason Wang wrote: > > > @@ -1096,17 +1599,21 @@ struct virtqueue *vring_create_virtqueue( > > > > > > > > if (!queue) { > > > > > > > > /* Try to get a single page. You are my only hope! */ > > > > > > > > - queue = vring_alloc_queue(vdev, vring_size(num, vring_align), > > > > > > > > + queue = vring_alloc_queue(vdev, __vring_size(num, vring_align, > > > > > > > > + packed), > > > > > > > > &dma_addr, GFP_KERNEL|__GFP_ZERO); > > > > > > > > } > > > > > > > > if (!queue) > > > > > > > > return NULL; > > > > > > > > - queue_size_in_bytes = vring_size(num, vring_align); > > > > > > > > - vring_init(&vring, num, queue, vring_align); > > > > > > > > + queue_size_in_bytes = __vring_size(num, vring_align, packed); > > > > > > > > + if (packed) > > > > > > > > + vring_packed_init(&vring.vring_packed, num, queue, vring_align); > > > > > > > > + else > > > > > > > > + vring_init(&vring.vring_split, num, queue, vring_align); > > > > > > > Let's rename vring_init to vring_init_split() like other helpers? > > > > > > The vring_init() is a public API in include/uapi/linux/virtio_ring.h. > > > > > > I don't think we can rename it. > > > > > I see, then this need more thoughts to unify the API. > > > > My thought is to keep the old API as is, and introduce > > > > new types and helpers for packed ring. > > > I admit it's not a fault of this patch. But we'd better think of this in the > > > future, consider we may have new kinds of ring. > > > > > > > More details can be found in this patch: > > > > https://lkml.org/lkml/2018/2/23/243 > > > > (PS. The type which has bit fields is just for reference, > > > > and will be changed in next version.) > > > > > > > > Do you have any other suggestions? > > > No. > > Hmm.. Sorry, I didn't describe my question well. > > I mean do you have any suggestions about the API > > design for packed ring in uapi header? Currently > > I introduced below two new helpers: > > > > static inline void vring_packed_init(struct vring_packed *vr, unsigned int num, > > void *p, unsigned long align); > > static inline unsigned vring_packed_size(unsigned int num, unsigned long align); > > > > When new rings are introduced in the future, above > > helpers can't be reused. Maybe we should make the > > helpers be able to determine the ring type? > > Let's wait for Michael's comment here. Generally, I fail to understand why > vring_init() become a part of uapi. Git grep shows the only use cases are > virtio_test/vringh_test. > > Thanks For init - I think it's a mistake that stems from lguest which sometimes made it less than obvious which code is where. I don't see a reason to add to it. -- MST