linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: Heiko Stuebner <heiko@sntech.de>
Cc: linux-riscv@lists.infradead.org, palmer@dabbelt.com,
	 paul.walmsley@sifive.com, linux-kernel@vger.kernel.org,
	christoph.muellner@vrull.eu,  David.Laight@aculab.com,
	Heiko Stuebner <heiko.stuebner@vrull.eu>
Subject: Re: [PATCH v3 1/2] riscv: don't include kernel.h into alternative.h
Date: Wed, 24 May 2023 16:01:50 +0200	[thread overview]
Message-ID: <20230524-1ae0ba16b93b71a150320a6d@orel> (raw)
In-Reply-To: <20230521114715.955823-2-heiko.stuebner@vrull.eu>

On Sun, May 21, 2023 at 01:47:14PM +0200, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@vrull.eu>
> 
> This include is not currently needed for alternatives and creates
> possible issues when we want to add alternatives to deeper kernel
> infrastructure.
> 
> The issue in question came from trying to introduce Zawrs alternatives,
> which resulted in a somewhat circular dependency like:
> 
> In file included from ../include/linux/bitops.h:34,
>                  from ../include/linux/kernel.h:22,
>                  from ../arch/riscv/include/asm/alternative.h:16,
>                  from ../arch/riscv/include/asm/errata_list.h:8,
>                  from ../arch/riscv/include/asm/barrier.h:15,
>                  from ../include/linux/list.h:11,
>                  from ../include/linux/preempt.h:11,
>                  from ../include/linux/spinlock.h:56,
>                  from ../include/linux/mmzone.h:8,
>                  from ../include/linux/gfp.h:7,
>                  from ../include/linux/mm.h:7,
>                  from ../arch/riscv/kernel/asm-offsets.c:10:
> ../include/asm-generic/bitops/generic-non-atomic.h: In function ‘generic_test_bit_acquire’:
> ../include/asm-generic/bitops/generic-non-atomic.h:140:23: error: implicit declaration of function ‘smp_load_acquire’ [-Werror=implicit-function-declaration]
>   140 |         return 1UL & (smp_load_acquire(p) >> (nr & (BITS_PER_LONG-1)));
>       |                       ^~~~~~~~~~~~~~~~
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@vrull.eu>
> ---
>  arch/riscv/include/asm/alternative.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/alternative.h b/arch/riscv/include/asm/alternative.h
> index 6a41537826a7..05885de6048c 100644
> --- a/arch/riscv/include/asm/alternative.h
> +++ b/arch/riscv/include/asm/alternative.h
> @@ -13,7 +13,6 @@
>  #ifdef CONFIG_RISCV_ALTERNATIVE
>  
>  #include <linux/init.h>
> -#include <linux/kernel.h>
>  #include <linux/types.h>
>  #include <linux/stddef.h>
>  #include <asm/hwcap.h>
> -- 
> 2.39.0
>

Removing this include doesn't break compilation because the only callers
of PATCH_ID_CPUFEATURE_ID() and PATCH_ID_CPUFEATURE_VALUE(), which are
defined with lower/upper_16_bits(), are in arch/riscv/kernel/cpufeature.c,
which includes at least one thing which eventually includes linux/kernel.h
(the first path I found was linux/module.h -> linux/moduleparam.h ->
linux/kernel.h). Ideally we wouldn't rely on that luck. We can open
code the PATCH_ID_* macros to drop the lower/upper_16_bits() dependencies
or move the macros elsewhere, maybe, for now, just to
arch/riscv/kernel/cpufeature.c

Thanks,
drew

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-05-24 14:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-21 11:47 [PATCH v3 0/2] Add Zawrs support and use it for spinlocks Heiko Stuebner
2023-05-21 11:47 ` [PATCH v3 1/2] riscv: don't include kernel.h into alternative.h Heiko Stuebner
2023-05-24 14:01   ` Andrew Jones [this message]
2023-05-21 11:47 ` [PATCH v3 2/2] riscv: Add Zawrs support for spinlocks Heiko Stuebner
2023-05-22 17:43   ` Conor Dooley
2023-05-24 17:05   ` Andrew Jones
2023-05-24 23:00     ` Palmer Dabbelt
2023-05-30 18:45       ` Andrea Parri
2023-10-19 14:21 ` [PATCH v3 0/2] Add Zawrs support and use it " Andrea Parri
2023-10-19 16:22   ` Christoph Müllner
2023-10-20 10:19     ` Andrea Parri
2024-01-08 11:35       ` Andrew Jones
2024-01-08 13:38         ` Andrea Parri
2024-01-08 14:00         ` Christoph Müllner
2024-01-08 14:10           ` Andrew Jones
2024-03-05 23:31             ` Charlie Jenkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230524-1ae0ba16b93b71a150320a6d@orel \
    --to=ajones@ventanamicro.com \
    --cc=David.Laight@aculab.com \
    --cc=christoph.muellner@vrull.eu \
    --cc=heiko.stuebner@vrull.eu \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).