lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZqiofczTqmn4bvhy@chenyu5-mobl2>
Date: Tue, 30 Jul 2024 16:46:53 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: maobibo <maobibo@...ngson.cn>
CC: Dave Hansen <dave.hansen@...ux.intel.com>, Thomas Gleixner
	<tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov
	<bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>, Arnd Bergmann
	<arnd@...db.de>, <virtualization@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>, Juergen Gross <jgross@...e.com>, "Nikolay
 Borisov" <nik.borisov@...e.com>, Qiuxu Zhuo <qiuxu.zhuo@...el.com>, "Prem
 Nath Dey" <prem.nath.dey@...el.com>, Xiaoping Zhou <xiaoping.zhou@...el.com>,
	"Peter Zijlstra" <peterz@...radead.org>
Subject: Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

Hi Bibo,

On 2024-07-30 at 09:21:45 +0800, maobibo wrote:
> Chenyu,
> 
> Sorry to bother you, I am porting pv spinlock to LoongArch platform, I do
> not know the history about function virt_spin_lock().
> 
> When CONFIG_PARAVIRT_SPINLOCKS is enabled, there is pv_enabled() before
> virt_spin_lock(), it seems that virt_spin_lock is never called in this
> condition.

Right, if CONFIG_PARAVIRT_SPINLOCKS is enabled, virt_spin_lock() will not be
checked at all and go directly to pv_queue lock section.

>         if (pv_enabled())
>                 goto pv_queue;
> 
>         if (virt_spin_lock(lock))
>                 return;
> 
> When CONFIG_PARAVIRT_SPINLOCKS is disabled, there is no pv qspinlock
> compiled, so what is the usage about function virt_spin_lock()? 
> Is it to switch spinlock method from test-set spinlock to qspinlock? 
> why is there such requirement for spinlock switching method?

Firstly, according to the commit 2aa79af64263 ("locking/qspinlock: Revert
to test-and-set on hypervisors"), virt_spin_lock() was originally introduced
to avoid the over-preemption of native qspinlock(when paravirt-spinlock is
disabled).

Secondly, there is user requirement to use native qspinlock over test-set lock
in the VM. For example, nopvspin parameter is parsed in xen_init_spinlocks().
commit 9043442b43b1 ("locking/paravirt: Use new static key for controlling call
of virt_spin_lock()") was introduced to adjust the key from user boot up commandline.
so the key switches between test-set and the native qspinlock. I've Cced
Juergen and Peter in case I misunderstood. 

thanks,
Chenyu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