Article View: comp.arch
Article #239Re: Performance of xchg reg,reg
From: Scott Lurndal
Date: Tue, 20 Oct 2026 14:09
Date: Tue, 20 Oct 2026 14:09
29 lines
2370 bytes
2370 bytes
cross@spitfire.i.gajendra.net (Dan Cross) writes: >In article <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org>, >Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>Anton Ertl [2026-10-18 16:57:26] wrote: >>> And actually all the stuff about XCHG with memory operands does not >>> contradict this sentence. It could be understood as meaning that >>> while all the other aspects of locking don't apply to "XCHG reg, reg", >>> the assertion of the LOCK# signal still has to occur, and that's why >>> Intel processors implement a slow XCHG reg, reg. >> >>How could code witness the difference? >> >>I believe AMD can claim that its behavior is consistent with the >>behavior you'd get when asserting the LOCK# signal. > >The effects of a bus lock include disallowing memory operations >(except for instruction fetches or page table accesses) passing >a locked operation. If `XCHG reg,reg` where indeed treated as >though it asserted `LOCK#` for the duration of its execution, it >could be (ab)used to force that behavior: From sec 11.1.2.2 of >SDM Volume 3a (Sept 2026 version): > It's worth noting that AMD processors (in the 2008 timeframe) would assert the LOCK# signal if a highly contended cache line could not be acquired in exclusive mode within a certain window of time, even if the access was completely encapsulated in said cache line. I suspect that is still the case.
Technical Details
Message-ID:
<kCKBS.68257$ACx3.16699@fx15.iad>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mailReferences:
<2026Oct13.104347@mips.complang.tuwien.ac.at> <20261018184318.00000bee@yahoo.com> <2026Oct18.185726@mips.complang.tuwien.ac.at> <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org> <11b6i0g$f44$1@reader2.panix.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail X-newsreader: xrn 9.03-beta-14-64bit Sender: scott@dragon.sl.home (Scott Lurndal) From: scott@slp53.sl.home (Scott Lurndal) Reply-To: slp53@pacbell.net Subject: Re: Performance of xchg reg,reg Newsgroups: comp.arch References: <2026Oct13.104347@mips.complang.tuwien.ac.at> <20261018184318.00000bee@yahoo.com> <2026Oct18.185726@mips.complang.tuwien.ac.at> <jwv8q3uqrxf.fsf-monnier+comp.arch@gnu.org> <11b6i0g$f44$1@reader2.panix.com> Lines: 29 Message-ID: <kCKBS.68257$ACx3.16699@fx15.iad> X-Complaints-To: abuse@usenetserver.com NNTP-Posting-Date: Tue, 20 Oct 2026 14:09:20 UTC Organization: UsenetServer - www.usenetserver.com Date: Tue, 20 Oct 2026 14:09:20 GMT X-Received-Bytes: 2138