Thomas Hellstrom wrote: > Jakob Bornecrantz wrote: > >> On 1 dec 2009, at 00.24, Robert Noland wrote: >> >> >>> On Tue, 2009-12-01 at 10:37 +1100, Daniel Stone wrote: >>> >>> >>>> On Mon, Nov 30, 2009 at 11:21:47AM -0600, Robert Noland wrote: >>>> >>>> >>>>> I've tried to ask linux folk if this is also true for linux, but the >>>>> answer is unclear at this time. >>>>> >>>>> >>>> EINTR will be returned to userspace if the syscall needs to be >>>> restarted. >>>> >>>> >>> Ok, EINTR is already handled in drmIoctl() as is EAGAIN, so that >>> sounds >>> like my patch would be correct. >>> >>> >> Hmm looks like we need to change bunch of stuff in ttm and the vmwgfx >> for that to be true. I still like to get Thomas comments on this >> before we do anything drastic. >> >> >> > Yes, there is some stuff we need to change here, really. > > As previously pointed out by people on the dri-devel list (Kristian > among others), if the linux kernel returns > -ERESTARTSYS, and the kernel cannot restart the system call AND there is > a signal pending, the kernel (not libc) will convert it to -EINTR and > return to user-space. -ERESTARTSYS may only be returned when there is a > signal pending. > > I'm not sure this is the case with -ERESTART. IIRC I've seen man pages > with kernel calls return -ERESTART, but I'm not sure at this point. Best > would be to test and see what happens. > > Having said that. I don't think we should change this *now*. If BSD > converts -ERESTART to -EINTR, that will get caught in drmCommandXXX and > functionality will be preserved. > > However, before pushing wmwgfx upstream, and before the Radeon > user-space interface is set in stone, we should change the TTM code to > return -ERESTARTSYS when a signal is pending, meaning that if it returns > to user-space, we'll get an -EINTR. At the same time we could apply the > suggested patch. If TTM is ported to BSD, and -ERESTARTSYS doesn't exist > in BST, the BSD version should return something that will appear as > -EINTR in user space. > > So to summarize: > > *) I don't think the patch is correct with the current linux wmw / ttm code. > *) We should change the ttm / vmw code ASAP so that the patch becomes > correct. When this is done, we should apply it. > > Thanks, > > Thomas > I just double-checked this, and indeed -ERESTART is returned to user-space, so the patch is currently incorrect on its own.
That said, I believe -ERESTART should not be used in the common case. Perhaps if we for some reason need to return to user-space without a pending signal. Better, as mentioned above to use -ERESTARTSYS. Then, If I understand things correctly, the kernel will automatically restart the system call if possible, otherwise return -EINTR to user-space. /Thomas ------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Mesa3d-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
