Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6248592ybv; Wed, 12 Feb 2020 08:39:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwuInlaVhPBOASsOvepXGw5OnuKJTaAPTVMURPtxWMZfS8TIQ1yfbm+iwXJfvYRNNYIQMNn X-Received: by 2002:a05:6830:612:: with SMTP id w18mr10147236oti.160.1581525541997; Wed, 12 Feb 2020 08:39:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581525541; cv=none; d=google.com; s=arc-20160816; b=1BDgZprDd7pag2hSz9CBKipiYp5z0RuiOj2pLBMmd/9cZSFyPAqPfb+8izleaxHCm8 1hw9BeLSARdTpEf+Kt0xjGscJnhU10bSfCPxXQeXZnAR/7sS1AKpLb/GuL4MLS9YWjgb ywSOaGcXJlj5SbUIhTuL9G/llLOKmsu1fNg0fAJa/+3/i0dZwi4W/3EyIK5KF7S420pk T27gpjz2et2tsLyNUJa4EVQNlAWoCWIiDDxfA2YqlAqtsM2AXK0s2IpuPIuyjPZoLg5b xFNNpGP6QxaJRXBtWBcR/gnsUsxXzBU7iqx3w67sC2tXo+Jeoj1HYu4+FFqn0ng/RC8O xcXg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PM+7PJ6Z7kS+rPQtWGRINgob1poar/Cfo5GEs5f/tg0=; b=FOGnrES+2nXK4uACRenR6mF7GK1g4vipN9tSRg4loa9m0zyC6SuVu21s/14ckqWfEP KoaBYGliRmbttomtFxJumDZimVgjW0Bel7+yIh3dlUMFu0S+REd88oj6n1IQwfB+oPbO oTmMVhkQe1dKl6q8P1wRZPlOIq5gkPqiPqeW8ndGopW587k7UUm36HmaVkoiOwh6lfq9 VXKHEh1YT8RcsyQNknlZk2uCXGmILrQq6SYd+LjZ4HwgIhfURgUu4c/e8VZ++Nt94Q3+ APedCdLOxqJfNaLa8bajxFuNEpmdh52B9OXxPhz0CSs1QW40VnxMjiMeZpI6/fZEMbSj MumA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nzIrN17S; 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 b10si423508otp.124.2020.02.12.08.38.45; Wed, 12 Feb 2020 08:39:01 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nzIrN17S; 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 S1728098AbgBLQiL (ORCPT + 99 others); Wed, 12 Feb 2020 11:38:11 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35512 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727439AbgBLQiK (ORCPT ); Wed, 12 Feb 2020 11:38:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; 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=PM+7PJ6Z7kS+rPQtWGRINgob1poar/Cfo5GEs5f/tg0=; b=nzIrN17SVPRIuHkkfn8v2yCVY1 XSIFGa89nuFKxhpDtW2pDOEAkiBFTxxjqUH0mi+jYzLpgEA604cWCXwqsxLVm+ErTB6m6NIXVhYDS kc9nbfVGz+pUb8XMXh+NRluBL2FW9TeKlhQp/cWGgQpT8rnwldCFSqVceQQq8kqf4hqBA/b+KnRBR MVTwVWQMVQjJ+r1MTreZkToSdC9pHKboXKX/NT7+2MSxw48a1HloDBf+zbLN//3J/c39dFxRLBPLC 8CrWwCfKwwzRNBivpmbzq9CElNV8tXnRsqFi4lIMq+fMzFOREkl31Mjv8VKFhp8L2UkL0tENtUOCb WBO/4o3Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1v1X-0003Re-Gn; Wed, 12 Feb 2020 16:38:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 549E6300235; Wed, 12 Feb 2020 17:36:11 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 86BD92038B228; Wed, 12 Feb 2020 17:38:00 +0100 (CET) Date: Wed, 12 Feb 2020 17:38:00 +0100 From: Peter Zijlstra To: Michal Simek Cc: linux-kernel@vger.kernel.org, monstr@monstr.eu, git@xilinx.com, arnd@arndb.de, Allison Randal , Andrew Morton , Boqun Feng , Enrico Weigelt , Greg Kroah-Hartman , Ingo Molnar , Kate Stewart , Masahiro Yamada , Mike Rapoport , Shubhrajyoti Datta , Stefan Asserhall , Thomas Gleixner , Will Deacon Subject: Re: [PATCH 0/7] microblaze: Define SMP safe operations Message-ID: <20200212163800.GY14946@hirez.programming.kicks-ass.net> References: <20200212160852.GC14973@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200212160852.GC14973@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 12, 2020 at 05:08:52PM +0100, Peter Zijlstra wrote: > On Wed, Feb 12, 2020 at 04:42:22PM +0100, Michal Simek wrote: > > > Microblaze has 32bit exclusive load/store instructions which should be used > > instead of irq enable/disable. For more information take a look at > > https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_2/ug984-vivado-microblaze-ref.pdf > > starting from page 25. > > > arch/microblaze/include/asm/Kbuild | 1 - > > arch/microblaze/include/asm/atomic.h | 265 ++++++++++++++++++- > > arch/microblaze/include/asm/bitops.h | 189 +++++++++++++ > > arch/microblaze/include/asm/cmpxchg.h | 87 ++++++ > > arch/microblaze/include/asm/cpuinfo.h | 2 +- > > arch/microblaze/include/asm/pgtable.h | 19 +- > > arch/microblaze/include/asm/spinlock.h | 240 +++++++++++++++++ > > arch/microblaze/include/asm/spinlock_types.h | 25 ++ > > arch/microblaze/kernel/cpu/cache.c | 154 ++++++----- > > arch/microblaze/kernel/cpu/cpuinfo.c | 38 ++- > > arch/microblaze/kernel/cpu/mb.c | 207 ++++++++------- > > arch/microblaze/kernel/timer.c | 2 +- > > arch/microblaze/mm/consistent.c | 8 +- > > 13 files changed, 1040 insertions(+), 197 deletions(-) > > create mode 100644 arch/microblaze/include/asm/bitops.h > > create mode 100644 arch/microblaze/include/asm/spinlock.h > > create mode 100644 arch/microblaze/include/asm/spinlock_types.h > > I'm missing asm/barrier.h > > Also that PDF (thanks for that!), seems light on memory ordering > details. > > Your comment: > > +/* > + * clear_bit doesn't imply a memory barrier > + */ > > worries me, because that would imply your ll/sc does not impose order, > but then you also don't have any explicit barriers in your locking > primitives or atomics where required. > > In the PDF I only find MBAR; is that what smp_mb() ends up being? Bah, I'm sure I did patches at some point that made asm-generic/barrier.h #error if you didn't define at least one memory barrier on CONFIG_SMP, but it seems that all got lost somewhere.