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

2019-07-04 Thread Jason Wang
On 2019/7/4 下午3:02, Tiwei Bie wrote: On Thu, Jul 04, 2019 at 02:35:20PM +0800, Jason Wang wrote: On 2019/7/4 下午2:21, Tiwei Bie wrote: On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: On 2019/7/3 下午9:08, Tiwei Bie wrote: On Wed, Jul 03, 2019 at 08:16:23PM +0800, Jason Wang wrote:

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

2019-07-04 Thread Tiwei Bie
On Fri, Jul 05, 2019 at 08:30:00AM +0800, Jason Wang wrote: > On 2019/7/4 下午3:02, Tiwei Bie wrote: > > On Thu, Jul 04, 2019 at 02:35:20PM +0800, Jason Wang wrote: > > > On 2019/7/4 下午2:21, Tiwei Bie wrote: > > > > On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: > > > > > On 2019/7/3

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

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:25 AM Gerd Hoffmann wrote: > > Hi, > > > > if (fence) > > > virtio_gpu_fence_emit(vgdev, hdr, fence); > > > + if (vbuf->objs) { > > > + virtio_gpu_array_add_fence(vbuf->objs, >f); > > > +

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

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:10 AM Gerd Hoffmann wrote: > > Hi, > > > > - r = ttm_bo_reserve(>tbo, true, false, NULL); > > > + r = reservation_object_lock_interruptible(bo->gem_base.resv, > > > NULL); > > Can you elaborate a bit about how TTM keeps the BOs alive in, for > > example,

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

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:48 AM Gerd Hoffmann wrote: > > On Wed, Jul 03, 2019 at 01:05:12PM -0700, Chia-I Wu wrote: > > 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

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

2019-07-04 Thread Chia-I Wu
On Thu, Jul 4, 2019 at 4:51 AM Gerd Hoffmann wrote: > > Hi, > > > > convert_to_hw_box(, >box); > > > if (!vgdev->has_virgl_3d) { > > > virtio_gpu_cmd_transfer_to_host_2d > > > - (vgdev, qobj, offset, > > > + (vgdev,

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

2019-07-04 Thread Jason Wang
On 2019/7/4 下午5:20, Stefano Garzarella wrote: This is still suspicious, can we access the_virtio_vsock through vdev->priv? If yes, we may still get use-after-free since it was not protected by RCU. We will free the object only after calling the del_vqs(), so we are sure that the vq_callbacks

Re: [PATCH v6 11/18] drm/virtio: switch from ttm to gem shmem helpers

2019-07-04 Thread Emil Velikov
Hi Gerd, On Tue, 2 Jul 2019 at 15:19, Gerd Hoffmann wrote: > .gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table, I think that you can drop this entry-point. AFAICT it's only purpose is to return an error - something already handled by core DRM when the function pointer is

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

2019-07-04 Thread Noralf Trønnes
Den 04.07.2019 13.10, skrev Thomas Zimmermann: > Hi > > Am 04.07.19 um 12:18 schrieb Noralf Trønnes: >> >> >> Den 04.07.2019 09.43, skrev Thomas Zimmermann: >>> Hi >>> >>> Am 03.07.19 um 21:27 schrieb Noralf Trønnes: Den 03.07.2019 10.32, skrev Thomas Zimmermann: > DRM client

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

2019-07-04 Thread Gerd Hoffmann
Hi, > > if (fence) > > virtio_gpu_fence_emit(vgdev, hdr, fence); > > + if (vbuf->objs) { > > + virtio_gpu_array_add_fence(vbuf->objs, >f); > > + virtio_gpu_array_unlock_resv(vbuf->objs); > > + } > This is with the spinlock held.

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

2019-07-04 Thread Gerd Hoffmann
On Wed, Jul 03, 2019 at 01:05:12PM -0700, Chia-I Wu wrote: > 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? obj

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

2019-07-04 Thread Gerd Hoffmann
Hi, > > convert_to_hw_box(, >box); > > if (!vgdev->has_virgl_3d) { > > virtio_gpu_cmd_transfer_to_host_2d > > - (vgdev, qobj, offset, > > + (vgdev, gem_to_virtio_gpu_obj(objs->objs[0]), > > offset, > >

Re: [PATCH v6 16/18] drm/virtio: rework virtio_gpu_cmd_context_{attach,detach}_resource

2019-07-04 Thread Gerd Hoffmann
On Tue, Jul 02, 2019 at 05:08:46PM -0700, Gurchetan Singh wrote: > 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 | 4 ++-- > >

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

2019-07-04 Thread Jason Wang
On 2019/7/4 下午2:21, Tiwei Bie wrote: On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: 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:

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

2019-07-04 Thread Tiwei Bie
On Thu, Jul 04, 2019 at 02:35:20PM +0800, Jason Wang wrote: > On 2019/7/4 下午2:21, Tiwei Bie wrote: > > On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: > > > 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

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

2019-07-04 Thread Thomas Zimmermann
Hi Am 03.07.19 um 16:07 schrieb 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

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

2019-07-04 Thread Thomas Zimmermann
Hi Am 03.07.19 um 21:27 schrieb 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

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

2019-07-04 Thread Stefano Garzarella
On Thu, Jul 04, 2019 at 11:58:00AM +0800, Jason Wang wrote: > > 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

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

2019-07-04 Thread Stefan Hajnoczi
On Wed, Jul 03, 2019 at 12:41:35PM +0200, 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: > > Another more interesting question, I believe we will do singleton for > > virtio_vsock structure. Then what's the

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

2019-07-04 Thread Gerd Hoffmann
> > + for (i = 0; i < nents; i++) { > > + objs->nents = i; > This line can be moved into the if-block just below. > > + objs->objs[i] = drm_gem_object_lookup(drm_file, handles[i]); > > + if (!objs->objs[i]) { > > +

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

2019-07-04 Thread Thomas Zimmermann
Hi Am 04.07.19 um 12:18 schrieb Noralf Trønnes: > > > Den 04.07.2019 09.43, skrev Thomas Zimmermann: >> Hi >> >> Am 03.07.19 um 21:27 schrieb Noralf Trønnes: >>> >>> >>> Den 03.07.2019 10.32, skrev Thomas Zimmermann: DRM client buffers are permanently mapped throughout their lifetime. This

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

2019-07-04 Thread Gerd Hoffmann
Hi, > > - r = ttm_bo_reserve(>tbo, true, false, NULL); > > + r = reservation_object_lock_interruptible(bo->gem_base.resv, NULL); > Can you elaborate a bit about how TTM keeps the BOs alive in, for > example, virtio_gpu_transfer_from_host_ioctl? In that function, only > three TTM

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

2019-07-04 Thread Noralf Trønnes
Den 04.07.2019 09.43, skrev Thomas Zimmermann: > Hi > > Am 03.07.19 um 21:27 schrieb 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

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

2019-07-04 Thread Gerd Hoffmann
> > > +int virtio_gpu_array_lock_resv(struct virtio_gpu_object_array *objs) > > > +{ > > > + return drm_gem_lock_reservations(objs->objs, objs->nents, > > > +>ticket); > Unlike in other drivers where an "object array" is only needed in > execbuffer, we

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

2019-07-04 Thread Tiwei Bie
On Thu, Jul 04, 2019 at 12:31:48PM +0800, Jason Wang wrote: > 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