Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2589074pxj; Mon, 10 May 2021 06:31:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5NSUcFXxqI9xAbMNafzEQ6beWpDvzw2rFDD4I47HFix7aZqMMgwz0XoQ8cJsW60Igda+5 X-Received: by 2002:a92:c60e:: with SMTP id p14mr20924011ilm.205.1620653479812; Mon, 10 May 2021 06:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620653479; cv=none; d=google.com; s=arc-20160816; b=uRvyKrBUKTIo5TZan+axm/8qw1NaeNwLFtxSlMwi0rd6lLzhIwDQftdI6GHb7JKadp uD2hltflXulJxLx9riLQb+tolbCT0VYjM3LvoAh3Hiz7NtlsnzknASrDlPTfpK3hnNB3 fluQl05geIWgTmSU/soyHlmJTT3+vuJgNqxvJc9ZttLwNqC4peqXY/KtGNkGC4Qc6bqh S4Lc2mIyMHvFYNn8GkftbEWsWlLxj0w+3CSstwNOAFD0c6Ic3nJyccFLTjirVGhZFS8F 6lBYh0BsiOfrt1CfLn6vCzsVUx5ZWh5TJUfGLd/DqepM2XG5CcSkKhKhiKtsHJ8bE2RW 8FqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lOaUfre3jM8UO2SgmVuK8nbotvfgUW+hITZYFEv+rvo=; b=fu/PUu98djyDa033yYuVoxdw5Q8+NfQyC/e00ODbul/UoRHIMWsm07jmhrCWb6jqc3 ZxkRqdBPBBQI/kKOmGzDZc5wnnCOrGdt+XT5w2ldgT9CHvQe8n5QO3hVx6SSiZjBlxJe uqu0LtvBO9jNMgMzqhYQqvvrvaYj3BDO4qjb7eutwMxv/RAMYoRLJ62fIPV6s6QN8BWc KITKB8Na8f0/COh0nXr65ge/SfxyVXeoUb+lkw0ltiXEZnMYgKTNwRMQ3SknTbNhP9Hl FJHITq1rgzLzp4Q22uxBzRgp8LFqtW0ai1mtPtRnsfD/Iqmz4GhoJJb6eiXh9WXx60d4 be8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rVa43gZz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si17447662iow.13.2021.05.10.06.31.06; Mon, 10 May 2021 06:31:19 -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=@kernel.org header.s=k20201202 header.b=rVa43gZz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233595AbhEJNa7 (ORCPT + 99 others); Mon, 10 May 2021 09:30:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241818AbhEJN22 (ORCPT ); Mon, 10 May 2021 09:28:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7376D6147D for ; Mon, 10 May 2021 13:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620653243; bh=rAIhN2kmOvlnwW/jbV0c5jtC6Hz4noTOqD76ZgYWfyY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rVa43gZz5ACpqot6bVMWZDrDaWrKGhatLuA3GNkwUBW4Rh1PRFzV3buZzexyrfwId FJFVn9RznOYtD5kOtJF6HNFDelqPRHeUcHoXZF8WphFdiWReJcmaMAE2l1Gkjwr3vv UHB/SxDP7j1oDqXWmxMWEc8UK5W2sebRSuVLuhqu193YpoP6o8Uf+KrBS/2+CRNpgK jT+aqRToT5eFyXRANfpvgbfpEmE7Q4JMyEbbfwsVEarD26Cs53bxpJu48v3vBA934V t4mk2LUmr60+zGsbZYGnGsPkR6Ujtb+9rp+ZGYJM7qvzaDKHdZB037CgJIgzuxlX22 MJHweK6dcRv8A== Received: by mail-lj1-f170.google.com with SMTP id w15so20772237ljo.10 for ; Mon, 10 May 2021 06:27:23 -0700 (PDT) X-Gm-Message-State: AOAM531NhyXVV9FncH+cy3K0kbxb65uXIJK5C+DU1IXxzSZgkhq5kMGP xWYyEzHimVBUZHFyn561SsjfRJyLqNQfzSlTZCo= X-Received: by 2002:a05:651c:1307:: with SMTP id u7mr19838234lja.498.1620653241673; Mon, 10 May 2021 06:27:21 -0700 (PDT) MIME-Version: 1.0 References: <20210510093753.40683-1-mark.rutland@arm.com> <20210510093753.40683-17-mark.rutland@arm.com> In-Reply-To: <20210510093753.40683-17-mark.rutland@arm.com> From: Guo Ren Date: Mon, 10 May 2021 21:27:10 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 16/33] locking/atomic: csky: move to ARCH_ATOMIC To: Mark Rutland Cc: Linux Kernel Mailing List , Will Deacon , boqun.feng@gmail.com, Peter Zijlstra , Albert Ou , Arnd Bergmann , Brian Cain , Benjamin Herrenschmidt , Chris Zankel , Rich Felker , David Miller , Vincent Chen , Helge Deller , Geert Uytterhoeven , Greentime Hu , Ivan Kokshaysky , "James E.J. Bottomley" , Max Filippov , Jonas Bonn , Ley Foon Tan , Russell King , Matt Turner , Michal Simek , Michael Ellerman , Nick Hu , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Richard Henderson , Stafford Horne , Stefan Kristiansson , Thomas Bogendoerfer , Vineet Gupta , Yoshinori Sato Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 5:41 PM Mark Rutland wrote: > > We'd like all architectures to convert to ARCH_ATOMIC, as once all > architectures are converted it will be possible to make significant > cleanups to the atomics headers, and this will make it much easier to > generically enable atomic functionality (e.g. debug logic in the > instrumented wrappers). > > As a step towards that, this patch migrates csky to ARCH_ATOMIC. The > arch code provides arch_{atomic,atomic64,xchg,cmpxchg}*(), and common > code wraps these with optional instrumentation to provide the regular > functions. > > Signed-off-by: Mark Rutland > Cc: Boqun Feng > Cc: Guo Ren > Cc: Peter Zijlstra > Cc: Will Deacon > --- > arch/csky/Kconfig | 1 + > arch/csky/include/asm/cmpxchg.h | 8 ++++---- > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig > index 8de5b987edb9..3521f14bcd96 100644 > --- a/arch/csky/Kconfig > +++ b/arch/csky/Kconfig > @@ -2,6 +2,7 @@ > config CSKY > def_bool y > select ARCH_32BIT_OFF_T > + select ARCH_ATOMIC > select ARCH_HAS_DMA_PREP_COHERENT > select ARCH_HAS_GCOV_PROFILE_ALL > select ARCH_HAS_SYNC_DMA_FOR_CPU > diff --git a/arch/csky/include/asm/cmpxchg.h b/arch/csky/include/asm/cmpxchg.h > index dabc8e46ce7b..d1bef11f8dc9 100644 > --- a/arch/csky/include/asm/cmpxchg.h > +++ b/arch/csky/include/asm/cmpxchg.h > @@ -31,7 +31,7 @@ extern void __bad_xchg(void); > __ret; \ > }) > > -#define xchg_relaxed(ptr, x) \ > +#define arch_xchg_relaxed(ptr, x) \ > (__xchg_relaxed((x), (ptr), sizeof(*(ptr)))) > > #define __cmpxchg_relaxed(ptr, old, new, size) \ > @@ -61,14 +61,14 @@ extern void __bad_xchg(void); > __ret; \ > }) > > -#define cmpxchg_relaxed(ptr, o, n) \ > +#define arch_cmpxchg_relaxed(ptr, o, n) \ > (__cmpxchg_relaxed((ptr), (o), (n), sizeof(*(ptr)))) > > -#define cmpxchg(ptr, o, n) \ > +#define arch_cmpxchg(ptr, o, n) \ > ({ \ > __typeof__(*(ptr)) __ret; \ > __smp_release_fence(); \ > - __ret = cmpxchg_relaxed(ptr, o, n); \ > + __ret = arch_cmpxchg_relaxed(ptr, o, n); \ > __smp_acquire_fence(); \ > __ret; \ > }) > -- > 2.11.0 > Acked-by: Guo Ren -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/