* [PATCH 0/2] x86: Use "er" asm constriant for add/sub
@ 2026-08-03 9:47 David Laight
2026-08-03 9:47 ` [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants David Laight
` (3 more replies)
0 siblings, 4 replies; 22+ messages in thread
From: David Laight @ 2026-08-03 9:47 UTC (permalink / raw)
To: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel
Cc: David Laight, Nicolas Pitre, H. Peter Anvin, Peter Zijlstra,
Uwe Kleine-König, rodrigo.alencar, jic23
The x86 instruction set only supports 32bit signed immediate values
for add/sub.
Replace the "ir" constraint with "er" to avoid build errors.
Found by a patch that added used mul_u64_add_u64_div_u64() to
do a rounding divide by 2^32 (perhaps not the best way to do this).
A quick grep only found one other affected file.
David Laight (2):
lib: mul_u64_add_u64_div_u64: Fix addition of large constants
x86/local: local_add/local_sub: Support large immediate values
arch/x86/include/asm/div64.h | 2 +-
arch/x86/include/asm/local.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants
2026-08-03 9:47 [PATCH 0/2] x86: Use "er" asm constriant for add/sub David Laight
@ 2026-08-03 9:47 ` David Laight
2026-08-03 10:08 ` H. Peter Anvin
2026-09-10 18:00 ` [tip: x86/urgent] x86/div64: Fix addition of large constants in mul_u64_add_u64_div_u64() tip-bot2 for David Laight
2026-08-03 9:47 ` [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values David Laight
` (2 subsequent siblings)
3 siblings, 2 replies; 22+ messages in thread
From: David Laight @ 2026-08-03 9:47 UTC (permalink / raw)
To: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel
Cc: David Laight, Nicolas Pitre, H. Peter Anvin, Peter Zijlstra,
Uwe Kleine-König, rodrigo.alencar, jic23
Adding constants over 2^31 fails to compile because the ADD instruction
only supports 32bit signed immediates.
Replace the "irm" constraint with "erm" so that the compiler loads
large constants into a register.
Found by a patch to drivers/iio/frequency/ad9910.c
Fixes: 6480241f31f5 ("lib: add mul_u64_add_u64_div_u64() and mul_u64_u64_div_u64_roundup()")
Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
arch/x86/include/asm/div64.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h
index 30fd06ede751..8a2d343f977e 100644
--- a/arch/x86/include/asm/div64.h
+++ b/arch/x86/include/asm/div64.h
@@ -111,7 +111,7 @@ static inline u64 mul_u64_add_u64_div_u64(u64 rax, u64 mul, u64 add, u64 div)
if (!statically_true(!add))
asm ("addq %[add], %[lo]; adcq $0, %[hi]" :
- [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "irm" (add));
+ [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "erm" (add));
asm ("divq %[div]" : "+a" (rax), "+d" (rdx) : [div] "rm" (div));
--
2.39.5
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values
2026-08-03 9:47 [PATCH 0/2] x86: Use "er" asm constriant for add/sub David Laight
2026-08-03 9:47 ` [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants David Laight
@ 2026-08-03 9:47 ` David Laight
2026-08-03 10:01 ` Peter Zijlstra
2026-08-03 10:07 ` H. Peter Anvin
2026-08-03 9:59 ` [PATCH 0/2] x86: Use "er" asm constriant for add/sub Peter Zijlstra
2026-08-03 14:49 ` Nicolas Pitre
3 siblings, 2 replies; 22+ messages in thread
From: David Laight @ 2026-08-03 9:47 UTC (permalink / raw)
To: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel
Cc: David Laight, Nicolas Pitre, H. Peter Anvin, Peter Zijlstra,
Uwe Kleine-König, rodrigo.alencar, jic23
Replace the "ir" constraint with "er" so that constants over 2^31
get loaded into a register.
Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
arch/x86/include/asm/local.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
index 4957018fef3e..68af7b74450a 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -32,14 +32,14 @@ static inline void local_add(long i, local_t *l)
{
asm volatile(_ASM_ADD "%1,%0"
: "+m" (l->a.counter)
- : "ir" (i));
+ : "er" (i));
}
static inline void local_sub(long i, local_t *l)
{
asm volatile(_ASM_SUB "%1,%0"
: "+m" (l->a.counter)
- : "ir" (i));
+ : "er" (i));
}
/**
--
2.39.5
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-08-03 9:47 [PATCH 0/2] x86: Use "er" asm constriant for add/sub David Laight
2026-08-03 9:47 ` [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants David Laight
2026-08-03 9:47 ` [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values David Laight
@ 2026-08-03 9:59 ` Peter Zijlstra
2026-08-03 14:49 ` Nicolas Pitre
3 siblings, 0 replies; 22+ messages in thread
From: Peter Zijlstra @ 2026-08-03 9:59 UTC (permalink / raw)
To: David Laight
Cc: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel, Nicolas Pitre, H. Peter Anvin,
Uwe Kleine-König, rodrigo.alencar, jic23
On Mon, Aug 03, 2026 at 10:47:00AM +0100, David Laight wrote:
> The x86 instruction set only supports 32bit signed immediate values
> for add/sub.
> Replace the "ir" constraint with "er" to avoid build errors.
>
> Found by a patch that added used mul_u64_add_u64_div_u64() to
> do a rounding divide by 2^32 (perhaps not the best way to do this).
>
> A quick grep only found one other affected file.
I suppose the percpu stuff works because of __pcpu_cast_4 truncating the
value to u32 and then ignoring the whole signed/unsigned business. And
__pcpu_reg_imm_8 has "re".
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values
2026-08-03 9:47 ` [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values David Laight
@ 2026-08-03 10:01 ` Peter Zijlstra
2026-08-03 10:07 ` H. Peter Anvin
1 sibling, 0 replies; 22+ messages in thread
From: Peter Zijlstra @ 2026-08-03 10:01 UTC (permalink / raw)
To: David Laight
Cc: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel, Nicolas Pitre, H. Peter Anvin,
Uwe Kleine-König, rodrigo.alencar, jic23
On Mon, Aug 03, 2026 at 10:47:02AM +0100, David Laight wrote:
> Replace the "ir" constraint with "er" so that constants over 2^31
> get loaded into a register.
>
> Signed-off-by: David Laight <david.laight.linux@gmail.com>
> ---
> arch/x86/include/asm/local.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
> index 4957018fef3e..68af7b74450a 100644
> --- a/arch/x86/include/asm/local.h
> +++ b/arch/x86/include/asm/local.h
> @@ -32,14 +32,14 @@ static inline void local_add(long i, local_t *l)
> {
> asm volatile(_ASM_ADD "%1,%0"
> : "+m" (l->a.counter)
> - : "ir" (i));
> + : "er" (i));
> }
>
> static inline void local_sub(long i, local_t *l)
> {
> asm volatile(_ASM_SUB "%1,%0"
> : "+m" (l->a.counter)
> - : "ir" (i));
> + : "er" (i));
> }
And the other two sites already have "er", how inconsistent :/
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values
2026-08-03 9:47 ` [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values David Laight
2026-08-03 10:01 ` Peter Zijlstra
@ 2026-08-03 10:07 ` H. Peter Anvin
1 sibling, 0 replies; 22+ messages in thread
From: H. Peter Anvin @ 2026-08-03 10:07 UTC (permalink / raw)
To: David Laight, Borislav Betkov, Ingo Molnar, Thomas Gleinxer,
Dave Hansen, x86, Andrew Morton, linux-kernel
Cc: Nicolas Pitre, Peter Zijlstra, Uwe Kleine-König,
rodrigo.alencar, jic23
On 2026-08-03 02:47, David Laight wrote:
> Replace the "ir" constraint with "er" so that constants over 2^31
> get loaded into a register.
>
> Signed-off-by: David Laight <david.laight.linux@gmail.com>
Yep, that's right.
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
> ---
> arch/x86/include/asm/local.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
> index 4957018fef3e..68af7b74450a 100644
> --- a/arch/x86/include/asm/local.h
> +++ b/arch/x86/include/asm/local.h
> @@ -32,14 +32,14 @@ static inline void local_add(long i, local_t *l)
> {
> asm volatile(_ASM_ADD "%1,%0"
> : "+m" (l->a.counter)
> - : "ir" (i));
> + : "er" (i));
> }
>
> static inline void local_sub(long i, local_t *l)
> {
> asm volatile(_ASM_SUB "%1,%0"
> : "+m" (l->a.counter)
> - : "ir" (i));
> + : "er" (i));
> }
>
> /**
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants
2026-08-03 9:47 ` [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants David Laight
@ 2026-08-03 10:08 ` H. Peter Anvin
2026-09-10 18:00 ` [tip: x86/urgent] x86/div64: Fix addition of large constants in mul_u64_add_u64_div_u64() tip-bot2 for David Laight
1 sibling, 0 replies; 22+ messages in thread
From: H. Peter Anvin @ 2026-08-03 10:08 UTC (permalink / raw)
To: David Laight, Borislav Betkov, Ingo Molnar, Thomas Gleinxer,
Dave Hansen, x86, Andrew Morton, linux-kernel
Cc: Nicolas Pitre, Peter Zijlstra, Uwe Kleine-König,
rodrigo.alencar, jic23
On 2026-08-03 02:47, David Laight wrote:
> Adding constants over 2^31 fails to compile because the ADD instruction
> only supports 32bit signed immediates.
>
> Replace the "irm" constraint with "erm" so that the compiler loads
> large constants into a register.
>
> Found by a patch to drivers/iio/frequency/ad9910.c
>
> Fixes: 6480241f31f5 ("lib: add mul_u64_add_u64_div_u64() and mul_u64_u64_div_u64_roundup()")
> Signed-off-by: David Laight <david.laight.linux@gmail.com>
So it is.
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
> ---
> arch/x86/include/asm/div64.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h
> index 30fd06ede751..8a2d343f977e 100644
> --- a/arch/x86/include/asm/div64.h
> +++ b/arch/x86/include/asm/div64.h
> @@ -111,7 +111,7 @@ static inline u64 mul_u64_add_u64_div_u64(u64 rax, u64 mul, u64 add, u64 div)
>
> if (!statically_true(!add))
> asm ("addq %[add], %[lo]; adcq $0, %[hi]" :
> - [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "irm" (add));
> + [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "erm" (add));
>
> asm ("divq %[div]" : "+a" (rax), "+d" (rdx) : [div] "rm" (div));
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-08-03 9:47 [PATCH 0/2] x86: Use "er" asm constriant for add/sub David Laight
` (2 preceding siblings ...)
2026-08-03 9:59 ` [PATCH 0/2] x86: Use "er" asm constriant for add/sub Peter Zijlstra
@ 2026-08-03 14:49 ` Nicolas Pitre
2026-08-03 15:39 ` David Laight
3 siblings, 1 reply; 22+ messages in thread
From: Nicolas Pitre @ 2026-08-03 14:49 UTC (permalink / raw)
To: David Laight
Cc: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel, H. Peter Anvin, Peter Zijlstra,
Uwe Kleine-König, rodrigo.alencar, jic23
On Mon, 3 Aug 2026, David Laight wrote:
> The x86 instruction set only supports 32bit signed immediate values
> for add/sub.
> Replace the "ir" constraint with "er" to avoid build errors.
>
> Found by a patch that added used mul_u64_add_u64_div_u64() to
> do a rounding divide by 2^32 (perhaps not the best way to do this).
>
> A quick grep only found one other affected file.
Would be a good idea adding those cases to the test module.
Nicolas
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-08-03 14:49 ` Nicolas Pitre
@ 2026-08-03 15:39 ` David Laight
2026-08-23 22:35 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: David Laight @ 2026-08-03 15:39 UTC (permalink / raw)
To: Nicolas Pitre
Cc: Borislav Betkov, Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86,
Andrew Morton, linux-kernel, H. Peter Anvin, Peter Zijlstra,
Uwe Kleine-König, rodrigo.alencar, jic23
On Mon, 3 Aug 2026 10:49:40 -0400 (EDT)
Nicolas Pitre <nico@fluxnic.net> wrote:
> On Mon, 3 Aug 2026, David Laight wrote:
>
> > The x86 instruction set only supports 32bit signed immediate values
> > for add/sub.
> > Replace the "ir" constraint with "er" to avoid build errors.
> >
> > Found by a patch that added used mul_u64_add_u64_div_u64() to
> > do a rounding divide by 2^32 (perhaps not the best way to do this).
> >
> > A quick grep only found one other affected file.
>
> Would be a good idea adding those cases to the test module.
They fail to compile so it isn't a big deal.
David
>
>
> Nicolas
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-08-03 15:39 ` David Laight
@ 2026-08-23 22:35 ` Jonathan Cameron
2026-09-01 16:51 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2026-08-23 22:35 UTC (permalink / raw)
To: David Laight
Cc: Nicolas Pitre, Borislav Betkov, Ingo Molnar, Thomas Gleinxer,
Dave Hansen, x86, Andrew Morton, linux-kernel, H. Peter Anvin,
Peter Zijlstra, Uwe Kleine-König, rodrigo.alencar
On Mon, 3 Aug 2026 16:39:55 +0100
David Laight <david.laight.linux@gmail.com> wrote:
> On Mon, 3 Aug 2026 10:49:40 -0400 (EDT)
> Nicolas Pitre <nico@fluxnic.net> wrote:
>
> > On Mon, 3 Aug 2026, David Laight wrote:
> >
> > > The x86 instruction set only supports 32bit signed immediate values
> > > for add/sub.
> > > Replace the "ir" constraint with "er" to avoid build errors.
> > >
> > > Found by a patch that added used mul_u64_add_u64_div_u64() to
> > > do a rounding divide by 2^32 (perhaps not the best way to do this).
> > >
> > > A quick grep only found one other affected file.
> >
> > Would be a good idea adding those cases to the test module.
>
> They fail to compile so it isn't a big deal.
>
David, thanks for sorting this (and all for reviewing)
Seems like everyone is happy. What route is this taking upstream?
I held Rodrigo's driver to avoid the build breakage and would like to
get it queued up early in next cycle. So not that urgent but nice
to be able to tick it off the list!
Thanks,
Jonathan
> David
>
> >
> >
> > Nicolas
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-08-23 22:35 ` Jonathan Cameron
@ 2026-09-01 16:51 ` Jonathan Cameron
2026-09-07 22:14 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2026-09-01 16:51 UTC (permalink / raw)
To: David Laight, linux-iio
Cc: Nicolas Pitre, Borislav Betkov, Ingo Molnar, Thomas Gleinxer,
Dave Hansen, x86, Andrew Morton, linux-kernel, H. Peter Anvin,
Peter Zijlstra, Uwe Kleine-König, rodrigo.alencar
On Sun, 23 Aug 2026 23:35:36 +0100
Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> wrote:
> On Mon, 3 Aug 2026 16:39:55 +0100
> David Laight <david.laight.linux@gmail.com> wrote:
>
> > On Mon, 3 Aug 2026 10:49:40 -0400 (EDT)
> > Nicolas Pitre <nico@fluxnic.net> wrote:
> >
> > > On Mon, 3 Aug 2026, David Laight wrote:
> > >
> > > > The x86 instruction set only supports 32bit signed immediate values
> > > > for add/sub.
> > > > Replace the "ir" constraint with "er" to avoid build errors.
> > > >
> > > > Found by a patch that added used mul_u64_add_u64_div_u64() to
> > > > do a rounding divide by 2^32 (perhaps not the best way to do this).
> > > >
> > > > A quick grep only found one other affected file.
> > >
> > > Would be a good idea adding those cases to the test module.
> >
> > They fail to compile so it isn't a big deal.
> >
> David, thanks for sorting this (and all for reviewing)
>
> Seems like everyone is happy. What route is this taking upstream?
>
> I held Rodrigo's driver to avoid the build breakage and would like to
> get it queued up early in next cycle. So not that urgent but nice
> to be able to tick it off the list!
>
Given I have a driver queued up behind this, shall I just take it through
the drivers/iio tree?
I can do an immutable branch just in case anyone else needs it this cycle.
Jonathan
> Thanks,
>
> Jonathan
>
> > David
> >
> > >
> > >
> > > Nicolas
> >
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-01 16:51 ` Jonathan Cameron
@ 2026-09-07 22:14 ` Jonathan Cameron
2026-09-08 3:32 ` Borislav Petkov
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2026-09-07 22:14 UTC (permalink / raw)
To: David Laight, linux-iio
Cc: Nicolas Pitre, Borislav Betkov, Ingo Molnar, Thomas Gleinxer,
Dave Hansen, x86, Andrew Morton, linux-kernel, H. Peter Anvin,
Peter Zijlstra, Uwe Kleine-König, rodrigo.alencar
On Tue, 1 Sep 2026 17:51:01 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> On Sun, 23 Aug 2026 23:35:36 +0100
> Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> wrote:
>
> > On Mon, 3 Aug 2026 16:39:55 +0100
> > David Laight <david.laight.linux@gmail.com> wrote:
> >
> > > On Mon, 3 Aug 2026 10:49:40 -0400 (EDT)
> > > Nicolas Pitre <nico@fluxnic.net> wrote:
> > >
> > > > On Mon, 3 Aug 2026, David Laight wrote:
> > > >
> > > > > The x86 instruction set only supports 32bit signed immediate values
> > > > > for add/sub.
> > > > > Replace the "ir" constraint with "er" to avoid build errors.
> > > > >
> > > > > Found by a patch that added used mul_u64_add_u64_div_u64() to
> > > > > do a rounding divide by 2^32 (perhaps not the best way to do this).
> > > > >
> > > > > A quick grep only found one other affected file.
> > > >
> > > > Would be a good idea adding those cases to the test module.
> > >
> > > They fail to compile so it isn't a big deal.
> > >
> > David, thanks for sorting this (and all for reviewing)
> >
> > Seems like everyone is happy. What route is this taking upstream?
> >
> > I held Rodrigo's driver to avoid the build breakage and would like to
> > get it queued up early in next cycle. So not that urgent but nice
> > to be able to tick it off the list!
> >
>
> Given I have a driver queued up behind this, shall I just take it through
> the drivers/iio tree?
>
> I can do an immutable branch just in case anyone else needs it this cycle.
>
I went ahead and picked these up on
https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git ib-iio-x86-asm-fix-7.3
and merged that into the main IIO branch. I want to give plenty of time in next
for the driver that was relying on them.
Currently this is all in my testing branch but I'll push that out as a non rebasing
(ideally) branch a bit later in the week.
Thanks
Jonathan
> Jonathan
>
>
> > Thanks,
> >
> > Jonathan
> >
> > > David
> > >
> > > >
> > > >
> > > > Nicolas
> > >
> >
>
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-07 22:14 ` Jonathan Cameron
@ 2026-09-08 3:32 ` Borislav Petkov
2026-09-08 10:02 ` Uwe Kleine-König
0 siblings, 1 reply; 22+ messages in thread
From: Borislav Petkov @ 2026-09-08 3:32 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Laight, linux-iio, Nicolas Pitre, Ingo Molnar,
Thomas Gleinxer, Dave Hansen, x86, Andrew Morton, linux-kernel,
H. Peter Anvin, Peter Zijlstra, Uwe Kleine-König,
rodrigo.alencar
On Mon, Sep 07, 2026 at 11:14:44PM +0100, Jonathan Cameron wrote:
> I went ahead and picked these up on
> https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git ib-iio-x86-asm-fix-7.3
> and merged that into the main IIO branch. I want to give plenty of time in next
> for the driver that was relying on them.
>
> Currently this is all in my testing branch but I'll push that out as a non rebasing
> (ideally) branch a bit later in the week.
No, this is not how this works. x86 changes go through tip and if you need an
immutable branch, we can give you a tag.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-08 3:32 ` Borislav Petkov
@ 2026-09-08 10:02 ` Uwe Kleine-König
2026-09-08 15:21 ` Borislav Petkov
0 siblings, 1 reply; 22+ messages in thread
From: Uwe Kleine-König @ 2026-09-08 10:02 UTC (permalink / raw)
To: Borislav Petkov
Cc: Jonathan Cameron, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]
On Mon, Sep 07, 2026 at 08:32:16PM -0700, Borislav Petkov wrote:
> On Mon, Sep 07, 2026 at 11:14:44PM +0100, Jonathan Cameron wrote:
> > I went ahead and picked these up on
> > https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git ib-iio-x86-asm-fix-7.3
> > and merged that into the main IIO branch. I want to give plenty of time in next
> > for the driver that was relying on them.
> >
> > Currently this is all in my testing branch but I'll push that out as a non rebasing
> > (ideally) branch a bit later in the week.
>
> No, this is not how this works. x86 changes go through tip and if you need an
> immutable branch, we can give you a tag.
While x86 usually goes through tip and none of the x86 maintainers
commented before Jonathan applied, it got positive feedback from hpa and
peterz a month ago and iio depends on it.
So I suggest to do the practical thing and pull Jonathan's branch into
tip. Technically that doesn't make a difference (apart from maybe branch
vs tag preferences).
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-08 10:02 ` Uwe Kleine-König
@ 2026-09-08 15:21 ` Borislav Petkov
2026-09-08 15:49 ` Uwe Kleine-König
0 siblings, 1 reply; 22+ messages in thread
From: Borislav Petkov @ 2026-09-08 15:21 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jonathan Cameron, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
On Tue, Sep 08, 2026 at 12:02:42PM +0200, Uwe Kleine-König wrote:
> While x86 usually goes through tip and none of the x86 maintainers
> commented before Jonathan applied,
You mean it is easy to spot every question to x86 maintainers in the avalance
of mails?
> it got positive feedback from hpa and peterz a month ago and iio depends on
> it.
That's business as usual.
> So I suggest to do the practical thing and pull Jonathan's branch into tip.
> Technically that doesn't make a difference (apart from maybe branch vs tag
> preferences).
It does make a difference when the merge window comes and we have to
synchronize when to send what. And we send tip stuff very early.
Considering how early it is in the game, I'd prefer if I queue those into tip
now and give you an immutable branch or tag and not worry about adding more
stuff ontop later.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-08 15:21 ` Borislav Petkov
@ 2026-09-08 15:49 ` Uwe Kleine-König
2026-09-08 16:55 ` Borislav Petkov
0 siblings, 1 reply; 22+ messages in thread
From: Uwe Kleine-König @ 2026-09-08 15:49 UTC (permalink / raw)
To: Borislav Petkov
Cc: Jonathan Cameron, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]
On Tue, Sep 08, 2026 at 08:21:27AM -0700, Borislav Petkov wrote:
> On Tue, Sep 08, 2026 at 12:02:42PM +0200, Uwe Kleine-König wrote:
> > While x86 usually goes through tip and none of the x86 maintainers
> > commented before Jonathan applied,
>
> You mean it is easy to spot every question to x86 maintainers in the avalance
> of mails?
No, there was no hidden offence, I only meant what I wrote.
> > So I suggest to do the practical thing and pull Jonathan's branch into tip.
> > Technically that doesn't make a difference (apart from maybe branch vs tag
> > preferences).
>
> It does make a difference when the merge window comes and we have to
> synchronize when to send what. And we send tip stuff very early.
I don't see what you mean. If both the tip tree and the iio tree
contain the same commit (with or without a tag on it), it doesn't matter
who created that and when and in which repo it appeared first. The first
to send it to Linus makes it new for him and all later PRs using it only
introduce the follow-up commits. So if you pull Jonathan's branch you
still can send the branch/tag that contains it whenever you like
independant of when Jonathan sends out his PR.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-08 15:49 ` Uwe Kleine-König
@ 2026-09-08 16:55 ` Borislav Petkov
2026-09-10 3:20 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Borislav Petkov @ 2026-09-08 16:55 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Jonathan Cameron, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
On Tue, Sep 08, 2026 at 05:49:17PM +0200, Uwe Kleine-König wrote:
> I don't see what you mean. If both the tip tree and the iio tree
> contain the same commit (with or without a tag on it), it doesn't matter
> who created that and when and in which repo it appeared first. The first
> to send it to Linus makes it new for him and all later PRs using it only
> introduce the follow-up commits. So if you pull Jonathan's branch you
> still can send the branch/tag that contains it whenever you like
> independant of when Jonathan sends out his PR.
Yes, I'm going to have to merge that branch into tip now so I'd need the
assurance from Jonathan that this branch is not going to change.
Also, those patches are not tip-conform, but whatever, not that important for
a one-time thing.
What I really don't understand is, why this rush needs to happen now so that
we completely do a one-off on the agreed upon process and we have to do all
this unnecessary gymnastics?
We have plenty of time.
So why do we even have to debate this instead of you folks dropping this and
we merge it through tip and then everything's going the usual way?
When people start merging x86 patches in their trees, when do you think the
process will break down and we'll have to redo branches and go into a crazy
dependency madness?
We're not merging other stuff through tip without an Ack - why can't you
adhere to the process we've all agreed upon?
Yes, this can work now. Is it necessary? Absolutely not because it is
a one-off and will get everyone involved, confused.
So please do not do this in the future. If we don't react to the mail, you can
always ping us on IRC like other folks do.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-08 16:55 ` Borislav Petkov
@ 2026-09-10 3:20 ` Jonathan Cameron
2026-09-10 3:45 ` Borislav Petkov
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2026-09-10 3:20 UTC (permalink / raw)
To: Borislav Petkov
Cc: Uwe Kleine-König, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
On Tue, 8 Sep 2026 09:55:01 -0700
Borislav Petkov <bp@alien8.de> wrote:
> On Tue, Sep 08, 2026 at 05:49:17PM +0200, Uwe Kleine-König wrote:
> > I don't see what you mean. If both the tip tree and the iio tree
> > contain the same commit (with or without a tag on it), it doesn't matter
> > who created that and when and in which repo it appeared first. The first
> > to send it to Linus makes it new for him and all later PRs using it only
> > introduce the follow-up commits. So if you pull Jonathan's branch you
> > still can send the branch/tag that contains it whenever you like
> > independant of when Jonathan sends out his PR.
>
> Yes, I'm going to have to merge that branch into tip now so I'd need the
> assurance from Jonathan that this branch is not going to change.
That's what an immutable branch means to everyone I've ever shared them
with in the past, but sure - it wouldn't change. Anyhow, easier solution
below.
>
> Also, those patches are not tip-conform, but whatever, not that important for
> a one-time thing.
>
> What I really don't understand is, why this rush needs to happen now so that
> we completely do a one-off on the agreed upon process and we have to do all
> this unnecessary gymnastics?
>
> We have plenty of time.
>
> So why do we even have to debate this instead of you folks dropping this and
> we merge it through tip and then everything's going the usual way?
>
> When people start merging x86 patches in their trees, when do you think the
> process will break down and we'll have to redo branches and go into a crazy
> dependency madness?
>
> We're not merging other stuff through tip without an Ack - why can't you
> adhere to the process we've all agreed upon?
>
> Yes, this can work now. Is it necessary? Absolutely not because it is
> a one-off and will get everyone involved, confused.
>
> So please do not do this in the future. If we don't react to the mail, you can
> always ping us on IRC like other folks do.
>
> Thx.
I've dropped the branch from IIO. That's fine because it was still being
tested and hasn't gone out as non-rebasing yet.
Next time I'll maybe find an IRC gateway and ping you on that. I can't
find any reference to that being your preference in the kernel docs.
Given you have a helpful page on tip, might be worth adding a note.
I might of course be missing it.
If it goes into a reasonably early rc, I'll just merge the relevant rc
rather than needing an immutable. If next cycle, immutable please.
I started out a bit grumpy that I had to hold a non trivial series for
a cycle because of an x86 bug (having been very happy when David
fixed it incredibly quickly!), that got reviewed then disappeared
down a hole and didn't look like it would ever be seen again.
Meh, got me on a belligerent day.
Jonathan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-10 3:20 ` Jonathan Cameron
@ 2026-09-10 3:45 ` Borislav Petkov
2026-09-10 16:09 ` Jonathan Cameron
0 siblings, 1 reply; 22+ messages in thread
From: Borislav Petkov @ 2026-09-10 3:45 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Uwe Kleine-König, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
On Thu, Sep 10, 2026 at 04:20:29AM +0100, Jonathan Cameron wrote:
> I've dropped the branch from IIO. That's fine because it was still being
> tested and hasn't gone out as non-rebasing yet.
Ack, will do first thing tomorrow.
> Next time I'll maybe find an IRC gateway and ping you on that. I can't
> find any reference to that being your preference in the kernel docs.
> Given you have a helpful page on tip, might be worth adding a note.
> I might of course be missing it.
I'll send you a private note after this.
> If it goes into a reasonably early rc, I'll just merge the relevant rc
> rather than needing an immutable. If next cycle, immutable please.
First one can go to Linus now, second one would go next cycle. Do you want to
base ontop of both?
> I started out a bit grumpy that I had to hold a non trivial series for
> a cycle because of an x86 bug (having been very happy when David
> fixed it incredibly quickly!), that got reviewed then disappeared
> down a hole and didn't look like it would ever be seen again.
> Meh, got me on a belligerent day.
No worries, happens to all of us.
Thanks!
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-10 3:45 ` Borislav Petkov
@ 2026-09-10 16:09 ` Jonathan Cameron
2026-09-10 18:00 ` Borislav Petkov
0 siblings, 1 reply; 22+ messages in thread
From: Jonathan Cameron @ 2026-09-10 16:09 UTC (permalink / raw)
To: Borislav Petkov
Cc: Uwe Kleine-König, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
On Wed, 9 Sep 2026 20:45:27 -0700
Borislav Petkov <bp@alien8.de> wrote:
> On Thu, Sep 10, 2026 at 04:20:29AM +0100, Jonathan Cameron wrote:
> > I've dropped the branch from IIO. That's fine because it was still being
> > tested and hasn't gone out as non-rebasing yet.
>
> Ack, will do first thing tomorrow.
>
> > Next time I'll maybe find an IRC gateway and ping you on that. I can't
> > find any reference to that being your preference in the kernel docs.
> > Given you have a helpful page on tip, might be worth adding a note.
> > I might of course be missing it.
>
> I'll send you a private note after this.
>
> > If it goes into a reasonably early rc, I'll just merge the relevant rc
> > rather than needing an immutable. If next cycle, immutable please.
>
> First one can go to Linus now, second one would go next cycle. Do you want to
> base ontop of both?
Only need the first patch, so I'll just pick it up by merging
an RC once it this is upstream.
Thanks,
Jonathan
>
> > I started out a bit grumpy that I had to hold a non trivial series for
> > a cycle because of an x86 bug (having been very happy when David
> > fixed it incredibly quickly!), that got reviewed then disappeared
> > down a hole and didn't look like it would ever be seen again.
> > Meh, got me on a belligerent day.
>
> No worries, happens to all of us.
>
> Thanks!
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/2] x86: Use "er" asm constriant for add/sub
2026-09-10 16:09 ` Jonathan Cameron
@ 2026-09-10 18:00 ` Borislav Petkov
0 siblings, 0 replies; 22+ messages in thread
From: Borislav Petkov @ 2026-09-10 18:00 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Uwe Kleine-König, David Laight, linux-iio, Nicolas Pitre,
Ingo Molnar, Thomas Gleinxer, Dave Hansen, x86, Andrew Morton,
linux-kernel, H. Peter Anvin, Peter Zijlstra, rodrigo.alencar
On Thu, Sep 10, 2026 at 05:09:13PM +0100, Jonathan Cameron wrote:
> Only need the first patch, so I'll just pick it up by merging
> an RC once it this is upstream.
Pushed out into tip:x86/urgent. That branch should be mainline with -rc3.
If something last-minute changes, lemme know and I'll do an immutable branch.
Thanks!
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 22+ messages in thread
* [tip: x86/urgent] x86/div64: Fix addition of large constants in mul_u64_add_u64_div_u64()
2026-08-03 9:47 ` [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants David Laight
2026-08-03 10:08 ` H. Peter Anvin
@ 2026-09-10 18:00 ` tip-bot2 for David Laight
1 sibling, 0 replies; 22+ messages in thread
From: tip-bot2 for David Laight @ 2026-09-10 18:00 UTC (permalink / raw)
To: linux-tip-commits
Cc: David Laight, Borislav Petkov (AMD), H. Peter Anvin, x86, linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: f65d38155aef069c897a64643a03db237dd1e0c8
Gitweb: https://git.kernel.org/tip/f65d38155aef069c897a64643a03db237dd1e0c8
Author: David Laight <david.laight.linux@gmail.com>
AuthorDate: Mon, 03 Aug 2026 10:47:01 +01:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 10 Sep 2026 10:40:22 -07:00
x86/div64: Fix addition of large constants in mul_u64_add_u64_div_u64()
Adding constants over 2^31 fails to compile because the ADD instruction only
supports 32bit signed immediates.
Replace the "irm" constraint with "erm" so that the compiler loads large
constants into a register.
Found by a patch to drivers/iio/frequency/ad9910.c
[ bp: Massage commit message. ]
Fixes: 6480241f31f5 ("lib: add mul_u64_add_u64_div_u64() and mul_u64_u64_div_u64_roundup()")
Signed-off-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: H. Peter Anvin <hpa@zytor.com>
Link: https://patch.msgid.link/20260803094702.3852-2-david.laight.linux@gmail.com
---
arch/x86/include/asm/div64.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/div64.h b/arch/x86/include/asm/div64.h
index 30fd06e..8a2d343 100644
--- a/arch/x86/include/asm/div64.h
+++ b/arch/x86/include/asm/div64.h
@@ -111,7 +111,7 @@ static inline u64 mul_u64_add_u64_div_u64(u64 rax, u64 mul, u64 add, u64 div)
if (!statically_true(!add))
asm ("addq %[add], %[lo]; adcq $0, %[hi]" :
- [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "irm" (add));
+ [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "erm" (add));
asm ("divq %[div]" : "+a" (rax), "+d" (rdx) : [div] "rm" (div));
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2026-09-10 18:00 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-03 9:47 [PATCH 0/2] x86: Use "er" asm constriant for add/sub David Laight
2026-08-03 9:47 ` [PATCH 1/2] lib: mul_u64_add_u64_div_u64: Fix addition of large constants David Laight
2026-08-03 10:08 ` H. Peter Anvin
2026-09-10 18:00 ` [tip: x86/urgent] x86/div64: Fix addition of large constants in mul_u64_add_u64_div_u64() tip-bot2 for David Laight
2026-08-03 9:47 ` [PATCH 2/2] x86/local: local_add/local_sub: Support large immediate values David Laight
2026-08-03 10:01 ` Peter Zijlstra
2026-08-03 10:07 ` H. Peter Anvin
2026-08-03 9:59 ` [PATCH 0/2] x86: Use "er" asm constriant for add/sub Peter Zijlstra
2026-08-03 14:49 ` Nicolas Pitre
2026-08-03 15:39 ` David Laight
2026-08-23 22:35 ` Jonathan Cameron
2026-09-01 16:51 ` Jonathan Cameron
2026-09-07 22:14 ` Jonathan Cameron
2026-09-08 3:32 ` Borislav Petkov
2026-09-08 10:02 ` Uwe Kleine-König
2026-09-08 15:21 ` Borislav Petkov
2026-09-08 15:49 ` Uwe Kleine-König
2026-09-08 16:55 ` Borislav Petkov
2026-09-10 3:20 ` Jonathan Cameron
2026-09-10 3:45 ` Borislav Petkov
2026-09-10 16:09 ` Jonathan Cameron
2026-09-10 18:00 ` Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®