On 2018-05-17 01:18 PM, Andrey Grodzovsky wrote: > Hi Michele and others, I am trying to implement the approach bellow to > resolve AMDGPU's hang when commands are stuck in pipe during process exit. > > I noticed that once I implemented the file_operation.flush callback > then during run of X, i see the flush callback gets called not only for > Xorg process but for other > > processes such as 'xkbcomp' and even 'sh', it seems like Xorg passes his > FDs to children, Christian mentioned he remembered a discussion to > always set FD_CLOEXEC flag when opening the hardware device file, so > > we suspect a bug in Xorg with regard to this behavior. Try the libdrm patch below. Note that the X server passes DRM file descriptors to DRI3 clients. diff --git a/xf86drm.c b/xf86drm.c index 3a9d0ed2..c09437b0 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -405,7 +405,7 @@ wait_for_udev: } #endif - fd = open(buf, O_RDWR, 0); + fd = open(buf, O_RDWR | O_CLOEXEC, 0); drmMsg("drmOpenDevice: open result is %d, (%s)\n", fd, fd < 0 ? strerror(errno) : "OK"); if (fd >= 0) @@ -425,7 +425,7 @@ wait_for_udev: chmod(buf, devmode); } } - fd = open(buf, O_RDWR, 0); + fd = open(buf, O_RDWR | O_CLOEXEC, 0); drmMsg("drmOpenDevice: open result is %d, (%s)\n", fd, fd < 0 ? strerror(errno) : "OK"); if (fd >= 0) @@ -474,7 +474,7 @@ static int drmOpenMinor(int minor, int create, int type) }; sprintf(buf, dev_name, DRM_DIR_NAME, minor); - if ((fd = open(buf, O_RDWR, 0)) >= 0) + if ((fd = open(buf, O_RDWR | O_CLOEXEC, 0)) >= 0) return fd; return -errno; } -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel