linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: X86 ML <x86@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Allison Randal <allison@lohutok.net>,
	Armijn Hemel <armijn@tjaldur.nl>,
	"David S. Miller" <davem@davemloft.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Ingo Molnar <mingo@redhat.com>,
	Kate Stewart <kstewart@linuxfoundation.org>,
	Song Liu <songliubraving@fb.com>,
	Zhengyuan Liu <liuzhengyuan@kylinos.cn>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH 5/7] x86: remove always-defined CONFIG_AS_SSSE3
Date: Tue, 24 Mar 2020 05:44:32 +0900	[thread overview]
Message-ID: <CAK7LNATVAq_Wkv=K-ezwnG=o8a9OoKspZJYOyq+4OXX7EZHPnA@mail.gmail.com> (raw)
In-Reply-To: <CAHmME9p3LAnrUMmcGPEUFqY5vOASe8MVk4=pzqFRj3E9C-bM+Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2068 bytes --]

On Tue, Mar 24, 2020 at 3:06 AM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> On Sun, Mar 22, 2020 at 8:10 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
> > index bf1b4765c8f6..77457ea5a239 100644
> > --- a/lib/raid6/algos.c
> > +++ b/lib/raid6/algos.c
> > @@ -103,9 +103,7 @@ const struct raid6_recov_calls *const raid6_recov_algos[] = {
> >  #ifdef CONFIG_AS_AVX2
> >         &raid6_recov_avx2,
> >  #endif
> > -#ifdef CONFIG_AS_SSSE3
> >         &raid6_recov_ssse3,
> > -#endif
> >  #ifdef CONFIG_S390
> >         &raid6_recov_s390xc,
> >  #endif
>
> algos.c is compiled on all platforms, so you'll need to ifdef that x86
> section where SSSE3 is no longer guarding it. The pattern in the rest
> of the file, if you want to follow it, is "#if defined(__x86_64__) &&
> !defined(__arch_um__)". That seems ugly and like there are better
> ways, but in the interest of uniformity and a lack of desire to
> rewrite all the raid6 code, I went with that in this cleanup:
>
> https://git.zx2c4.com/linux-dev/commit/?h=jd/kconfig-assembler-support&id=512a00ddebbe5294a88487dcf1dc845cf56703d9


Thanks for the pointer,
but I think guarding with CONFIG_X86 makes more sense.

raid6_recov_ssse3 is defined in lib/raid6/recov_ssse3.c,
which is guarded by like this:

raid6_pq-$(CONFIG_X86) += recov_ssse3.o recov_avx2.o mmx.o sse1.o
sse2.o avx2.o avx512.o recov_avx512.o


Indeed,

 #if defined(__x86_64__) && !defined(__arch_um__)

is ugly.


I wonder why the code was written like that.

I rather want to check a single CONFIG option.
Please see the attached patch.




> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/CAHmME9p3LAnrUMmcGPEUFqY5vOASe8MVk4%3DpzqFRj3E9C-bM%2BQ%40mail.gmail.com.



-- 
Best Regards
Masahiro Yamada

[-- Attachment #2: 0001-x86-replace-arch-macros-from-compiler-with-CONFIG_X8.patch --]
[-- Type: text/x-patch, Size: 1586 bytes --]

From 5b32698b09c156479e16f554d1ad027149a6ed05 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <masahiroy@kernel.org>
Date: Tue, 24 Mar 2020 05:25:20 +0900
Subject: [PATCH] x86: replace arch macros from compiler with
 CONFIG_X86_{32,64}

If the intention is to check i386/x86_64 excluding UML,
checking CONFIG_X86_{32,64} is simpler.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
 kernel/signal.c   | 2 +-
 lib/raid6/algos.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 5b2396350dd1..db557e1629e5 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1246,7 +1246,7 @@ static void print_fatal_signal(int signr)
 	struct pt_regs *regs = signal_pt_regs();
 	pr_info("potentially unexpected fatal signal %d.\n", signr);
 
-#if defined(__i386__) && !defined(__arch_um__)
+#ifdef CONFIG_X86_32
 	pr_info("code at %08lx: ", regs->ip);
 	{
 		int i;
diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c
index df08664d3432..b5a02326cfb7 100644
--- a/lib/raid6/algos.c
+++ b/lib/raid6/algos.c
@@ -29,7 +29,7 @@ struct raid6_calls raid6_call;
 EXPORT_SYMBOL_GPL(raid6_call);
 
 const struct raid6_calls * const raid6_algos[] = {
-#if defined(__i386__) && !defined(__arch_um__)
+#ifdef CONFIG_X86_32
 #ifdef CONFIG_AS_AVX512
 	&raid6_avx512x2,
 	&raid6_avx512x1,
@@ -45,7 +45,7 @@ const struct raid6_calls * const raid6_algos[] = {
 	&raid6_mmxx2,
 	&raid6_mmxx1,
 #endif
-#if defined(__x86_64__) && !defined(__arch_um__)
+#ifdef CONFIG_X86_64
 #ifdef CONFIG_AS_AVX512
 	&raid6_avx512x4,
 	&raid6_avx512x2,
-- 
2.17.1


  reply	other threads:[~2020-03-23 20:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  2:08 [PATCH 0/7] x86: remove always-defined CONFIG_AS_* options Masahiro Yamada
2020-03-23  2:08 ` [PATCH 1/7] x86: remove unneeded defined(__ASSEMBLY__) check from asm/dwarf2.h Masahiro Yamada
2020-03-23  2:08 ` [PATCH 2/7] x86: remove always-defined CONFIG_AS_CFI Masahiro Yamada
2020-03-23 20:37   ` Nick Desaulniers
2020-03-23  2:08 ` [PATCH 3/7] x86: remove always-defined CONFIG_AS_CFI_SIGNAL_FRAME Masahiro Yamada
2020-03-23 20:45   ` Nick Desaulniers
2020-03-23  2:08 ` [PATCH 4/7] x86: remove always-defined CONFIG_AS_CFI_SECTIONS Masahiro Yamada
2020-03-23 20:59   ` Nick Desaulniers
2020-03-23  2:08 ` [PATCH 5/7] x86: remove always-defined CONFIG_AS_SSSE3 Masahiro Yamada
2020-03-23 18:06   ` Jason A. Donenfeld
2020-03-23 20:44     ` Masahiro Yamada [this message]
2020-03-23 20:48       ` Jason A. Donenfeld
2020-03-23 21:01         ` Jason A. Donenfeld
2020-03-23  2:08 ` [PATCH 6/7] x86: remove always-defined CONFIG_AS_AVX Masahiro Yamada
2020-03-23  2:08 ` [PATCH 7/7] x86: add comments about the binutils version to support code in as-instr Masahiro Yamada
2020-03-23  4:07 ` [PATCH 0/7] x86: remove always-defined CONFIG_AS_* options Jason A. Donenfeld
2020-03-23  4:28   ` Jason A. Donenfeld
2020-03-23  6:35     ` Masahiro Yamada
2020-03-23  6:53       ` Jason A. Donenfeld
2020-03-23  9:52         ` Sedat Dilek
2020-03-23 19:50           ` Jason A. Donenfeld
2020-03-24  8:46             ` Sedat Dilek
2020-03-23 22:03         ` Masahiro Yamada
2020-03-23 22:10           ` Jason A. Donenfeld
2020-03-23 19:45 ` Nick Desaulniers

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='CAK7LNATVAq_Wkv=K-ezwnG=o8a9OoKspZJYOyq+4OXX7EZHPnA@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=allison@lohutok.net \
    --cc=armijn@tjaldur.nl \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzhengyuan@kylinos.cn \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=songliubraving@fb.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).