Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp37223pxb; Wed, 14 Apr 2021 08:54:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmx35lYKiTo6gZpWy3EW2w5YY9ZEEs1bB/L+cjgHjAVNYMpBISYPSseebPx5HqHwvp0jU9 X-Received: by 2002:a17:90b:60a:: with SMTP id gb10mr826399pjb.71.1618415648678; Wed, 14 Apr 2021 08:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618415648; cv=none; d=google.com; s=arc-20160816; b=Po6FsPas/OzlxqairDidONeFhPk1lBkpW+fkkfOfecUypbifRGIn9sHGVX4dCtKXYB 76ijZu7E42H2lA0APH5SrJbX7foKaGWGU7jSFQ5GO3a6sUqpl9N/AP1nKm6sVzb87c0p jVcn17XqHLhLzpW+LcHfj3xgnwcZoK3j6fJyU89EB+uDapxsoInpLFEQqgxAa59t4V0m TyKORoOk7VjyRzmReXm3BXNFneQmUNiUZA/7lr98GGw8na+AqtfPug4e9IowSn5Z7gx+ TG1XSFqR/5sqktNBes6siBxBYhUO3tg4CmFLqB+b57n9vSjtYTEqK7BBK6BRP5C5Orhs Id1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QDlL+offzqBR8/8ljKZKG+TOPSgr5bGaMNneqpmzy3Q=; b=KvfPo4aBX27TYD5AseUl5i05LGN3bLADA+AW3AH+eT67gvCrNSUJ9Utzo9L0niaqSe +5UlcRjUNVrrIsFG7wZ1YU996DC+3QR99k8t50VXNQjoXIopQ6JuqvR+Uy/THWl++V7f /05QwTPUhPGbdg/DnPUPQQQ4wQF1LdUuMJNnTMYbQv5v1uU7xn/tzvrewo6J8nGRJBXP BHYyN57aR8s3uWPEKIJEj4usCQnt0/qL8mG5S/aRDlIFE1GBwMnxTRkcBtU3ZSl6Hl/0 gSHMm9R7TW8Cn9WtZ9TZj65xdrRCmiP8IYCmFRF94vXaHXIQstPTabaEtrDBWfQxvbLl zIGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=gMyW7TA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x12si20603274pgx.371.2021.04.14.08.53.46; Wed, 14 Apr 2021 08:54:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=gMyW7TA5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344284AbhDNMqQ (ORCPT + 99 others); Wed, 14 Apr 2021 08:46:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233671AbhDNMqP (ORCPT ); Wed, 14 Apr 2021 08:46:15 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94728C061574 for ; Wed, 14 Apr 2021 05:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QDlL+offzqBR8/8ljKZKG+TOPSgr5bGaMNneqpmzy3Q=; b=gMyW7TA5Mnl7S70eeXJzae4bD4 PatUg9WGAhao4nhRO91GNw1b9rXEvksVWPhUvNwwUWJ+bYyOyLR+eVont2+XK20jLNQA5Hq5X/5ma hjOq5sP7To3cco8+Z+DGi8bMwR6OWO5ttk3fHqOyyxzfHwryEMVrUm4728vcQCd+3lljcOSCGtbel db6hG/UUEePBMbcHlwErkZPdxv60M7lGa2G18ag/beDBvxYN7Na3hhnjZCNFxhoaRT1x0ElVCYFkS k7gGnhBOMN0emJvMXVNqN7OJG7qLooa0TaD9h6QsLwC4+OmChPFxGDzCHN49hYzCcENFdDhRSCuK/ GrrhQaKg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lWets-00Ccwo-Eh; Wed, 14 Apr 2021 12:45:44 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 88DDF30015A; Wed, 14 Apr 2021 14:45:43 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4DF3F203CF7D2; Wed, 14 Apr 2021 14:45:43 +0200 (CEST) Date: Wed, 14 Apr 2021 14:45:43 +0200 From: Peter Zijlstra To: Guo Ren Cc: Christoph =?iso-8859-1?Q?M=FCllner?= , Palmer Dabbelt , Anup Patel , linux-riscv , Linux Kernel Mailing List , Guo Ren , Catalin Marinas , Will Deacon , Arnd Bergmann , jonas@southpole.se, stefan.kristiansson@saunalahti.fi, shorne@gmail.com Subject: Re: [RFC][PATCH] locking: Generic ticket-lock Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 14, 2021 at 12:16:38PM +0200, Peter Zijlstra wrote: > On Wed, Apr 14, 2021 at 11:05:24AM +0200, Peter Zijlstra wrote: > > > That made me look at the qspinlock code, and queued_spin_*lock() uses > > atomic_try_cmpxchg_acquire(), which means any arch that uses qspinlock > > and has RCpc atomics will give us massive pain. > > > > Current archs using qspinlock are: x86, arm64, power, sparc64, mips and > > openrisc (WTF?!). > > > > Of those, x86 and sparc are TSO archs with SC atomics, arm64 has RCsc > > atomics, power has RCtso atomics (and is the arch we all hate for having > > RCtso locks). > > > > Now MIPS has all sorts of ill specified barriers, but last time looked > > at it it didn't actually use any of that and stuck to using smp_mb(), so > > it will have RCsc atomics. > > > > /me goes look at wth openrisc is.. doesn't even appear to have > > asm/barrier.h :-/ Looking at wikipedia it also doesn't appear to > > actually have hardware ... > > FWIW this is broken, anything SMP *MUST* define mb(), at the very least. As near as I can tell this should do. The arch spec only lists this one instruction and the text makes it sound like a completion barrier. --- arch/openrisc/include/asm/barrier.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/openrisc/include/asm/barrier.h b/arch/openrisc/include/asm/barrier.h new file mode 100644 index 000000000000..7538294721be --- /dev/null +++ b/arch/openrisc/include/asm/barrier.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_BARRIER_H +#define __ASM_BARRIER_H + +#define mb() asm volatile ("l.msync" ::: "memory") + +#include + +#endif /* __ASM_BARRIER_H */