From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f41.google.com (mail-pg0-f41.google.com [74.125.83.41]) by dpdk.org (Postfix) with ESMTP id B337F1F5 for ; Mon, 11 Sep 2017 06:18:32 +0200 (CEST) Received: by mail-pg0-f41.google.com with SMTP id i130so6003949pgc.3 for ; Sun, 10 Sep 2017 21:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9gS7W7Z0WwlBWedii3T7sv3vHiazgYtexVLo0U5UPps=; b=cjgZs+W1tBG5bnYX1k5CVDPhly1DDZINP99TvkTju9vTVzulfm9A+603UYzgf6yDih R9YWIdt8rtC5yDCzShZBKk/cMj1oQXzlL8B/gqoaBnFKUrKZ6UAitPpuajjH+drFE3Z9 EQRhFjU20QC9JsP3ipxZ2MpwXlvr2CBCVU9PjY8NZpLyxWUt/9ETpU3qnlXUt7zowSVV Q0VJ23anQ7JNSLPNDPi8QJSXWjJsRknx9fsZzRwySICdSUMAgFhGclgHRvBm4yTtGiJQ weNo3rcqbKwGW0AMfN3YObDVox2cabKaetAtNfRHp6/xKdxG6O1Op9l1JNmSxT+ekvkX vwCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9gS7W7Z0WwlBWedii3T7sv3vHiazgYtexVLo0U5UPps=; b=RPNO1tqi2m6lWx6pghVo9sljG1nT5FAlqiJtlfjN2hB7dtlHyQs/XtXBWk+Jie1103 PVPWtjLUSX0b1qTw5Amb9RVTGpGHYMJAfH0rarbQx0f2ae2rwnFIwlFHD89I/joN3dov r+e3q4BkMCyBvtEiwwXyKw8/8rwZBmQjS7J0R5n6GGFQoJfWc4mIUP4fzdADMXF2DXsF ayqKZjA4sHiu3u3UWA6p0wucWLtGAAfu1kkcC49tO5PtbdZOglcPr6/y7SHCM2V49Qn7 HT2MzMpz2wbeH2RLbGO2XU/XXmvd32V3b2GXh0uGUaKYs7DIpErIx5nZSdSLoAHIP9GE 72aA== X-Gm-Message-State: AHPjjUj+eJNAcqtZSA0jAIKv1d8duwItXwYoGzzyliTIeA6CIjbsO3cc W6UU7CcSF0rygNRl X-Google-Smtp-Source: ADKCNb41Vp1c+lUp5U0ewFewcnJxIGV825/NK174h6X8GiJ1mIDsUgOM3bSKbDXNpAaftEzX2dVozg== X-Received: by 10.98.37.196 with SMTP id l187mr10471618pfl.161.1505103511676; Sun, 10 Sep 2017 21:18:31 -0700 (PDT) Received: from yliu-home ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id g16sm13668629pgn.62.2017.09.10.21.18.27 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Sep 2017 21:18:30 -0700 (PDT) Date: Mon, 11 Sep 2017 12:18:21 +0800 From: Yuanhan Liu To: Maxime Coquelin Cc: dev@dpdk.org, jfreiman@redhat.com, tiwei.bie@intel.com, mst@redhat.com, vkaplans@redhat.com, jasowang@redhat.com Message-ID: <20170911041821.GI9736@yliu-home> References: <20170831095023.21037-1-maxime.coquelin@redhat.com> <20170831095023.21037-22-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170831095023.21037-22-maxime.coquelin@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH 21/21] vhost: iotlb: reduce iotlb read lock usage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 04:18:33 -0000 On Thu, Aug 31, 2017 at 11:50:23AM +0200, Maxime Coquelin wrote: > Prior to this patch, iotlb cache's read/write lock was > read-locked at every guest IOVA to app VA translation, > i.e. at least once per packet with indirect off and twice > with indirect on. > > The problem is that rte_rwlock_read_lock() makes use of atomic > operation, which is costly. > > This patch introduces iotlb lock helpers, so that a full burst > can be protected with taking the lock once, which reduces the > number of atomic operations by up to 64 with indirect > descriptors. You were assuming there is no single miss during a burst. If a miss happens, it requries 2 locks: one for _pending_miss and another one for _pending_insert. From this point of view, it's actually more expensive. However, I won't call it's a bad assumption (for the case of virtio PMD). And if you take this assumption, why not just deleting the pending list and moving the lock outside the _iotlb_find function() like what you did in this patch? I don't really see the point of introducing the pending list. --yliu