Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Feb 2005 16:06:49 -0800
From:      Peter Wemm <peter@wemm.org>
To:        freebsd-hackers@freebsd.org
Cc:        Denis Ustimenko <denus@ngs.ru>
Subject:   Re: TDF_NEEDRESCHED when extending pcb on x86
Message-ID:  <200502281606.50074.peter@wemm.org>
In-Reply-To: <4223A1D1.6000104@ngs.ru>
References:  <4223A1D1.6000104@ngs.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502281606.50074.peter>