Re: [PATCH v7 11/12] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-05-19 Thread Al Viro
On Mon, May 17, 2021 at 05:55:12PM +0800, Xie Yongji wrote: > + case VDUSE_IOTLB_GET_FD: { > + struct vduse_iotlb_entry entry; > + struct vhost_iotlb_map *map; > + struct vdpa_map_file *map_file; > + struct vduse_iova_domain *domain = dev->domain

Re: [PATCH v7 02/12] file: Export receive_fd() to modules

2021-05-19 Thread Al Viro
On Mon, May 17, 2021 at 05:55:03PM +0800, Xie Yongji wrote: > Export receive_fd() so that some modules can use > it to pass file descriptor between processes without > missing any security stuffs. Which tree is that against? Because in mainline this won't even build, let alone work. > --- a/fs/f

Re: [PATCH v7 00/12] Introduce VDUSE - vDPA Device in Userspace

2021-05-19 Thread Michael S. Tsirkin
On Mon, May 17, 2021 at 05:55:01PM +0800, Xie Yongji wrote: > This series introduces a framework, which can be used to implement > vDPA Devices in a userspace program. The work consist of two parts: > control path forwarding and data path offloading. > > In the control path, the VDUSE driver will

Re: Re: [PATCH v7 04/12] virtio-blk: Add validation for block size in config space

2021-05-19 Thread Michael S. Tsirkin
On Thu, May 20, 2021 at 01:25:16PM +0800, Yongji Xie wrote: > On Wed, May 19, 2021 at 10:42 PM Dan Carpenter > wrote: > > > > On Wed, May 19, 2021 at 09:39:20PM +0800, Yongji Xie wrote: > > > On Mon, May 17, 2021 at 5:56 PM Xie Yongji > > > wrote: > > > > > > > > This ensures that we will not u

Re: [PATCH v2 5/8] x86/sev-es: Leave NMI-mode before sending signals

2021-05-19 Thread Peter Zijlstra
On Wed, May 19, 2021 at 09:13:08PM +0200, Joerg Roedel wrote: > Hi Peter, > > thanks for your review. > > On Wed, May 19, 2021 at 07:54:50PM +0200, Peter Zijlstra wrote: > > On Wed, May 19, 2021 at 03:52:48PM +0200, Joerg Roedel wrote: > > > --- a/arch/x86/kernel/sev.c > > > +++ b/arch/x86/kernel

Re: [PATCH v2 5/8] x86/sev-es: Leave NMI-mode before sending signals

2021-05-19 Thread Joerg Roedel
Hi Peter, thanks for your review. On Wed, May 19, 2021 at 07:54:50PM +0200, Peter Zijlstra wrote: > On Wed, May 19, 2021 at 03:52:48PM +0200, Joerg Roedel wrote: > > --- a/arch/x86/kernel/sev.c > > +++ b/arch/x86/kernel/sev.c > > @@ -1343,9 +1343,10 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_commun

Re: [PATCH v2 5/8] x86/sev-es: Leave NMI-mode before sending signals

2021-05-19 Thread Peter Zijlstra
On Wed, May 19, 2021 at 03:52:48PM +0200, Joerg Roedel wrote: > --- a/arch/x86/kernel/sev.c > +++ b/arch/x86/kernel/sev.c > @@ -1343,9 +1343,10 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) > return; > } > > + instrumentation_begin(); > + > irq_state = irqe

Re: [PATCH v7 04/12] virtio-blk: Add validation for block size in config space

2021-05-19 Thread Dan Carpenter
On Wed, May 19, 2021 at 09:39:20PM +0800, Yongji Xie wrote: > On Mon, May 17, 2021 at 5:56 PM Xie Yongji wrote: > > > > This ensures that we will not use an invalid block size > > in config space (might come from an untrusted device). I looked at if I should add this as an untrusted function so t

Re: [Bloat] virtio_net: BQL?

2021-05-19 Thread Eric Dumazet
On 5/18/21 1:00 AM, Stephen Hemminger wrote: > > The Azure network driver (netvsc) also does not have BQL. Several years ago > I tried adding it but it benchmarked worse and there is the added complexity > of handling the accelerated networking VF path. > Note that NIC with many TX queues m

[PATCH -next] vp_vdpa: fix error return code in vp_vdpa_probe()

2021-05-19 Thread Wei Yongjun
Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function. Fixes: 11d8ffed00b2 ("vp_vdpa: switch to use vp_modern_map_vq_notify()") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- drivers/vdpa/virtio_pci/vp_vdpa.c | 1 + 1 fil

[PATCH v2 7/8] x86/insn: Extend error reporting from insn_fetch_from_user[_inatomic]()

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel The error reporting from the insn_fetch_from_user*() functions is not very verbose. Extend it to include information on whether the linear RIP could not be calculated or whether the memory access faulted. This will be used in the SEV-ES code to propagate the correct exception

[PATCH v2 5/8] x86/sev-es: Leave NMI-mode before sending signals

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel The error path in the runtime #VC handler sends a signal to kill the current task if the exception was raised from user-space. Some parts of the #VC handler run in NMI mode, because it is critical that it is not interrupted (except from an NMI) while the GHCB is in use. But se

