Repository navigation
vconsole-setup: skip fonts copy if the current terminal is in graphic… - #11130
Conversation
|
What is the error returned from the |
|
As written in the commit message, the kernel returns EINVAL in such case so it seems too generic. Also I'm not sure how we could fix the race from userspace: we need to do the following sequence atomically "if tty in text mode then copy fonts", not something doable AFAIK. |
|
What about the following: instead of calling KDGETMODE first, only call it if KDFONTOP fails? This doesn't remove the race, but makes it less important. In general, we mostly expect terminals to go through text mode to graphical mode, and stay so, especially during boot. So we'd still have a possible race, but we'd only hit it is something was holding the terminal and gave it up, which seems to be much less likely event. Then if the KDGETMODE reports != KD_TEXT, assume the terminal is busy and only do It'd have been nice the kernel returned EBUSY. Maybe we could patch the kernel too? This would provide a nicer long-term solution. |
|
That sounds good, I'll change the patch accordingly. |
|
also a bit of debug logging would be good, that says what happens. |
2475d71 to
4152e99
Compare
|
@keszybz new version pushed. It includes your feedback. PTAL. |
|
@mrc0mmand could you skip |
|
@evverx will do. Also, I'll re-trigger the CentOS CI job to get more relevant results. |
There was a problem hiding this comment.
So... last_errno is either a postive errno value, or a negative -EBUSY. Also, the synthethic -EBUSY is logged and returned.
This will work fine, but somehow it feels wrong. I think that the original errno should be returned (even if it is always -EINVAL now, but the kernel could change). So what about using a separate boolean for ioctl(fd_d, KDGETMODE, &mode) >= 0 && mode != KD_TEXT instead?
There was a problem hiding this comment.
If we do that it won't be obvious that the font copy failed because the terminal is busy.
…aphical mode If the terminal is in graphical mode, the kernel will refuse to copy the fonts and will return -EINVAL. Also having the graphical mode in effect probably indicates that the terminal is in used by another application and we shouldn't interfer in such cases.
4152e99 to
8240dec
Compare
|
@keszybz how about this instead ? |
…al mode
If the terminal is in graphical mode, the kernel will refuse to copy the fonts
and will return -EINVAL.
Also having the graphical mode in effect probably indicates that the terminal
is in used by another application and we shouldn't interfer in such cases.
Note that the check (as well as the others) is racy.