Received: by 10.213.65.68 with SMTP id h4csp1037185imn; Wed, 21 Mar 2018 00:33:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdPvBROi5cfldYfiEtLtXGWWrnvTL6dVHSD16aeVT+8RoNzfqf4VClJooQHXP27XP1Vyhy X-Received: by 2002:a17:902:6001:: with SMTP id r1-v6mr19659897plj.330.1521617605474; Wed, 21 Mar 2018 00:33:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521617605; cv=none; d=google.com; s=arc-20160816; b=ScblYBe7cUAVs1Ua5cdoCmULwmAfMRHTSD/eYOytfjNPT2vifP5VY067+AD5B7Dsby /tJBgJlaoPR12ofAr19RjmVvn8rDsjtastgryPpZAOQxil+oGVhUn1whZeZCsj+3qZRc Ijj1sWdBoBwKOjjvtYjEjizie/XswRPKXoi0D5m1cSWxNcbF7OYq4OLh6DVFciQKK8V5 dPNwmA7961xSfMNlpFBBAwj0XE3rY01py75/3cuWz4vSoWzrADmdP9wY9iQk9gAK1s/q 7AxB48FT0kw7n58wdcCdiQOPwQC7/Kt/iil2L3/05ZCaTNjvWKRGuIkEGR5TJ57G+7Dn CCRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=FlgVt4XLEoRZfj9at5mUWgs2bisoM1cwT/uA1GSjGZU=; b=RsUZKZoK0NOguTwl5RFmEH8xQmDafFNDi7FhootU+5lNI2ZfYr/nfaiadxlvQOSVe1 h6kvONHAlaBnEjpE001QhEkI7T2CmeTTIqUX9fI0sakQkwnkeu+ax3AUkmKZu1A1dw74 MlNkot9HxH8QUpSqzm4yIAdp9ylWa1AhrggNepHujPcEQFfJYOMZ1ETyORqZCl1wo9W2 cTTkWihfem92WrMaWZk99+BND26EOrWiRqm8J+DDopKO2ROvGv2AqhcZxOaRBWD+6v+S /4EzDnmdjc+dQ91QvGhEO02r79XnPTkmNi0QKBH0hsb1CHByRtSFxGDdNyK7D9BJU7J2 bUZA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3-v6si3235091plr.192.2018.03.21.00.33.11; Wed, 21 Mar 2018 00:33:25 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751505AbeCUHcQ (ORCPT + 99 others); Wed, 21 Mar 2018 03:32:16 -0400 Received: from mga12.intel.com ([192.55.52.136]:50962 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751040AbeCUHcO (ORCPT ); Wed, 21 Mar 2018 03:32:14 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 00:32:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,339,1517904000"; d="scan'208";a="210044630" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164]) by orsmga005.jf.intel.com with ESMTP; 21 Mar 2018 00:32:12 -0700 Date: Wed, 21 Mar 2018 15:30:38 +0800 From: Tiwei Bie To: Jason Wang Cc: mst@redhat.com, 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: <20180321073038.gukl2pxqszuudv4t@debian> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <094ca28b-d8af-bf7a-ea7e-0d0bf7518bda@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) 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: > On 2018年03月16日 18:04, Tiwei Bie wrote: > > On Fri, Mar 16, 2018 at 04:34:28PM +0800, Jason Wang wrote: > > > On 2018年03月16日 15:40, Tiwei Bie wrote: > > > > On Fri, Mar 16, 2018 at 02:44:12PM +0800, Jason Wang wrote: > > > > > On 2018年03月16日 14:10, Tiwei Bie wrote: > > > > > > On Fri, Mar 16, 2018 at 12:03:25PM +0800, Jason Wang wrote: > > > > > > > On 2018年02月23日 19:18, Tiwei Bie wrote: > > > > > > > > Signed-off-by: Tiwei Bie > > > > > > > > --- > > > > > > > > drivers/virtio/virtio_ring.c | 699 +++++++++++++++++++++++++++++++++++++------ > > > > > > > > include/linux/virtio_ring.h | 8 +- > > > > > > > > 2 files changed, 618 insertions(+), 89 deletions(-) [...] > > > @@ -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. Thank you very much for the review on this patch! I'll send out a new version ASAP to address these comments. :) Best regards, Tiwei Bie