All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-kernel@vger.kernel.org, akiyks@gmail.com,
	boqun.feng@gmail.com, corbet@lwn.net, keescook@chromium.org,
	linux@armlinux.org.uk, linux-doc@vger.kernel.org,
	mchehab@kernel.org, paulmck@kernel.org, peterz@infradead.org,
	rdunlap@infradead.org, sstabellini@kernel.org, will@kernel.org
Subject: Re: [PATCH v2 04/27] locking/atomic: make atomic*_{cmp,}xchg optional
Date: Wed, 28 Jun 2023 12:42:32 +0100	[thread overview]
Message-ID: <ZJwcqCLlKcCWmlDF@FVFF77S0Q05N> (raw)
In-Reply-To: <32395f1f-19e4-41da-9f67-68c7d21cf9b2@roeck-us.net>

On Tue, Jun 27, 2023 at 10:07:07AM -0700, Guenter Roeck wrote:
> Hi,

Hi Guenter,

> On Mon, Jun 05, 2023 at 08:01:01AM +0100, Mark Rutland wrote:
> > Most architectures define the atomic/atomic64 xchg and cmpxchg
> > operations in terms of arch_xchg and arch_cmpxchg respectfully.
> > 
> > Add fallbacks for these cases and remove the trivial cases from arch
> > code. On some architectures the existing definitions are kept as these
> > are used to build other arch_atomic*() operations.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Reviewed-by: Kees Cook <keescook@chromium.org>
> > Cc: Boqun Feng <boqun.feng@gmail.com>
> > Cc: Paul E. McKenney <paulmck@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Will Deacon <will@kernel.org>
> 
> This patch results in:
> 
> ERROR: modpost: "__xchg_called_with_bad_pointer" [lib/atomic64_test.ko] undefined!
> 
> when trying to build sparc64:allmodconfig.

Hmm... it seems that in that configuration, the compiler decides to place
__arch_xchg() out-of-line, and hence can't remove the call to
__xchg_called_with_bad_pointer() via dead code elimination.

So this is due to tickling the compiler into making a different inlining
decision rather than due to a semantic issue in the patch.

Marking __arch_xchg() as __always_inline solves that in local testing, and we
should do likewise for the other bits used under the arch_ atomics.

I'll try to spin a patch for that soon, unless someone beats me to it.

Thanks,
Mark.

