Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3196845imm; Thu, 17 May 2018 05:06:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo2HUmnpPt2lpb/N4xmdMS2NAql1/jIL7iiW8q/ljymebnQJx3nr2ki8OjwO2vCqZgNZI9M X-Received: by 2002:a17:902:a60d:: with SMTP id u13-v6mr5036151plq.40.1526558793283; Thu, 17 May 2018 05:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526558793; cv=none; d=google.com; s=arc-20160816; b=fS+RLSdqiX9cH839Z4NhN9ly645YkbdLl3wQ5z5oH+gvlmIbL/d0Z2fzCOhjeaujdG W1FXK5fXhqcliy8qJmQ0p4etzhxLZqiPH8oizxFq6c5cO8JMxEgp4lhth9Xx/AraNVKy JsP0zrzw+HFHiCZFr6oWzaNRQFuh8cA4DfESZWRL/aUUA7IBdSw4Cpc8pQThNR55+B32 tITb2jBN79DVQ/aw/quNl9vNrdu4JWDe3AyAMXdaqJQEo5HRwHJapmTUUns7Bn/MaXkF qHnCTQ8N62oZUpJCP4xGGoEJQW3DCQjH1xaixTU+aRBoluxuS8cWdkn5cpUN6zbgfCXg H1Jg== 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=PGVK2Sr2NKxAKbug+tDzCcnYFFzW0D27upLWBwtcGMs=; b=yV88US7gnu8xNgYnQQf7KKK/s26iSm5gGunYGzJQvMPGXTIp+mTwZ02kgnLrEbkdGl JnvvOK4vdWJ6xaiSo5OTPSez//n2HiYeTj234udyYYu3dXWas9jIKgM4Nn3GMfIWKs3s E4HCe+UjrtrlyvwDJFjhzXtu6pnmsnHFo3/JasKsvEJER4hrvNd6wRLk1laKbQJErY7M vTvGSrsn0e+s2ziUAjg2+tlodNcbBvyH8UoSdTXB8qcRF/f3q5SsjQzYb8qv8Y81nhe5 YEFqlIpWOLbl6WzltlucmGeS+mP5Z9GasS/FlnKDVtFuyk3QI4dvpptF/ZO3VXRCg2mH O/EA== 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 l10-v6si3946428pgn.304.2018.05.17.05.05.33; Thu, 17 May 2018 05:06:33 -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 S1752129AbeEQMCB (ORCPT + 99 others); Thu, 17 May 2018 08:02:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33868 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751179AbeEQMCA (ORCPT ); Thu, 17 May 2018 08:02:00 -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 89151406E897; Thu, 17 May 2018 12:01:59 +0000 (UTC) Received: from [10.72.12.54] (ovpn-12-54.pek2.redhat.com [10.72.12.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 582802166BAD; Thu, 17 May 2018 12:01:55 +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> <20180516143332.GA1957@debian> From: Jason Wang Message-ID: Date: Thu, 17 May 2018 20:01:52 +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: <20180516143332.GA1957@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.7]); Thu, 17 May 2018 12:01:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 17 May 2018 12:01:59 +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日 22:33, Tiwei Bie wrote: > On Wed, May 16, 2018 at 10:05:44PM +0800, Jason Wang wrote: >> 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: > [...] >>>>>>> +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. > You're right. Spec mentioned this. I was just repeating > the spec to emphasize that it does make sense. :) > >>> 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). > Which hardware NIC drivers have this? It's quite common I think, e.g driver track e.g dma addr and page frag somewhere. e.g the ring->rx_info in mlx4 driver. Thanks > >> Not for the patch, but it looks like having a OUT_OF_ORDER feature bit is >> much more simpler to be started with. > +1 > > Best regards, > Tiwei Bie