diff mbox series

[v3,2/2] x86/vpt: Simplify locking argument to write_{un}lock

Message ID 1617052502-14181-3-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State New, archived
Headers show
Series Performance regression due to XSA-336 | expand

Commit Message

Boris Ostrovsky March 29, 2021, 9:15 p.m. UTC
Make both create_periodic_time() and pt_adjust_vcpu() call
write_{un}lock with similar arguments.

Requested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
New patch.

I ended up doing what Jan asked --- create_periodic_time() is also using different
start pointers in lock() and unlock().


 xen/arch/x86/hvm/vpt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Roger Pau Monne March 30, 2021, 7:36 a.m. UTC | #1
On Mon, Mar 29, 2021 at 05:15:02PM -0400, Boris Ostrovsky wrote:
> Make both create_periodic_time() and pt_adjust_vcpu() call
> write_{un}lock with similar arguments.
> 

Might be worth adding that this is not a functional change?

> Requested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Either way:

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

> ---
> New patch.
> 
> I ended up doing what Jan asked --- create_periodic_time() is also using different
> start pointers in lock() and unlock().

Hm, I'm not sure I'm following, create_periodic_time uses 'v' in both
write_{un}lock calls, which doesn't change across the function.

Thanks, Roger.
Jan Beulich March 30, 2021, 12:49 p.m. UTC | #2
On 30.03.2021 09:36, Roger Pau Monné wrote:
> On Mon, Mar 29, 2021 at 05:15:02PM -0400, Boris Ostrovsky wrote:
>> Make both create_periodic_time() and pt_adjust_vcpu() call
>> write_{un}lock with similar arguments.

This makes it sound like you adjust both functions, but really
you bring the latter in line with the former. Would you mind me
adjusting the wording along these lines while (and when)
committing?

> Might be worth adding that this is not a functional change?
> 
>> Requested-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> 
> Either way:
> 
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
> 
>> ---
>> New patch.
>>
>> I ended up doing what Jan asked --- create_periodic_time() is also using different
>> start pointers in lock() and unlock().
> 
> Hm, I'm not sure I'm following, create_periodic_time uses 'v' in both
> write_{un}lock calls, which doesn't change across the function.

I guess Boris merely meant to express that there's already precedent?

Jan
Boris Ostrovsky March 30, 2021, 2:22 p.m. UTC | #3
On 3/30/21 8:49 AM, Jan Beulich wrote:
> On 30.03.2021 09:36, Roger Pau Monné wrote:
>> On Mon, Mar 29, 2021 at 05:15:02PM -0400, Boris Ostrovsky wrote:
>>> Make both create_periodic_time() and pt_adjust_vcpu() call
>>> write_{un}lock with similar arguments.
> This makes it sound like you adjust both functions, but really
> you bring the latter in line with the former. Would you mind me
> adjusting the wording along these lines while (and when)
> committing?


Yes, please.


>
>> Might be worth adding that this is not a functional change?
>>
>>> Requested-by: Jan Beulich <jbeulich@suse.com>
>>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Either way:
>>
>> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
>>
>>> ---
>>> New patch.
>>>
>>> I ended up doing what Jan asked --- create_periodic_time() is also using different
>>> start pointers in lock() and unlock().
>> Hm, I'm not sure I'm following, create_periodic_time uses 'v' in both
>> write_{un}lock calls, which doesn't change across the function.
> I guess Boris merely meant to express that there's already precedent?


Yes, that's what I wanted to say. But clearly not what I actually said.


-boris
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 560fab9cfc60..4cc0a0848bd7 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -592,7 +592,7 @@  static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
     if ( pt->vcpu == NULL )
         return;
 
-    write_lock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+    write_lock(&v->domain->arch.hvm.pl_time->pt_migrate);
 
     if ( pt->vcpu == v )
         goto out;
@@ -613,7 +613,7 @@  static void pt_adjust_vcpu(struct periodic_time *pt, struct vcpu *v)
     pt_vcpu_unlock(v);
 
  out:
-    write_unlock(&pt->vcpu->domain->arch.hvm.pl_time->pt_migrate);
+    write_unlock(&v->domain->arch.hvm.pl_time->pt_migrate);
 }
 
 void pt_adjust_global_vcpu_target(struct vcpu *v)