All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double
@ 2018-09-28  8:33 Uros Bizjak
  2018-10-01 10:28 ` Borislav Petkov
  2018-10-01 11:54 ` [tip:x86/asm] x86/asm: Use CC_SET()/CC_OUT() in __cmpxchg_double() tip-bot for Uros Bizjak
  0 siblings, 2 replies; 6+ messages in thread
From: Uros Bizjak @ 2018-09-28  8:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

Remove open-coded uses of set instructions to use CC_SET()/CC_OUT()
for __cmpxchg_double.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
 arch/x86/include/asm/cmpxchg.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index a55d79b233d3..bfb85e5844ab 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -242,10 +242,12 @@ extern void __add_wrong_size(void)
        BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long));                    \
        VM_BUG_ON((unsigned long)(p1) % (2 * sizeof(long)));            \
        VM_BUG_ON((unsigned long)((p1) + 1) != (unsigned long)(p2));    \
-       asm volatile(pfx "cmpxchg%c4b %2; sete %0"                      \
-                    : "=a" (__ret), "+d" (__old2),                     \
-                      "+m" (*(p1)), "+m" (*(p2))                       \
-                    : "i" (2 * sizeof(long)), "a" (__old1),            \
+       asm volatile(pfx "cmpxchg%c5b %1"                               \
+                    CC_SET(e)                                          \
+                    : CC_OUT(e) (__ret),                               \
+                      "+m" (*(p1)), "+m" (*(p2)),                      \
+                      "+a" (__old1), "+d" (__old2)                     \
+                    : "i" (2 * sizeof(long)),                          \
                       "b" (__new1), "c" (__new2));                     \
        __ret;                                                          \
 })
