Hi, On Mon, Feb 3, 2025 at 2:18 AM Dmitry Osipenko <dmitry.osipenko@xxxxxxxxxxxxx> wrote: > > Hi, > > On 1/30/25 12:05, Ryosuke Yasuoka wrote: > ... > > +static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, > > + struct drm_scanout_buffer *sb) > > +{ > > + struct virtio_gpu_object *bo; > > + > > + if (!plane->state || !plane->state->fb || !plane->state->visible) > > + return -ENODEV; > > + > > + bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]); > > + if (virtio_gpu_is_vram(bo) || bo->base.base.import_attach) > > + return -ENODEV; > > + > > + /* try to vmap it if possible */ > > + if (!bo->base.vaddr) { > > + int ret; > > + > > + ret = drm_gem_shmem_vmap(&bo->base, &sb->map[0]); > > drm_gem_shmem_vmap() requires BO resv to be locked, it also may invoke > drm_gem_shmem_get_pages() that sleeps. This function can't be used in > atomic context. > > For the starter, let's reject !bo->base.vaddr BOs. Normally, shmem FB > BOs are always vmapped. OK. I'll reject !bo->base.vaddr BO in the next patch. I think this panic feature won't work when I call panic in GUI environment (I test in Gnome) without vmap(). It is OK as the first version but I think I should mention it somewhere. Where should I mention, in a commit message or in code like below? ~~~ static int virtio_drm_get_scanout_buffer(struct drm_plane *plane, struct drm_scanout_buffer *sb) { struct virtio_gpu_object *bo; if (!plane->state || !plane->state->fb || !plane->state->visible) return -ENODEV; bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]); /* Only support mapped shmem bo */ if (virtio_gpu_is_vram(bo) || bo->base.base.import_attach || !bo->base.vaddr) return -ENODEV; ~~~ > -- > Best regards, > Dmitry > Thank you for your comment. Ryosuke