Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2046152imm; Wed, 16 May 2018 07:06:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrN4yUbVrnaWfpQ1E2nS+To5HbxRH8kWHMeLTdnVW+LdfKezRSNf/Nn2aB51leUH1RXB2Fp X-Received: by 2002:a17:902:9689:: with SMTP id n9-v6mr1057065plp.363.1526479606227; Wed, 16 May 2018 07:06:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526479606; cv=none; d=google.com; s=arc-20160816; b=PIH8uB0l494rpVhbueZvgb4anNcePwhaUHCFJuXwshmi4S58nPOl6mrytqcA5wh6uf roYNquDzEkL079cz6KIQLjRIjK5wuiZH15pVxH22G2j9n+EpgIYGxROF2WngdjnvSK7K epKHy7rkjvsLHX1OoSQIdViH7jrIqcMwwENTdpnKzJ3KWvhx1hZp8tuAkivbrkMLiSuF mlyP2Yke0yY4qfXAJ1wVSr+U5FrAJ+tT2ZSmSQaMMFvMFF+r2kJiq69sQdoyw2+gseN6 oUzQc4LssY16AImHsbl0RjSsKBEtcnNVZPL/lMwvmy862cKswbc01tAzsB8hmjV+7Euo WXJQ== 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=QLUL1+RXGJFUIBrSKILrIyaRK2HQzBDATv3HVQ42pDA=; b=ygYCVSaXMTO/AKVeqEBN+q+mX3g0DD3QnX7CcBaTlD2HAkWIiqBRMWBa8HsfmEKGyj bAdj3Gmrg+NNH52yZTX3NKYWOfchRRRcPCKrnf/tFawuDyCr+tPoX+/nXd4sHJnY3Sj8 cT1eeOKx4zcX6hKinRRSsxO4hQdOlxUPLme4YTD0QT8twEPEv6ovvHKTwqhR7zRLMW1V LFPOD5NSUMF90s64JCaFA+D01FHJzEXXmPC18L+rgIMTGilxQ1+vNjgmkC3YzJPsGq+6 gR6QxgocsE5UGfjsQB88hfR/zG/9HfnfRjT+Z6k7T0FaGtC5JV3SLVl9O+0I8F+fl2t1 i9qQ== 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 c6-v6si2798397pfi.102.2018.05.16.07.06.31; Wed, 16 May 2018 07:06:46 -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 S1752695AbeEPOFy (ORCPT + 99 others); Wed, 16 May 2018 10:05:54 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50606 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752205AbeEPOFv (ORCPT ); Wed, 16 May 2018 10:05:51 -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 CB9BE401EF07; Wed, 16 May 2018 14:05:50 +0000 (UTC) Received: from [10.72.12.64] (ovpn-12-64.pek2.redhat.com [10.72.12.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 875082166BAD; Wed, 16 May 2018 14:05:47 +0000 (UTC) Subject: Re: [RFC v4 3/5] virtio_ring: add 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: <20180516083737.26504-1-tiwei.bie@intel.com> <20180516083737.26504-4-tiwei.bie@intel.com> <2000f635-bc34-71ff-ff51-a711c2e9726d@redhat.com> <20180516123909.GB986@debian> <20180516134550.GB4171@debian> From: Jason Wang Message-ID: Date: Wed, 16 May 2018 22:05:44 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180516134550.GB4171@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.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 16 May 2018 14:05:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 16 May 2018 14:05:50 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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年05月16日 21:45, Tiwei Bie wrote: > On Wed, May 16, 2018 at 08:51:43PM +0800, Jason Wang wrote: >> On 2018年05月16日 20:39, Tiwei Bie wrote: >>> On Wed, May 16, 2018 at 07:50:16PM +0800, Jason Wang wrote: >>>> On 2018年05月16日 16:37, Tiwei Bie wrote: >>> [...] >>>>> struct vring_virtqueue { >>>>> @@ -116,6 +117,9 @@ struct vring_virtqueue { >>>>> /* Last written value to driver->flags in >>>>> * guest byte order. */ >>>>> u16 event_flags_shadow; >>>>> + >>>>> + /* ID allocation. */ >>>>> + struct idr buffer_id; >>>> I'm not sure idr is fit for the performance critical case here. Need to >>>> measure its performance impact, especially if we have few unused slots. >>> I'm also not sure.. But fortunately, it should be quite easy >>> to replace it with something else without changing other code. >>> If it will really hurt the performance, I'll change it. >> We may want to do some benchmarking/profiling to see. > Yeah! > >>>>> }; >>>>> }; >>> [...] >>>>> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head, >>>>> + unsigned int id, void **ctx) >>>>> +{ >>>>> + struct vring_packed_desc *desc; >>>>> + unsigned int i, j; >>>>> + >>>>> + /* Clear data ptr. */ >>>>> + vq->desc_state[id].data = NULL; >>>>> + >>>>> + i = head; >>>>> + >>>>> + for (j = 0; j < vq->desc_state[id].num; j++) { >>>>> + desc = &vq->vring_packed.desc[i]; >>>>> + vring_unmap_one_packed(vq, desc); >>>> As mentioned in previous discussion, this probably won't work for the case >>>> of out of order completion since it depends on the information in the >>>> descriptor ring. We probably need to extend ctx to record such information. >>> Above code doesn't depend on the information in the descriptor >>> ring. The vq->desc_state[] is the extended ctx. >>> >>> Best regards, >>> Tiwei Bie >> Yes, but desc is a pointer to descriptor ring I think so >> vring_unmap_one_packed() still depends on the content of descriptor ring? >> > I got your point now. I think it makes sense to reserve > the bits of the addr field. Driver shouldn't try to get > addrs from the descriptors when cleanup the descriptors > no matter whether we support out-of-order or not. Maybe I was wrong, but I remember spec mentioned something like this. > > But combining it with the out-of-order support, it will > mean that the driver still needs to maintain a desc/ctx > list that is very similar to the desc ring in the split > ring. I'm not quite sure whether it's something we want. > If it is true, I'll do it. So do you think we also want > to maintain such a desc/ctx list for packed ring? To make it work for OOO backends I think we need something like this (hardware NIC drivers are usually have something like this). Not for the patch, but it looks like having a OUT_OF_ORDER feature bit is much more simpler to be started with. Thanks > > Best regards, > Tiwei Bie