> 
> Guenter
> 
> ---
> bisect log:
> 
> # bad: [60e7c4a25da68cd826719b685babbd23e73b85b0] Add linux-next specific files for 20230626
> # good: [45a3e24f65e90a047bef86f927ebdc4c710edaa1] Linux 6.4-rc7
> git bisect start 'HEAD' 'v6.4-rc7'
> # good: [1fc7b1b3c9c3211898874f51919fcb1cf6f1cc79] Merge branch 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
> git bisect good 1fc7b1b3c9c3211898874f51919fcb1cf6f1cc79
> # good: [4fce1fc9cf89412590fb681fa480cde0b23b3381] Merge branch 'for-next' of git://git.kernel.dk/linux-block.git
> git bisect good 4fce1fc9cf89412590fb681fa480cde0b23b3381
> # bad: [cf1a0283badf6d0bfb91876583c24ef535a3c04c] Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> git bisect bad cf1a0283badf6d0bfb91876583c24ef535a3c04c
> # bad: [3c5388e722ea98022b4d557ab33acca2eb16c4f0] Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> git bisect bad 3c5388e722ea98022b4d557ab33acca2eb16c4f0
> # good: [997730bdbf14f352ab03e42461f500aafdabc03e] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
> git bisect good 997730bdbf14f352ab03e42461f500aafdabc03e
> # bad: [6fd8266556af196763b9f876ed682873e605469b] Merge branch into tip/master: 'ras/core'
> git bisect bad 6fd8266556af196763b9f876ed682873e605469b
> # good: [37380ea71463658934c2d3167d559d4034ea1c5b] Merge branch into tip/master: 'irq/core'
> git bisect good 37380ea71463658934c2d3167d559d4034ea1c5b
> # bad: [a967852939f864c35f155a2f431292ad6fc3fed9] Merge branch into tip/master: 'locking/core'
> git bisect bad a967852939f864c35f155a2f431292ad6fc3fed9
> # bad: [e50f06ce2d876c740993b5e3d01e203520391ccd] locking/atomic: m68k: add preprocessor symbols
> git bisect bad e50f06ce2d876c740993b5e3d01e203520391ccd
> # good: [b1fe7f2cda2a003afe316ce8dfe8d3645694a67e] x86,intel_iommu: Replace cmpxchg_double()
> git bisect good b1fe7f2cda2a003afe316ce8dfe8d3645694a67e
> # good: [14d72d4b6f0e88b5f683c1a5b7a876a55055852d] locking/atomic: remove fallback comments
> git bisect good 14d72d4b6f0e88b5f683c1a5b7a876a55055852d
> # bad: [f739287ef57bc01155e556033462e9a6ff020c97] locking/atomic: arc: add preprocessor symbols
> git bisect bad f739287ef57bc01155e556033462e9a6ff020c97
> # bad: [d12157efc8e083c77d054675fcdd594f54cc7e2b] locking/atomic: make atomic*_{cmp,}xchg optional
> git bisect bad d12157efc8e083c77d054675fcdd594f54cc7e2b
> # good: [a7bafa7969da1c0e9c342c792d8224078d1c491c] locking/atomic: hexagon: remove redundant arch_atomic_cmpxchg
> git bisect good a7bafa7969da1c0e9c342c792d8224078d1c491c
> # first bad commit: [d12157efc8e083c77d054675fcdd594f54cc7e2b] locking/atomic: make atomic*_{cmp,}xchg optional
> 

  reply	other threads:[~2023-06-28 11:42 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  7:00 [PATCH v2 00/27] locking/atomic: restructuring + kerneldoc Mark Rutland
2023-06-05  7:00 ` [PATCH v2 01/27] locking/atomic: arm: fix sync ops Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:00 ` [PATCH v2 02/27] locking/atomic: remove fallback comments Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 03/27] locking/atomic: hexagon: remove redundant arch_atomic_cmpxchg Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 04/27] locking/atomic: make atomic*_{cmp,}xchg optional Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-27 17:07   ` [PATCH v2 04/27] " Guenter Roeck
2023-06-28 11:42     ` Mark Rutland [this message]
2023-07-08 13:07     ` Linux regression tracking (Thorsten Leemhuis)
2023-07-08 13:20       ` Guenter Roeck
2023-07-08 13:37         ` Linux regression tracking (Thorsten Leemhuis)
2023-07-15 12:03           ` Linux regression tracking #update (Thorsten Leemhuis)
2023-06-05  7:01 ` [PATCH v2 05/27] locking/atomic: arc: add preprocessor symbols Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 06/27] locking/atomic: arm: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 07/27] locking/atomic: hexagon: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 08/27] locking/atomic: m68k: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 09/27] locking/atomic: parisc: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 10/27] locking/atomic: sh: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 11/27] locking/atomic: sparc: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 12/27] locking/atomic: x86: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 13/27] locking/atomic: xtensa: " Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 14/27] locking/atomic: scripts: remove bogus order parameter Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 15/27] locking/atomic: scripts: remove leftover "${mult}" Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 16/27] locking/atomic: scripts: factor out order template generation Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 17/27] locking/atomic: scripts: add trivial raw_atomic*_<op>() Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 18/27] locking/atomic: treewide: use raw_atomic*_<op>() Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 19/27] locking/atomic: scripts: build raw_atomic_long*() directly Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 20/27] locking/atomic: scripts: restructure fallback ifdeffery Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 21/27] locking/atomic: scripts: split pfx/name/sfx/order Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 22/27] locking/atomic: scripts: simplify raw_atomic_long*() definitions Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 23/27] locking/atomic: scripts: simplify raw_atomic*() definitions Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 24/27] docs: scripts: kernel-doc: accept bitwise negation like ~@var Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-05  7:01 ` [PATCH v2 25/27] locking/atomic: scripts: generate kerneldoc comments Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland
2023-06-15 14:07   ` [PATCH v2 25/27] " Paul E. McKenney
2023-06-16  8:57     ` Mark Rutland
2023-06-05  7:01 ` [PATCH v2 26/27] locking/atomic: docs: Add atomic operations to the driver basic API documentation Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Paul E. McKenney
2023-06-05  7:01 ` [PATCH v2 27/27] locking/atomic: treewide: delete arch_atomic_*() kerneldoc Mark Rutland
2023-06-06  8:26   ` [tip: locking/core] " tip-bot2 for Mark Rutland

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=ZJwcqCLlKcCWmlDF@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=akiyks@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=keescook@chromium.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=mchehab@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=sstabellini@kernel.org \
    --cc=will@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 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.