Re: [RFC PATCH 12/18] virt/mshv: run vp ioctl and isr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 20, 2020 at 04:30:31PM -0800, Nuno Das Neves wrote:
[...]
> diff --git a/virt/mshv/mshv_main.c b/virt/mshv/mshv_main.c
> index c9445d2edb37..7ddb66d260ce 100644
> --- a/virt/mshv/mshv_main.c
> +++ b/virt/mshv/mshv_main.c
> @@ -17,6 +17,7 @@
>  #include <linux/mm.h>
>  #include <linux/io.h>
>  #include <linux/cpuhotplug.h>
> +#include <linux/random.h>
>  #include <linux/mshv.h>
>  #include <asm/mshyperv.h>
>  
> @@ -498,6 +499,240 @@ hv_call_set_vp_registers(u32 vp_index,
>  	return -hv_status_to_errno(status);
>  }
>  
> +static void
> +mshv_isr(void)
> +{
[...]
> +
> +	/* Hold this lock for the rest of the isr, because the partition could
> +	 * be released anytime.
> +	 * e.g. the MSHV_RUN_VP thread could wake on another cpu; it could
> +	 * release the partition unless we hold this!
> +	 */
> +	spin_lock_irqsave(&mshv.partitions.lock, flags);
> +

This should be switched to rwlock variant, otherwise vcpus can't run
concurrently.

You will take the read lock and only the ioctl that changes the list
will need to take the write lock.

There may be better and cheaper primitives than rwlock. Not sure if RCU
can be used in this context.

Wei.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux