Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2021542imm; Wed, 16 May 2018 06:45:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrSOCW8LP7e1WCvvmu1vivR5hjm6jh6542E8SYK9CNAdvIBooSF4dNSA1o6/BO+1Bx1zFAj X-Received: by 2002:a63:788b:: with SMTP id t133-v6mr843586pgc.20.1526478357454; Wed, 16 May 2018 06:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526478357; cv=none; d=google.com; s=arc-20160816; b=z7zxeX722mmqtVtNdX2amnVNh41PtmtyNSDjE0Ol5qNxwjK6cNgm8UiA/M2IcpqMFG 6mAFbIeto/4OVm/b5VvR88NU/hZ6k3fhiWjttSUJ9tU9VQwQkFRuUeZuLDfBk6pKRDBI 3sLKB4RzIekkv1bWkHGOjSrFnc94HawPhXZ8pR18U9TacCU3XhcBQpU58WJz3ZIosZ5I 5MLj7BjufZr72leMhdGM5KQQtmraLBSjXzjs6vh0nJ1bvd35yPIptTlM8tJYcu8xOZ1V nbl2c/q3pllKMOcbpqinEFrqAQkj+ZO7AvLYcQsG7d7+hK8MlsAFDDc51DIf51ulvQwQ iM/g== 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=gf9bsozMEaXnCqcrJT25Ih0VJNLI2CxLlxGSKPpP2m8=; b=fanfb6MCFOUZAViPBx8mWJeZawzkddDo7ybSEB8yi/5WYd9bUvWNggkhF2PAliL1yR tc3ti4BEtUDIqMQ6zzg98+31qH4L0LYOlMvNkmhh3UdK1feG6Px367ps+/RcAaZuQTU+ BQ//TYlg5Ez5jjxin23AVFv7keQ7FNdcIqFLfPkZunTJ7Bf8EcHOLlkMvdARkr9sUGRt peoviKOYgquAfnjs/aeK51yXszWGzL4s/MXdH/IKtAiAUaCJ270s3K8JUhW0BLUZr0Fa q9xrfGBuSbrXYPdeLCdrQdAbah0GvXm4buMyRRfx/q5iBN/TYsMlEjWx5HN/LueUyaaR v6Qw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b190-v6si2162287pgc.18.2018.05.16.06.45.42; Wed, 16 May 2018 06:45:57 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752366AbeEPNp1 (ORCPT + 99 others); Wed, 16 May 2018 09:45:27 -0400 Received: from mga01.intel.com ([192.55.52.88]:36308 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395AbeEPNp0 (ORCPT ); Wed, 16 May 2018 09:45:26 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2018 06:45:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,406,1520924400"; d="scan'208";a="56398290" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.203]) by orsmga001.jf.intel.com with ESMTP; 16 May 2018 06:45:23 -0700 Date: Wed, 16 May 2018 21:45:50 +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: [RFC v4 3/5] virtio_ring: add packed ring support Message-ID: <20180516134550.GB4171@debian> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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? Best regards, Tiwei Bie