From owner-freebsd-stable@freebsd.org Wed Sep 14 12:19:32 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCF83BDAFC6 for ; Wed, 14 Sep 2016 12:19:32 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id C7DF91170 for ; Wed, 14 Sep 2016 12:19:32 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: by mailman.ysv.freebsd.org (Postfix) id C4146BDAFC5; Wed, 14 Sep 2016 12:19:32 +0000 (UTC) Delivered-To: stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1A27BDAFC4 for ; Wed, 14 Sep 2016 12:19:32 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76A3A116E; Wed, 14 Sep 2016 12:19:32 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bk99w-00002I-8y; Wed, 14 Sep 2016 15:19:24 +0300 Date: Wed, 14 Sep 2016 15:19:24 +0300 From: Slawa Olhovchenkov To: Konstantin Belousov Cc: Andriy Gapon , stable@FreeBSD.org Subject: Re: X2APIC support Message-ID: <20160914121924.GA2840@zxy.spb.ru> References: <20160913121133.GX34394@zxy.spb.ru> <71a1f864-66de-0010-5024-e8e985f422f4@FreeBSD.org> <20160913124239.GZ34394@zxy.spb.ru> <20160913142118.GA34394@zxy.spb.ru> <37f5cebc-3fa1-9e95-5123-f3d8daa3130a@FreeBSD.org> <20160913152240.GE38409@kib.kiev.ua> <20160914113634.GF38409@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160914113634.GF38409@kib.kiev.ua> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 12:19:33 -0000 On Wed, Sep 14, 2016 at 02:36:34PM +0300, Konstantin Belousov wrote: > On Tue, Sep 13, 2016 at 06:52:19PM +0300, Andriy Gapon wrote: > > On 13/09/2016 18:22, Konstantin Belousov wrote: > > > Any access > > > to the LAPIC registers page in x2APIC mode faults. > > > > Is this a fact? > > I read the following in the specification: > > > > In x2APIC mode, the memory mapped interface is not available and any > > access to the MMIO interface will behave similar to that of a legacy xAPIC > > in globally disabled state. > > > > But I couldn't find what actually happens for the legacy xAPIC in globally > > disabled state. For AMD processors it is documented that if xAPIC is disabled > > then accessing the APIC memory range works the same as accessing the regular > > memory. That can be different for Intel processors, of course. > > Look at the native_lapic_init(), very beginning of the function. If > x2apic_mode is non-zero, lapic_map is cleared after DMAP page cache > attributes are changed. > > Right now, if BIOS pass control to OS in x2APIC mode, thinks just work > because no LAPIC accesses are done until native_lapic_enable_x2apic() is > called. This just happens, I thought about more organized receipt of the > current LAPIC mode. Issue is that decision for LAPIC mode is performed > by madt enumerator which pref. should not read LAPIC config (too early). > And it is not clear at all, what to do if there is reason to use xAPIC, > as checked by madt_setup_local(), but we are in x2APIC mode already. > > Anyway, returning to the original issue, I do not believe that the > hand-off on that machine occured in the x2APIC mode when X2APIC_OPT_OUT > is specified. Kernel would fault in that case. As I assume, other OS don't fault in this case.