[PATCH v2 0/9] x86: Concurrent TLB flushes

2019-07-03 Thread Nadav Amit via Virtualization
Currently, local and remote TLB flushes are not performed concurrently, which introduces unnecessary overhead - each INVLPG can take 100s of cycles. This patch-set allows TLB flushes to be run concurrently: first request the remote CPUs to initiate the flush, then run it locally, and finally wait

[PATCH v2 4/9] x86/mm/tlb: Flush remote and local TLBs concurrently

2019-07-03 Thread Nadav Amit via Virtualization
To improve TLB shootdown performance, flush the remote and local TLBs concurrently. Introduce flush_tlb_multi() that does so. Introduce paravirtual versions of flush_tlb_multi() for KVM, Xen and hyper-v (Xen and hyper-v are only compile-tested). While the updated smp infrastructure is capable of

Re: [PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-07-03 Thread Stefano Garzarella
On Wed, Jul 03, 2019 at 05:53:58PM +0800, Jason Wang wrote: > > On 2019/6/28 下午8:36, Stefano Garzarella wrote: > > Some callbacks used by the upper layers can run while we are in the > > .remove(). A potential use-after-free can happen, because we free > > the_virtio_vsock without knowing if the

[PATCH 3/5] drm/ast: Replace struct ast_fbdev with generic framebuffer emulation

2019-07-03 Thread Thomas Zimmermann
This patch replaces ast's framebuffer console with DRM's generic implememtation. All respective code is being removed from the driver. The console is set up with a shadow buffer. The actual buffer object is not permanently pinned in video ram, but just another buffer object that the driver moves

[PATCH 1/5] drm/client: Support unmapping of DRM client buffers

2019-07-03 Thread Thomas Zimmermann
DRM clients, such as the fbdev emulation, have their buffer objects mapped by default. Mapping a buffer implicitly prevents its relocation. Hence, the buffer may permanently consume video memory while it's allocated. This is a problem for drivers of low-memory devices, such as ast, mgag200 or

[PATCH 4/5] drm/bochs: Use shadow buffer for bochs framebuffer console

2019-07-03 Thread Thomas Zimmermann
The bochs driver (and virtual hardware) requires buffer objects to reside in video ram to display them to the screen. So it can not display the framebuffer console because the respective buffer object is permanently pinned in system memory. Using a shadow buffer for the console solves this

[PATCH 5/5] drm/mgag200: Replace struct mga_fbdev with generic framebuffer emulation

2019-07-03 Thread Thomas Zimmermann
This patch replaces mgag200's framebuffer console with DRM's generic implememtation. All respective code is being removed from the driver. The console is set up with a shadow buffer. The actual buffer object is not permanently pinned in video ram, but just another buffer object that the driver

[PATCH 0/5] Unmappable DRM client buffers for fbdev emulation

2019-07-03 Thread Thomas Zimmermann
DRM client buffers are permanently mapped throughout their lifetime. This prevents us from using generic framebuffer emulation for devices with small dedicated video memory, such as ast or mgag200. With fb buffers permanently mapped, such devices often won't have enougth space left to display

[PATCH 2/5] drm/fb-helper: Unmap BO for shadow-buffered framebuffer console

2019-07-03 Thread Thomas Zimmermann
The shadow-buffered framebuffer console only needs the buffer object to be mapped during updates. While not being updated from the shadow buffer, the buffer object can remain unmapped. An unmapped buffer object can be evicted to system memory and does not consume video ram until displayed. This

Re: [PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-07-03 Thread Jason Wang
On 2019/6/28 下午8:36, Stefano Garzarella wrote: Some callbacks used by the upper layers can run while we are in the .remove(). A potential use-after-free can happen, because we free the_virtio_vsock without knowing if the callbacks are over or not. To solve this issue we move the assignment of

Re: [PATCH v2 0/3] vsock/virtio: several fixes in the .probe() and .remove()

2019-07-03 Thread Stefan Hajnoczi
On Mon, Jul 01, 2019 at 07:03:57PM +0200, Stefano Garzarella wrote: > On Mon, Jul 01, 2019 at 04:11:13PM +0100, Stefan Hajnoczi wrote: > > On Fri, Jun 28, 2019 at 02:36:56PM +0200, Stefano Garzarella wrote: > > > During the review of "[PATCH] vsock/virtio: Initialize core virtio vsock > > > before

[RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Tiwei Bie
Details about this can be found here: https://lwn.net/Articles/750770/ What's new in this version == A new VFIO device type is introduced - vfio-vhost. This addressed some comments from here: https://patchwork.ozlabs.org/cover/984763/ Below is the updated device

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Jason Wang
On 2019/7/3 下午5:13, Tiwei Bie wrote: Details about this can be found here: https://lwn.net/Articles/750770/ What's new in this version == A new VFIO device type is introduced - vfio-vhost. This addressed some comments from here:

Re: [PATCH v2 0/3] vsock/virtio: several fixes in the .probe() and .remove()

2019-07-03 Thread Stefano Garzarella
On Wed, Jul 03, 2019 at 10:14:53AM +0100, Stefan Hajnoczi wrote: > On Mon, Jul 01, 2019 at 07:03:57PM +0200, Stefano Garzarella wrote: > > On Mon, Jul 01, 2019 at 04:11:13PM +0100, Stefan Hajnoczi wrote: > > > On Fri, Jun 28, 2019 at 02:36:56PM +0200, Stefano Garzarella wrote: > > > > During the

Re: [PATCH 3/5] drm/ast: Replace struct ast_fbdev with generic framebuffer emulation

2019-07-03 Thread Noralf Trønnes
Den 03.07.2019 10.33, skrev Thomas Zimmermann: > This patch replaces ast's framebuffer console with DRM's generic > implememtation. All respective code is being removed from the driver. > > The console is set up with a shadow buffer. The actual buffer object is > not permanently pinned in video

Re: [PATCH 4/5] drm/bochs: Use shadow buffer for bochs framebuffer console

2019-07-03 Thread Noralf Trønnes
Den 03.07.2019 10.33, skrev Thomas Zimmermann: > The bochs driver (and virtual hardware) requires buffer objects to > reside in video ram to display them to the screen. So it can not > display the framebuffer console because the respective buffer object > is permanently pinned in system memory.

Re: [PATCH 5/5] drm/mgag200: Replace struct mga_fbdev with generic framebuffer emulation

2019-07-03 Thread Noralf Trønnes
Den 03.07.2019 10.33, skrev Thomas Zimmermann: > This patch replaces mgag200's framebuffer console with DRM's generic > implememtation. All respective code is being removed from the driver. > > The console is set up with a shadow buffer. The actual buffer object is > not permanently pinned in

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Tiwei Bie
On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang wrote: > On 2019/7/3 下午5:13, Tiwei Bie wrote: > > Details about this can be found here: > > > > https://lwn.net/Articles/750770/ > > > > What's new in this version > > == > > > > A new VFIO device type is introduced -

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Tiwei Bie
On Wed, Jul 03, 2019 at 08:16:23PM +0800, Jason Wang wrote: > On 2019/7/3 下午7:52, Tiwei Bie wrote: > > On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang wrote: > > > On 2019/7/3 下午5:13, Tiwei Bie wrote: > > > > Details about this can be found here: > > > > > > > >

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Jason Wang
On 2019/7/3 下午7:52, Tiwei Bie wrote: On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang wrote: On 2019/7/3 下午5:13, Tiwei Bie wrote: Details about this can be found here: https://lwn.net/Articles/750770/ What's new in this version == A new VFIO device type is

Re: [PATCH 1/5] drm/client: Support unmapping of DRM client buffers

2019-07-03 Thread Noralf Trønnes
Den 03.07.2019 10.32, skrev Thomas Zimmermann: > DRM clients, such as the fbdev emulation, have their buffer objects > mapped by default. Mapping a buffer implicitly prevents its relocation. > Hence, the buffer may permanently consume video memory while it's > allocated. This is a problem for

Re: [PATCH v2 4/9] x86/mm/tlb: Flush remote and local TLBs concurrently

2019-07-03 Thread Juergen Gross
On 03.07.19 01:51, Nadav Amit wrote: To improve TLB shootdown performance, flush the remote and local TLBs concurrently. Introduce flush_tlb_multi() that does so. Introduce paravirtual versions of flush_tlb_multi() for KVM, Xen and hyper-v (Xen and hyper-v are only compile-tested). While the

Re: [PATCH v6 06/18] drm/virtio: remove ttm calls from in virtio_gpu_object_{reserve, unreserve}

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Call reservation_object_* directly instead > of using ttm_bo_{reserve,unreserve}. > > v4: check for EINTR only. > v3: check for EINTR too. > > Signed-off-by: Gerd Hoffmann > Reviewed-by: Daniel Vetter > --- >

Re: [PATCH v2 4/9] x86/mm/tlb: Flush remote and local TLBs concurrently

2019-07-03 Thread Nadav Amit via Virtualization
> On Jul 3, 2019, at 7:04 AM, Juergen Gross wrote: > > On 03.07.19 01:51, Nadav Amit wrote: >> To improve TLB shootdown performance, flush the remote and local TLBs >> concurrently. Introduce flush_tlb_multi() that does so. Introduce >> paravirtual versions of flush_tlb_multi() for KVM, Xen and

Re: [Xen-devel] [PATCH v2 4/9] x86/mm/tlb: Flush remote and local TLBs concurrently

2019-07-03 Thread Andrew Cooper
On 03/07/2019 18:02, Nadav Amit wrote: >> On Jul 3, 2019, at 7:04 AM, Juergen Gross wrote: >> >> On 03.07.19 01:51, Nadav Amit wrote: >>> To improve TLB shootdown performance, flush the remote and local TLBs >>> concurrently. Introduce flush_tlb_multi() that does so. Introduce >>> paravirtual

Re: [Xen-devel] [PATCH v2 4/9] x86/mm/tlb: Flush remote and local TLBs concurrently

2019-07-03 Thread Nadav Amit via Virtualization
> On Jul 3, 2019, at 10:43 AM, Andrew Cooper wrote: > > On 03/07/2019 18:02, Nadav Amit wrote: >>> On Jul 3, 2019, at 7:04 AM, Juergen Gross wrote: >>> >>> On 03.07.19 01:51, Nadav Amit wrote: To improve TLB shootdown performance, flush the remote and local TLBs concurrently.

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Alex Williamson
On Wed, 3 Jul 2019 17:13:39 +0800 Tiwei Bie wrote: > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index 8f10748dac79..6c5718ab7eeb 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -201,6 +201,7 @@ struct vfio_device_info { > #define

Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Rework fencing workflow, starting with virtio_gpu_execbuffer_ioctl. > Stop using ttm helpers, use the virtio_gpu_array_* helpers (which work > on the reservation objects directly) instead. > > New workflow: > > (1) All gem objects needed by

Re: [PATCH 0/5] Unmappable DRM client buffers for fbdev emulation

2019-07-03 Thread Noralf Trønnes
Den 03.07.2019 10.32, skrev Thomas Zimmermann: > DRM client buffers are permanently mapped throughout their lifetime. This > prevents us from using generic framebuffer emulation for devices with > small dedicated video memory, such as ast or mgag200. With fb buffers > permanently mapped, such

Re: [PATCH v6 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Some helper functions to manage an array of gem objects. > > v6: > - add ticket to struct virtio_gpu_object_array. > - add virtio_gpu_array_{lock,unlock}_resv helpers. > - add virtio_gpu_array_add_fence helper. > v5: some small

Re: [PATCH v2 06/35] crypto: Use kmemdup rather than duplicating its implementation

2019-07-03 Thread Michael S. Tsirkin
On Thu, Jul 04, 2019 at 12:27:08AM +0800, Fuqian Huang wrote: > kmemdup is introduced to duplicate a region of memory in a neat way. > Rather than kmalloc/kzalloc + memcpy, which the programmer needs to > write the size twice (sometimes lead to mistakes), kmemdup improves > readability, leads to

Re: [PATCH v6 07/18] drm/virtio: add virtio_gpu_object_array & helpers

2019-07-03 Thread Chia-I Wu
On Wed, Jul 3, 2019 at 11:31 AM Chia-I Wu wrote: > > On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > > > Some helper functions to manage an array of gem objects. > > > > v6: > > - add ticket to struct virtio_gpu_object_array. > > - add virtio_gpu_array_{lock,unlock}_resv helpers. > >

Re: [PATCH v6 15/18] drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Switch to the virtio_gpu_array_* helper workflow. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 43 -- >

Re: [PATCH v6 14/18] drm/virtio: rework virtio_gpu_transfer_from_host_ioctl fencing

2019-07-03 Thread Chia-I Wu
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > > Switch to the virtio_gpu_array_* helper workflow. (just repeating my question on patch 6) Does this fix the obj refcount issue? When was the issue introduced? > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Tiwei Bie
On Wed, Jul 03, 2019 at 12:31:57PM -0600, Alex Williamson wrote: > On Wed, 3 Jul 2019 17:13:39 +0800 > Tiwei Bie wrote: > > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > > index 8f10748dac79..6c5718ab7eeb 100644 > > --- a/include/uapi/linux/vfio.h > > +++

Re: [PATCH v2 2/3] vsock/virtio: stop workers during the .remove()

2019-07-03 Thread Jason Wang
On 2019/6/28 下午8:36, Stefano Garzarella wrote: Before to call vdev->config->reset(vdev) we need to be sure that no one is accessing the device, for this reason, we add new variables in the struct virtio_vsock to stop the workers during the .remove(). This patch also add few comments before

Re: [PATCH v2 1/3] vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock

2019-07-03 Thread Jason Wang
On 2019/7/3 下午6:41, Stefano Garzarella wrote: On Wed, Jul 03, 2019 at 05:53:58PM +0800, Jason Wang wrote: On 2019/6/28 下午8:36, Stefano Garzarella wrote: Some callbacks used by the upper layers can run while we are in the .remove(). A potential use-after-free can happen, because we free

Re: [RFC v2] vhost: introduce mdev based hardware vhost backend

2019-07-03 Thread Jason Wang
On 2019/7/3 下午9:08, Tiwei Bie wrote: On Wed, Jul 03, 2019 at 08:16:23PM +0800, Jason Wang wrote: On 2019/7/3 下午7:52, Tiwei Bie wrote: On Wed, Jul 03, 2019 at 06:09:51PM +0800, Jason Wang wrote: On 2019/7/3 下午5:13, Tiwei Bie wrote: Details about this can be found here: