TDF_NEEDRESCHED when extending pcb on x86
Peter Wemm
peter at wemm.org
Tue Mar 1 00:07:15 GMT 2005
On Monday 28 February 2005 02:57 pm, Denis Ustimenko wrote:
> Hi, there!
>
> I've tried s3switch utility from ports on 5.2.1 and found that
> i386_set_ioperm syscall doesn't work properly. The next code illustrates
> the problem. It will get SIGBUS with very high probability.
>
> #include <sys/types.h>
> #include <machine/sysarch.h>
> #include <machine/cpufunc.h>
>
> int main()
> {
> if ( i386_set_ioperm( 0x80, 1, 1)) {
> perror("XXX");
> return 1;
> }
> inb( 0x80);
> return 0;
> }
>
> Now I have no 5.3 or CURRENT system but brief looking on code shows that
> it should give the same result on them.
> The problem occurs when we extend pcb and set TDF_NEEDRESCHED bit hoping
> that thread will be rescheduled and new TSS will be loaded. But
> sched_switch function skips cpu_switch when thread was not changed and
> ltr is not executed.
I think it would be better to fix the semantics of TDF_NEEDRESCHED. I was
thinking that mi_switch could negate the cpu_switch optimization if
TDF_NEEDRESCHED was set. That would avoid duplicating the internal knowledge
of the pcb/tss/etc handling in this code.
-Peter
More information about the freebsd-hackers
mailing list