Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-08-02 Thread Chen Yu
On 2024-08-02 at 16:13:48 +0800, maobibo wrote: > > Hi Chenyu, > On 2024/8/2 下午3:56, Chen Yu wrote: > > On 2024-08-02 at 09:27:32 +0800, maobibo wrote: > > > Hi Chenyu, > > > > > > On 2024/8/1 下午10:40, Chen Yu wrote: > > > > Hi Bibo, > > > > > > > > On 2024-08-01 at 16:00:19 +0800, maobibo wrote

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-08-02 Thread maobibo
Hi Chenyu, On 2024/8/2 下午3:56, Chen Yu wrote: On 2024-08-02 at 09:27:32 +0800, maobibo wrote: Hi Chenyu, On 2024/8/1 下午10:40, Chen Yu wrote: Hi Bibo, On 2024-08-01 at 16:00:19 +0800, maobibo wrote: Chenyu, I do not know much about x86, just give some comments(probably incorrected) from th

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-08-02 Thread Chen Yu
On 2024-08-02 at 09:27:32 +0800, maobibo wrote: > Hi Chenyu, > > On 2024/8/1 下午10:40, Chen Yu wrote: > > Hi Bibo, > > > > On 2024-08-01 at 16:00:19 +0800, maobibo wrote: > > > Chenyu, > > > > > > I do not know much about x86, just give some comments(probably > > > incorrected) > > > from the co

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-08-01 Thread maobibo
Hi Chenyu, On 2024/8/1 下午10:40, Chen Yu wrote: Hi Bibo, On 2024-08-01 at 16:00:19 +0800, maobibo wrote: Chenyu, I do not know much about x86, just give some comments(probably incorrected) from the code. On 2024/7/29 下午2:52, Chen Yu wrote: X86_FEATURE_HYPERVISOR YYY N CON

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-08-01 Thread Chen Yu
Hi Bibo, On 2024-08-01 at 16:00:19 +0800, maobibo wrote: > Chenyu, > > I do not know much about x86, just give some comments(probably incorrected) > from the code. > > On 2024/7/29 下午2:52, Chen Yu wrote: > > X86_FEATURE_HYPERVISOR YYY N > > CONFIG_PARAVIRT_SPINLOCKS Y

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-08-01 Thread maobibo
Chenyu, I do not know much about x86, just give some comments(probably incorrected) from the code. On 2024/7/29 下午2:52, Chen Yu wrote: The kernel can change spinlock behavior when running as a guest. But this guest-friendly behavior causes performance problems on bare metal. So there's a 'vir

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-07-30 Thread maobibo
On 2024/7/30 下午4:46, Chen Yu wrote: 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_enable

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-07-30 Thread Chen Yu
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(),

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-07-29 Thread maobibo
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.

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-07-29 Thread Chen Yu
Hi Thomas, On 2024-07-29 at 14:43:37 +0200, Thomas Gleixner wrote: > On Mon, Jul 29 2024 at 14:52, Chen Yu wrote: > > #ifdef CONFIG_PARAVIRT > > /* > > - * virt_spin_lock_key - enables (by default) the virt_spin_lock() hijack. > > + * virt_spin_lock_key - disables (by default) the virt_spin_lock

Re: [PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-07-29 Thread Thomas Gleixner
On Mon, Jul 29 2024 at 14:52, Chen Yu wrote: > #ifdef CONFIG_PARAVIRT > /* > - * virt_spin_lock_key - enables (by default) the virt_spin_lock() hijack. > + * virt_spin_lock_key - disables (by default) the virt_spin_lock() hijack. > * > * Native (and PV wanting native due to vCPU pinning) shou

[PATCH v4] x86/paravirt: Disable virt spinlock on bare metal

2024-07-28 Thread Chen Yu
The kernel can change spinlock behavior when running as a guest. But this guest-friendly behavior causes performance problems on bare metal. So there's a 'virt_spin_lock_key' static key to switch between the two modes. In current code, the static key is always enabled by default when running in gu