--
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double
  2018-09-28  8:33 [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double Uros Bizjak
@ 2018-10-01 10:28 ` Borislav Petkov
  2018-10-01 11:03   ` Uros Bizjak
  2018-10-01 11:54 ` [tip:x86/asm] x86/asm: Use CC_SET()/CC_OUT() in __cmpxchg_double() tip-bot for Uros Bizjak
  1 sibling, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2018-10-01 10:28 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

On Fri, Sep 28, 2018 at 10:33:05AM +0200, Uros Bizjak wrote:
> Remove open-coded uses of set instructions to use CC_SET()/CC_OUT()
> for __cmpxchg_double.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> ---
>  arch/x86/include/asm/cmpxchg.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
> index a55d79b233d3..bfb85e5844ab 100644
> --- a/arch/x86/include/asm/cmpxchg.h
> +++ b/arch/x86/include/asm/cmpxchg.h
> @@ -242,10 +242,12 @@ extern void __add_wrong_size(void)
>         BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long));                    \
>         VM_BUG_ON((unsigned long)(p1) % (2 * sizeof(long)));            \
>         VM_BUG_ON((unsigned long)((p1) + 1) != (unsigned long)(p2));    \
> -       asm volatile(pfx "cmpxchg%c4b %2; sete %0"                      \
> -                    : "=a" (__ret), "+d" (__old2),                     \
> -                      "+m" (*(p1)), "+m" (*(p2))                       \
> -                    : "i" (2 * sizeof(long)), "a" (__old1),            \
> +       asm volatile(pfx "cmpxchg%c5b %1"                               \
> +                    CC_SET(e)                                          \
> +                    : CC_OUT(e) (__ret),                               \
> +                      "+m" (*(p1)), "+m" (*(p2)),                      \
> +                      "+a" (__old1), "+d" (__old2)                     \
> +                    : "i" (2 * sizeof(long)),                          \

To quote checkpatch:

WARNING: please, no spaces at the start of a line
#34: FILE: arch/x86/include/asm/cmpxchg.h:245:
+       asm volatile(pfx "cmpxchg%c5b %1"                               \$

ERROR: code indent should use tabs where possible
#35: FILE: arch/x86/include/asm/cmpxchg.h:246:
+                    CC_SET(e)                                          \$

WARNING: please, no spaces at the start of a line
#35: FILE: arch/x86/include/asm/cmpxchg.h:246:
+                    CC_SET(e)                                          \$

ERROR: code indent should use tabs where possible
#36: FILE: arch/x86/include/asm/cmpxchg.h:247:
+                    : CC_OUT(e) (__ret),                               \$


...

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double
  2018-10-01 10:28 ` Borislav Petkov
@ 2018-10-01 11:03   ` Uros Bizjak
  2018-10-01 11:35     ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Uros Bizjak @ 2018-10-01 11:03 UTC (permalink / raw)
  To: bp; +Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

On Mon, Oct 1, 2018 at 12:28 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Fri, Sep 28, 2018 at 10:33:05AM +0200, Uros Bizjak wrote:
> > Remove open-coded uses of set instructions to use CC_SET()/CC_OUT()
> > for __cmpxchg_double.
> >
> > Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> > ---
> >  arch/x86/include/asm/cmpxchg.h | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
> > index a55d79b233d3..bfb85e5844ab 100644
> > --- a/arch/x86/include/asm/cmpxchg.h
> > +++ b/arch/x86/include/asm/cmpxchg.h
> > @@ -242,10 +242,12 @@ extern void __add_wrong_size(void)
> >         BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long));                    \
> >         VM_BUG_ON((unsigned long)(p1) % (2 * sizeof(long)));            \
> >         VM_BUG_ON((unsigned long)((p1) + 1) != (unsigned long)(p2));    \
> > -       asm volatile(pfx "cmpxchg%c4b %2; sete %0"                      \
> > -                    : "=a" (__ret), "+d" (__old2),                     \
> > -                      "+m" (*(p1)), "+m" (*(p2))                       \
> > -                    : "i" (2 * sizeof(long)), "a" (__old1),            \
> > +       asm volatile(pfx "cmpxchg%c5b %1"                               \
> > +                    CC_SET(e)                                          \
> > +                    : CC_OUT(e) (__ret),                               \
> > +                      "+m" (*(p1)), "+m" (*(p2)),                      \
> > +                      "+a" (__old1), "+d" (__old2)                     \
> > +                    : "i" (2 * sizeof(long)),                          \
>
> To quote checkpatch:

Looks like gmail forward mangled whitespace. The original, archived at
Patchwork [1] passes checkpatch without problems.

[1] https://mail.google.com/mail/u/0/#inbox/LXphbRLrghxkrJptDWnbbJcrVBkBsRQgcnbtRLjbGSq

Uros.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double
  2018-10-01 11:03   ` Uros Bizjak
@ 2018-10-01 11:35     ` Borislav Petkov
  2018-10-01 11:40       ` Uros Bizjak
  0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2018-10-01 11:35 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

On Mon, Oct 01, 2018 at 01:03:47PM +0200, Uros Bizjak wrote:
> Looks like gmail forward mangled whitespace. The original, archived at
> Patchwork [1] passes checkpatch without problems.
> 
> [1] https://mail.google.com/mail/u/0/#inbox/LXphbRLrghxkrJptDWnbbJcrVBkBsRQgcnbtRLjbGSq

This is a gmail link *into* your inbox?!?!

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double
  2018-10-01 11:35     ` Borislav Petkov
@ 2018-10-01 11:40       ` Uros Bizjak
  0 siblings, 0 replies; 6+ messages in thread
From: Uros Bizjak @ 2018-10-01 11:40 UTC (permalink / raw)
  To: bp; +Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin

On Mon, Oct 1, 2018 at 1:35 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Mon, Oct 01, 2018 at 01:03:47PM +0200, Uros Bizjak wrote:
> > Looks like gmail forward mangled whitespace. The original, archived at
> > Patchwork [1] passes checkpatch without problems.
> >
> > [1] https://mail.google.com/mail/u/0/#inbox/LXphbRLrghxkrJptDWnbbJcrVBkBsRQgcnbtRLjbGSq
>
> This is a gmail link *into* your inbox?!?!

I don't know how I managed to copy and paste the wrong link :( Here is
the correct one:

https://lore.kernel.org/patchwork/patch/975764/

Uros.
Uros.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:x86/asm] x86/asm: Use CC_SET()/CC_OUT() in __cmpxchg_double()
  2018-09-28  8:33 [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double Uros Bizjak
  2018-10-01 10:28 ` Borislav Petkov
@ 2018-10-01 11:54 ` tip-bot for Uros Bizjak
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Uros Bizjak @ 2018-10-01 11:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: bp, linux-kernel, tglx, ubizjak, mingo, hpa

Commit-ID:  c808c09b527cd60d9a0d53799935f75e2452174d
Gitweb:     https://git.kernel.org/tip/c808c09b527cd60d9a0d53799935f75e2452174d
Author:     Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Fri, 28 Sep 2018 10:33:05 +0200
Committer:  Borislav Petkov <bp@suse.de>
CommitDate: Mon, 1 Oct 2018 13:46:32 +0200

x86/asm: Use CC_SET()/CC_OUT() in __cmpxchg_double()

Replace open-coded use of the SETcc instruction with CC_SET()/CC_OUT()
in __cmpxchg_double().

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lkml.kernel.org/r/CAFULd4YdvwwhXWHqqPsGk5+TLG71ozgSscTZNsqmrm+Jzg941w@mail.gmail.com
---
 arch/x86/include/asm/cmpxchg.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index a55d79b233d3..bfb85e5844ab 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -242,10 +242,12 @@ extern void __add_wrong_size(void)
 	BUILD_BUG_ON(sizeof(*(p2)) != sizeof(long));			\
 	VM_BUG_ON((unsigned long)(p1) % (2 * sizeof(long)));		\
 	VM_BUG_ON((unsigned long)((p1) + 1) != (unsigned long)(p2));	\
-	asm volatile(pfx "cmpxchg%c4b %2; sete %0"			\
-		     : "=a" (__ret), "+d" (__old2),			\
-		       "+m" (*(p1)), "+m" (*(p2))			\
-		     : "i" (2 * sizeof(long)), "a" (__old1),		\
+	asm volatile(pfx "cmpxchg%c5b %1"				\
+		     CC_SET(e)						\
+		     : CC_OUT(e) (__ret),				\
+		       "+m" (*(p1)), "+m" (*(p2)),			\
+		       "+a" (__old1), "+d" (__old2)			\
+		     : "i" (2 * sizeof(long)),				\
 		       "b" (__new1), "c" (__new2));			\
 	__ret;								\
 })

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-01 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28  8:33 [PATCH resend] x86, asm: Use CC_SET()/CC_OUT() for __cmpxchg_double Uros Bizjak
2018-10-01 10:28 ` Borislav Petkov
2018-10-01 11:03   ` Uros Bizjak
2018-10-01 11:35     ` Borislav Petkov
2018-10-01 11:40       ` Uros Bizjak
2018-10-01 11:54 ` [tip:x86/asm] x86/asm: Use CC_SET()/CC_OUT() in __cmpxchg_double() tip-bot for Uros Bizjak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.