Date: Tue, 1 Mar 2005 13:31:17 -0500 From: John Baldwin <jhb@FreeBSD.org> To: freebsd-hackers@FreeBSD.org Cc: Denis Ustimenko <denus@ngs.ru> Subject: Re: TDF_NEEDRESCHED when extending pcb on x86 Message-ID: <200503011331.17677.jhb@FreeBSD.org> In-Reply-To: <200502281606.50074.peter@wemm.org> References: <4223A1D1.6000104@ngs.ru> <200502281606.50074.peter@wemm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 28 February 2005 07:06 pm, Peter Wemm wrote:
> 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.
Forcing a context switch is a rather round-about way of getting ltr to be
executed though. We already have intimate knowledge of TSS, etc. in this
file anyway, so I wonder if just doing the ltr() directly is the better
approach?
--
John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503011331.17677.jhb>
