From: Vineet Gupta <vgupta@kernel.org>
To: Pavel.Kozlov@synopsys.com, linux-snps-arc@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, vgupta@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ARC: avoid unwanted gcc optimizations in atomic operations
Date: Tue, 15 Aug 2023 09:12:48 -0700 [thread overview]
Message-ID: <ed79681e-ecd1-3129-5ad1-2965e2cd42b5@kernel.org> (raw)
In-Reply-To: <20230815151136.2220588-1-kozlov@synopsys.com>
On 8/15/23 08:11, Pavel.Kozlov@synopsys.com wrote:
> From: Pavel Kozlov<pavel.kozlov@synopsys.com>
>
> Notify a compiler about write operations and prevent unwanted
> optimizations. Add the "memory" clobber to the clobber list.
>
> An obvious problem with unwanted compiler optimizations appeared after
> the cpumask optimization commit 596ff4a09b89 ("cpumask: re-introduce
> constant-sized cpumask optimizations").
>
> After this commit the SMP kernels for ARC no longer loads because of
> failed assert in the percpu allocator initialization routine:
>
> percpu: BUG: failure at mm/percpu.c:2981/pcpu_build_alloc_info()!
>
> The write operation performed by the scond instruction in the atomic
> inline asm code is not properly passed to the compiler. The compiler
> cannot correctly optimize a nested loop that runs through the cpumask
> in the pcpu_build_alloc_info() function.
>
> Add the "memory" clobber to fix this.
>
> Link:https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/135
> Cc:<stable@vger.kernel.org> # v6.3+
> Signed-off-by: Pavel Kozlov<pavel.kozlov@synopsys.com>
Acked-by: Vineet Gupta <vgupta@kernel.org>
Fixes: b64be6836993c431e ("ARC: atomics: implement relaxed variants")
Before that commit, atomic ops could elide memory clobber because the
trailing smp_mb() did that anyways.
However after that commit, the smp_mb() was optional for relaxed
variants and thus needs clobber.
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
prev parent reply other threads:[~2023-08-15 16:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 15:11 [PATCH] ARC: avoid unwanted gcc optimizations in atomic operations Pavel.Kozlov
2023-08-15 16:12 ` Vineet Gupta [this message]
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=ed79681e-ecd1-3129-5ad1-2965e2cd42b5@kernel.org \
--to=vgupta@kernel.org \
--cc=Pavel.Kozlov@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=stable@vger.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 read-only IMAP folder(s) and NNTP newsgroup(s).