mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xen/mcelog: simplify MCE_GETCLEAR_FLAGS using xchg()
Date: Thu, 22 Jan 2026 15:21:53 +0100	[thread overview]
Message-ID: <60e77689-7fed-432d-ab8d-621690e6a323@suse.com> (raw)
In-Reply-To: <20260122141754.116129-1-ubizjak@gmail.com>

On 22.01.2026 15:17, Uros Bizjak wrote:
> The MCE_GETCLEAR_FLAGS ioctl retrieves xen_mcelog.flags while
> atomically clearing it. This was previously implemented using a
> cmpxchg() loop.
> 
> Replace the cmpxchg() loop with a single xchg(), which provides the
> same atomic get-and-clear semantics, avoids retry spinning under
> contention, and simplifies the code.
> 
> The code on x86_64 improves from:
> 
>     186:	8b 15 00 00 00 00    	mov    0x0(%rip),%edx
>     18c:	89 d0                	mov    %edx,%eax
>     18e:	f0 0f b1 0d 00 00 00 	lock cmpxchg %ecx,0x0(%rip)
>     195:	00
>     196:	39 c2                	cmp    %eax,%edx
>     198:	75 ec                	jne    186 <...>
> 
> to just:
> 
>     186:	87 05 00 00 00 00    	xchg   %eax,0x0(%rip)
> 
> No functional change intended.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>


  reply	other threads:[~2026-01-22 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 14:17 Uros Bizjak
2026-01-22 14:21 ` Jan Beulich [this message]
2026-01-22 14:21 ` Jan Beulich
2026-01-22 14:22 ` Andrew Cooper

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=60e77689-7fed-432d-ab8d-621690e6a323@suse.com \
    --to=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=ubizjak@gmail.com \
    --cc=xen-devel@lists.xenproject.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

all inboxes | Powered by JetHome®