lkml.org 
[lkml]   [2020]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 12/18] virt/mshv: run vp ioctl and isr
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.

\
 
 \ /
  Last update: 2020-11-24 17:17    [W:0.496 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site