Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2581401imm; Thu, 11 Oct 2018 12:36:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV63zx24uNJqr+4U1ka01p+VBFIRZumjHBNVHYMeO2aP2z5z+YR/laLEu6tqZE3onEHxultOZ X-Received: by 2002:a62:c186:: with SMTP id i128-v6mr2876358pfg.248.1539286561878; Thu, 11 Oct 2018 12:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539286561; cv=none; d=google.com; s=arc-20160816; b=JSMoTF3QbZr9gb5ewo28F/9cU1K08d2X+FSXR96s9cTHSPdFZaSV6Fdzo69DOC6yXs GHTf37oP1Tr1/u8GTbeBaK19VWfRqWWO6xnUjZF2y76e836njneDcAK7mfH1CtgfPe3A x5648UgnYScd3U8k1024705bX+rAmuOuDqLGzNKhPoc5O9ZA8up3+R3nphmibuEAbeJm fZTDQTi/Ecl/+noxIrN5XY4Jr4BgATyRoqk8OAjuv+ypmtKzbe4FWwh3ILXzIU2hoidU 0P7h9C5lfqGDHjAWwB2+SIwMb8KaZP04UdayW3wadc8fkpFPS0cu3sudPiuBe+wFRSIk JNrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=jBDRjc1hBw8XbhqSgaGuzGF2G5EPtfJ0QVEJypPkW7c=; b=X7UiurFtF5zGsn6/oPkejFBaO0qu+bEK9gQNwKoEDSEbiMzPSeou2daaDlVSnGwk5b sp53R1q7BNhtUQWjw+xuK+SJSiYrFxlIiDLXdRHfZ5k21e9CadZtciwjyNPPJyYZBnP7 d3VdkMY+oPfm+L4TwltLkw1a7Y4EEO5jExmp/n2qG9dHkREirCy04PvACdO4JnAIusMA qke64TrTPPNgBy4+WyDKUpStqprc1nj+2Z/CceicgyqyeIPItyCbmhaJssrPzfWJ1OyM EhozyWfm9Mm/LB5OHuU178AXi2EaB0xsO8graKpYl8cM06sdSx2W/1526EynnPQVMlED IUqQ== 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 k3-v6si27378984pgb.72.2018.10.11.12.35.46; Thu, 11 Oct 2018 12:36:01 -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 S1728604AbeJLBkF (ORCPT + 99 others); Thu, 11 Oct 2018 21:40:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbeJLBkF (ORCPT ); Thu, 11 Oct 2018 21:40:05 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6116380F7C; Thu, 11 Oct 2018 18:11:44 +0000 (UTC) Received: from redhat.com (ovpn-122-251.rdu2.redhat.com [10.10.122.251]) by smtp.corp.redhat.com (Postfix) with SMTP id 1F517764F2; Thu, 11 Oct 2018 18:11:43 +0000 (UTC) Date: Thu, 11 Oct 2018 14:11:42 -0400 From: "Michael S. Tsirkin" To: Andres Freund Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, Linus Torvalds , Davidlohr Bueso , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "Paul E. McKenney" , the arch/x86 maintainers , Davidlohr Bueso , virtualization Subject: Re: [PATCH v2 0/3] x86: faster mb()+other barrier.h tweaks Message-ID: <20181011140837-mutt-send-email-mst@kernel.org> References: <1452635935-5439-1-git-send-email-mst@redhat.com> <56957D54.5000602@zytor.com> <20160126101921-mutt-send-email-mst@redhat.com> <20181011173707.26pekp65tlipvhdx@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181011173707.26pekp65tlipvhdx@alap3.anarazel.de> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 11 Oct 2018 18:11:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 10:37:07AM -0700, Andres Freund wrote: > Hi, > > On 2016-01-26 10:20:14 +0200, Michael S. Tsirkin wrote: > > On Tue, Jan 12, 2016 at 02:25:24PM -0800, H. Peter Anvin wrote: > > > On 01/12/16 14:10, Michael S. Tsirkin wrote: > > > > mb() typically uses mfence on modern x86, but a micro-benchmark shows that it's > > > > 2 to 3 times slower than lock; addl $0,(%%e/rsp) that we use on older CPUs. > > > > > > > > So let's use the locked variant everywhere - helps keep the code simple as > > > > well. > > > > > > > > While I was at it, I found some inconsistencies in comments in > > > > arch/x86/include/asm/barrier.h > > > > > > > > I hope I'm not splitting this up too much - the reason is I wanted to isolate > > > > the code changes (that people might want to test for performance) from comment > > > > changes approved by Linus, from (so far unreviewed) comment change I came up > > > > with myself. > > > > > > > > Lightly tested on my system. > > > > > > > > Michael S. Tsirkin (3): > > > > x86: drop mfence in favor of lock+addl > > > > x86: drop a comment left over from X86_OOSTORE > > > > x86: tweak the comment about use of wmb for IO > > > > > > > > > > I would like to get feedback from the hardware team about the > > > implications of this change, first. > > > Any luck getting some feedback on this one? > > Ping? I just saw a bunch of kernel fences in a benchmark, making me > wonder why linux uses mfence rather than lock addl. Leading me to this > thread. > > Greetings, > > Andres Freund It doesn't do it for smp_mb any longer: commit 450cbdd0125cfa5d7bbf9e2a6b6961cc48d29730 Author: Michael S. Tsirkin Date: Fri Oct 27 19:14:31 2017 +0300 locking/x86: Use LOCK ADD for smp_mb() instead of MFENCE I didn't bother with mb() since I didn't think it's performance critical, and one needs to worry about drivers possibly doing non-temporals etc which do need mfence. Do you see mb() in a benchmark then? -- MST