[PATCH v2 1/8] x86/sev-es: Don't return NULL from sev_es_get_ghcb()

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel The sev_es_get_ghcb() is called from several places, but only one of them checks the return value. The reaction to returning NULL is always the same: Calling panic() and kill the machine. Instead of adding checks to all call-places, move the panic() into the function itself so

[PATCH v2 2/8] x86/sev-es: Forward page-faults which happen during emulation

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel When emulating guest instructions for MMIO or IOIO accesses the #VC handler might get a page-fault and will not be able to complete. Forward the page-fault in this case to the correct handler instead of killing the machine. Fixes: 0786138c78e7 ("x86/sev-es: Add a Runtime #VC E

[PATCH v2 6/8] x86/insn-eval: Make 0 a valid RIP for insn_get_effective_ip()

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel In theory 0 is a valid value for the instruction pointer, so don't use it as the error return value from insn_get_effective_ip(). Signed-off-by: Joerg Roedel --- arch/x86/lib/insn-eval.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/

[PATCH v2 8/8] x86/sev-es: Propagate #GP if getting linear instruction address failed

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel When an instruction is fetched from user-space, segmentation needs to be taken into account. This means that getting the linear address of an instruction can fail. Hardware would raise a #GP exception in that case, but the #VC exception handler would emulate it as a page-fault.

[PATCH v2 3/8] x86/sev-es: Use __put_user()/__get_user() for data accesses

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel The put_user() and get_user() functions do checks on the address which is passed to them. They check whether the address is actually a user-space address and whether its fine to access it. They also call might_fault() to indicate that they could fault and possibly sleep. All o

[PATCH v2 4/8] x86/sev-es: Fix error message in runtime #VC handler

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel The runtime #VC handler is not "early" anymore. Fix the copy&paste error and remove that word from the error message. Signed-off-by: Joerg Roedel --- arch/x86/kernel/sev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/sev.c b/arch/x86/ke

[PATCH v2 0/8] x86/sev-es: Fixes for SEV-ES Guest Support

2021-05-19 Thread Joerg Roedel
From: Joerg Roedel Hi, here is the second version of my pending SEV-ES fixes. The most important patches are patch 1 to 5, as they fix warnings and splats that trigger with various debugging options are enabled. Patches 6 to 8 fix a correctness issue in the instruction emulation part of the #VC

Re: [PATCH] virtio: Introduce a new kick interface virtqueue_kick_try()

2021-05-19 Thread Xuan Zhuo
On Wed, 19 May 2021 08:44:01 -0400, Michael S. Tsirkin wrote: > On Wed, May 19, 2021 at 07:47:57PM +0800, Xuan Zhuo wrote: > > Unlike virtqueue_kick(), virtqueue_kick_try() returns true only when the > > kick is successful. In virtio-net, we want to count the number of kicks. > > So we need an int

Re: [PATCH 2/6] x86/sev-es: Forward page-faults which happen during emulation

2021-05-19 Thread Joerg Roedel
Hi Sean, On Wed, May 12, 2021 at 05:31:03PM +, Sean Christopherson wrote: > This got me looking at the flows that "inject" #PF, and I'm pretty sure there > are bugs in __vc_decode_user_insn() + insn_get_effective_ip(). > > Problem #1: __vc_decode_user_insn() assumes a #PF if > insn_fetch_fro

Re: [PATCH] virtio: Introduce a new kick interface virtqueue_kick_try()

2021-05-19 Thread Michael S. Tsirkin
On Wed, May 19, 2021 at 07:47:57PM +0800, Xuan Zhuo wrote: > Unlike virtqueue_kick(), virtqueue_kick_try() returns true only when the > kick is successful. In virtio-net, we want to count the number of kicks. > So we need an interface that can perceive whether the kick is actually > executed. > >

Re: [PATCH 4/6] Revert "x86/sev-es: Handle string port IO to kernel memory properly"

2021-05-19 Thread Joerg Roedel
On Wed, May 12, 2021 at 05:38:29PM +, Sean Christopherson wrote: > Alternatively, and probably even better, fold this revert into the switch to > the unchecked version (sounds like those will use kernel-specific flavors?). I folded this revert into the previous commit. But I kept the __get_use

[PATCH] virtio: Introduce a new kick interface virtqueue_kick_try()

2021-05-19 Thread Xuan Zhuo
Unlike virtqueue_kick(), virtqueue_kick_try() returns true only when the kick is successful. In virtio-net, we want to count the number of kicks. So we need an interface that can perceive whether the kick is actually executed. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 8 --

Re: [PATCH 3/6] x86/sev-es: Use __put_user()/__get_user

2021-05-19 Thread 'Joerg Roedel'
On Wed, May 12, 2021 at 11:32:35AM +0200, Joerg Roedel wrote: > On Wed, May 12, 2021 at 10:58:20AM +0200, Juergen Gross wrote: > > No, those were used before, but commit 9da3f2b7405440 broke Xen's use > > case. That is why I did commit 1457d8cf7664f. > > [...] > > Having the distinction between use

Re: virtio_net: BQL?

2021-05-19 Thread Michael S. Tsirkin
On Mon, May 17, 2021 at 11:43:43AM -0700, Dave Taht wrote: > Not really related to this patch, but is there some reason why virtio > has no support for BQL? So just so you can try it out, I rebased my old patch. XDP is handled incorrectly by it so we shouldn't apply it as is, but should be good en