From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 1 00:07:15 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F2DCE16A4CE for ; Tue, 1 Mar 2005 00:07:14 +0000 (GMT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id C8C5843D46 for ; Tue, 1 Mar 2005 00:07:14 +0000 (GMT) (envelope-from peter@wemm.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id 8A9602A8DD for ; Mon, 28 Feb 2005 16:07:14 -0800 (PST) (envelope-from peter@wemm.org) Received: from peter-laptop.wemm.org (dhcp51.wemm.org [10.0.0.51]) by fw.wemm.org (Postfix) with ESMTP id 2CA3DE2B3 for ; Mon, 28 Feb 2005 16:07:14 -0800 (PST) (envelope-from peter@wemm.org) Received: from peter-laptop.wemm.org (localhost [127.0.0.1]) by peter-laptop.wemm.org (8.13.3/8.13.3) with ESMTP id j2106pxM001604; Mon, 28 Feb 2005 16:06:51 -0800 (PST) (envelope-from peter@wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by peter-laptop.wemm.org (8.13.3/8.13.3/Submit) id j2106oNT001603; Mon, 28 Feb 2005 16:06:50 -0800 (PST) (envelope-from peter@wemm.org) X-Authentication-Warning: peter-laptop.wemm.org: peter set sender to peter@wemm.org using -f From: Peter Wemm To: freebsd-hackers@freebsd.org Date: Mon, 28 Feb 2005 16:06:49 -0800 User-Agent: KMail/1.7.2 References: <4223A1D1.6000104@ngs.ru> In-Reply-To: <4223A1D1.6000104@ngs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502281606.50074.peter@wemm.org> cc: Denis Ustimenko Subject: Re: TDF_NEEDRESCHED when extending pcb on x86 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Mar 2005 00:07:15 -0000 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 > #include > #include > > 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