Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1959816imm; Wed, 16 May 2018 05:52:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqS758xHBC9o4Nlf9dfurKeA3gEPh/GdkxSfPaqGnus+jlOUiA5lOtAPxaKKgdQt1qiCy9M X-Received: by 2002:a62:3dc9:: with SMTP id x70-v6mr827729pfj.85.1526475157162; Wed, 16 May 2018 05:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526475157; cv=none; d=google.com; s=arc-20160816; b=NVXrX4h6Ba9gOw6VjtsyweQzc3eGLMuPqP08s3YiHhfTJr5vOZRpFaVwX5eVUDRmEf QR9mqcm3+N1LzNPXhsPnlrTXgF2+gSEnpdXJusdcp2QaPaNF3CEFmE9FhXHAmUok+w36 MbJI4nrgE+geTiRsra19LW0haDaD6cd7Pjr6QFO5unmrQcKWH1I56anVMvCckIKSSNg4 3YylFre+ofprwmhQoaitSjx8FTTVdjvpCL29KCv2BXd6nKEs74pP7AP4YFHeKAuReUPA ss5sl7/oqutsshfGZaU0Mgk28++UHg0+bDi32m6Q4CnbE4vEwm3GeeAEFOuFFHFM6yoF 1EGg== 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=cxyoMQzcW8s+uWxALFQihpS2PwaSGd9fk+svndziV3I=; b=r6vBFW67AO5o0Dfo010nCrZvQI/W8hYxmkUF5r37JTs0pTZcLuqs6LHGwrNp1++mFW E9zX16vaVTOTN1E1L1itxEG3bInb1IdeM76nBkCsiFPYUL0ziZNFjJUJqc36WVhKvyYT ONfqTN620R/C2M4V0R11XbdWjUYK1fjFeWzIzK9AriHicRjHoagF/y5kXc2VBaN0XElW Ouuim5yF+YLb9KlLyzs/kST8M54F5j+031D3gfXIEcMJx8u58KHo9VcnJ00ltgsQXBoT QYvJUoIwHGUHrY+sD1+mqsQhkU/Dh6h1TNvbL3EaZHRqQMYb6awVG+QWe3kggl+beh/w risQ== 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 h16-v6si2503242pli.53.2018.05.16.05.52.23; Wed, 16 May 2018 05:52:37 -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 S1753015AbeEPMvx (ORCPT + 99 others); Wed, 16 May 2018 08:51:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35962 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752991AbeEPMvu (ORCPT ); Wed, 16 May 2018 08:51:50 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C6B7E81663C0; Wed, 16 May 2018 12:51:49 +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 D25922024CBB; Wed, 16 May 2018 12:51:46 +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> From: Jason Wang Message-ID: Date: Wed, 16 May 2018 20:51:43 +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: <20180516123909.GB986@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.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 16 May 2018 12:51:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 16 May 2018 12:51:49 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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日 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. > >>> }; >>> }; > [...] >>> +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? Thanks