Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp47060imu; Thu, 3 Jan 2019 13:46:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN7IGAeu6WypNmNH7AwJwD4RNvXECAKnlJT7BRpk3qW34dD8Jt6LeR7CxvB0uRiNvzgBMngM X-Received: by 2002:a17:902:6b46:: with SMTP id g6mr48449281plt.21.1546552016768; Thu, 03 Jan 2019 13:46:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546552016; cv=none; d=google.com; s=arc-20160816; b=LXtfgXgpbJbEBn17NmCrPAz1IIWpeziNgRnYEP+WXYA9npJobVLjWQ9dcD3dAmEbDL 9Xt8mK8N1HhBovpA2TADtgMfWubn/90zyxbYjXOnIxotgf649OXxdcGs5dAzX9KQFKJF 1C77qkJAuAt6C2A+kFy7MAVsNXrrloPRl8Tb9sQNjqoobKrcuYwZXQxoeN64Jvqq3PBZ 10nr/jBNqyKW83ImpG1oF0GiQigjjhjLt1rnetGcEbDsG9MV/nw2r7rD+4KShB3mP0Uc CBtXWLxv+eGEUYnsI0Kb/c8TaQsITAFexDBGVVZUtbtjJCASFpiiIKAjglhXtGCbtzG3 9bOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=TpHrl+nFWEWmkIF/68foNA4wO2UsCwCFoVcs+aFEGzA=; b=fkVk/cWat/pfkazb+kNfK/yp9DfszSNjTmwTRud5krNZ9KGfzrbsFWV2TDEfbanYO1 XcOx4YEAfZ4GxbZPof2E7WWp+5/nffUTtwYX/rwVbOmFTudUzGGwg2F/T1dZ0J1Q1OjM FK5vBfi5ByQGvGYuK8l467mrlMHl+OJkJnSjS7NsWS8oC3Rc1g0oqRkf/twGJ7/fjggW px4QmkLGVIbGy2nVF4h+hAyuvPhkDYyIUYCWZbOGcD1wXT1zdsIKcE6nWk8T/IR9nTkK 5atnhoYtaLol8mqLW1qsYZe2s3xBDiDDZ5ysN40O61uhCt63/ZsLTdu5va8lJfXiqsgt xpQw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o127si952917pfo.251.2019.01.03.13.46.42; Thu, 03 Jan 2019 13:46:56 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732169AbfACPLi (ORCPT + 99 others); Thu, 3 Jan 2019 10:11:38 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:50628 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727211AbfACPLf (ORCPT ); Thu, 3 Jan 2019 10:11:35 -0500 Received: (qmail 1644 invoked by uid 2102); 3 Jan 2019 10:11:34 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Jan 2019 10:11:34 -0500 Date: Thu, 3 Jan 2019 10:11:34 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Michael S. Tsirkin" cc: linux-kernel@vger.kernel.org, Jason Wang , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , , , Subject: Re: [PATCH RFC 0/4] barriers using data dependency In-Reply-To: <20190102175247-mutt-send-email-mst@kernel.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Jan 2019, Michael S. Tsirkin wrote: > On Wed, Jan 02, 2019 at 04:36:40PM -0500, Alan Stern wrote: > > On Wed, 2 Jan 2019, Michael S. Tsirkin wrote: > > > > > So as explained in Documentation/memory-barriers.txt e.g. > > > a load followed by a store require a full memory barrier, > > > to avoid store being ordered before the load. > > > Similarly load-load requires a read memory barrier. > > > > > > Thinking about it, we can actually create a data dependency > > > by mixing the first loaded value into the pointer being > > > accessed. > > > > > > This adds an API for this and uses it in virtio. > > > > > > Written over the holiday and build tested only so far. > > > > You are using the terminology from memory-barriers.txt, referring to > > the new dependency you create as a data dependency. However, > > tools/memory-model/* uses a more precise name, calling it an address > > dependency. Could you change the comments in the patches to use this > > name instead? > > Sure, sounds good. While I'm at it, should memory-barriers.txt be > switched over too? If you want to take care of that, great! I never seem to get around to doing it. > > > This patchset is also suboptimal on e.g. x86 where e.g. smp_rmb is a nop. > > > > This should be easy to fix with an architecture-specific override. > > > > Alan Stern > > Absolutely. It does however mean that we'll need several > variants: mb/rmb, smp/dma/virt/mandatory. > > I am still trying to decide whether it's good since it documents the > kind of barrier that we are trying to use - or bad since it's more > verbose and makes you choose one where they are all pretty cheap. How many places can these things be used? My guess is not very many, or at least, there aren't very many different _types_ of usage. So start only with variants you know will be used. More can be added later if we want. Alan Stern