All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
To: Jan Beulich <jbeulich@suse.com>, Teddy Astie <teddy.astie@vates.tech>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Jason Andryuk" <jason.andryuk@amd.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/2] x86/svm: Intercept Bus Locks for HVM guests
Date: Tue, 20 Jan 2026 15:41:52 +0100	[thread overview]
Message-ID: <DFTHUH7DLTPT.2IBD4N9XTTR8X@amd.com> (raw)
In-Reply-To: <fb53b679-701f-4028-a75c-c4d153b80619@suse.com>

On Tue Jan 20, 2026 at 2:29 PM CET, Jan Beulich wrote:
> On 20.01.2026 14:11, Teddy Astie wrote:
>> Le 20/01/2026 à 10:56, Alejandro Vallejo a écrit :
>>> --- a/xen/arch/x86/hvm/svm/vmcb.c
>>> +++ b/xen/arch/x86/hvm/svm/vmcb.c
>>> @@ -66,6 +66,12 @@ static int construct_vmcb(struct vcpu *v)
>>>           GENERAL2_INTERCEPT_XSETBV      | GENERAL2_INTERCEPT_ICEBP       |
>>>           GENERAL2_INTERCEPT_RDPRU;
>>>   
>>> +    if ( cpu_has_bus_lock_thresh )
>>> +    {
>>> +        vmcb->_general3_intercepts = GENERAL3_INTERCEPT_BUS_LOCK_THRESH;
>>> +        vmcb->bus_lock_thresh = 1; /* trigger immediately */
>>> +    }
>>> +
>>>       /* Intercept all debug-register writes. */
>>>       vmcb->_dr_intercepts = ~0u;
>>>   
>> 
>> According to APM,
>> 
>> INTERCEPT_BUS_LOCK_THRESH does
>>  > Intercept bus lock operations when Bus Lock Threshold Counter is 0
>> 
>> I assume that when set to 0, we intercept all bus locks, so if set to 1, 
>> every 2 bus lock (since we first go from 1 to 0, then at 0 we intercept 
>> the next one) ?

Correct

>> 
>> I think we want that to be tunable, as intercepting all bus locks may be 
>> too extreme we probably want to intercept every few ones instead.
>
> Otoh bus locks (as opposed to cache locks) would better be rare, or else
> perhaps such a guest deserves some extra slowing down?
>
> Jan

I agree with Jan. buslock operations are so rare it's not worth being lenient
about them. They ought to be more expensive than they currently are for the
caller, in fact, so they notice and not do it because there's rarely a rationale
for them to exist at all. I'd be happier if the ISA didn't allow them at all.

Cheers,
Alejandro


  reply	other threads:[~2026-01-20 14:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20  9:53 [PATCH 0/2] x86/svm: Add support for Bus Lock Threshold Alejandro Vallejo
2026-01-20  9:53 ` [PATCH 1/2] x86/svm: Add infrastructure " Alejandro Vallejo
2026-01-20 13:12   ` Andrew Cooper
2026-01-20 13:57     ` Alejandro Vallejo
2026-01-20 13:19   ` Teddy Astie
2026-01-20 13:30     ` Jan Beulich
2026-01-21 12:40       ` Alejandro Vallejo
2026-01-21 13:07         ` Jan Beulich
2026-01-21 15:10           ` Alejandro Vallejo
2026-01-20 13:58     ` Alejandro Vallejo
2026-01-20  9:53 ` [PATCH 2/2] x86/svm: Intercept Bus Locks for HVM guests Alejandro Vallejo
2026-01-20 13:11   ` Teddy Astie
2026-01-20 13:29     ` Jan Beulich
2026-01-20 14:41       ` Alejandro Vallejo [this message]
2026-01-20 13:18   ` Andrew Cooper
2026-01-20 13:27     ` Jan Beulich
2026-01-20 13:29       ` Andrew Cooper
2026-01-20 13:34         ` Jan Beulich
2026-01-20 14:11           ` Andrew Cooper
2026-01-20 14:16             ` Jan Beulich
2026-01-20 14:26               ` Andrew Cooper
2026-01-20 14:32                 ` Jan Beulich
2026-01-20 15:28                   ` Alejandro Vallejo
2026-01-20 15:41                     ` Alejandro Vallejo
2026-01-20 11:22 ` [PATCH 0/2] x86/svm: Add support for Bus Lock Threshold Alejandro Vallejo
2026-01-20 13:21   ` 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=DFTHUH7DLTPT.2IBD4N9XTTR8X@amd.com \
    --to=alejandro.garciavallejo@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jason.andryuk@amd.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=teddy.astie@vates.tech \
    --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 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.