From owner-freebsd-current@freebsd.org Mon Nov 12 18:09:20 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 788AB110D27D for ; Mon, 12 Nov 2018 18:09:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 B90C97B6E8 for ; Mon, 12 Nov 2018 18:09:19 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wACI93q7013497 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 12 Nov 2018 20:09:06 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wACI93q7013497 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wACI93ME013496; Mon, 12 Nov 2018 20:09:03 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 12 Nov 2018 20:09:03 +0200 From: Konstantin Belousov To: Guido Falsi Cc: freebsd-current@freebsd.org Subject: Re: 13.0 failing to boot multiuser on one PC due to system utilities crashing during rc scipt Message-ID: <20181112180903.GC2378@kib.kiev.ua> References: <62bdb5ff-4d68-cf52-4dd5-f0a3cfa1c788@madpilot.net> <791e3488-b838-5cfd-8dca-8db8c74167a0@madpilot.net> <20181110230744.GN2378@kib.kiev.ua> <5176caee-126f-2709-d09a-0dcf5190e319@madpilot.net> <20181111211434.GS2378@kib.kiev.ua> <20181112143353.GX2378@kib.kiev.ua> <9100b044-0d94-4933-f43c-a8aebd42cfd9@madpilot.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9100b044-0d94-4933-f43c-a8aebd42cfd9@madpilot.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: B90C97B6E8 X-Spamd-Result: default: False [-5.00 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; IP_SCORE(-2.02)[ip: (-1.97), ipnet: 2001:470::/32(-4.48), asn: 6939(-3.55), country: US(-0.09)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2018 18:09:20 -0000 On Mon, Nov 12, 2018 at 06:08:11PM +0100, Guido Falsi wrote: > On 12/11/18 15:33, Konstantin Belousov wrote: > > On Mon, Nov 12, 2018 at 11:52:25AM +0100, Guido Falsi wrote: > >> cpu_stdext_feature: 281 > > ... > >> cpu_set_user_tls+0x2d: call set_pcb_flags_raw > > ... > >> > >> The patch does produce a working kernel. In fact I'm running that kernel > >> now. > > > > Do you have a bios option called like 'limit max cpuid value' set ? > > If yes, try to disable it and see how it works out. > > > > Yes it does and switching it from "enabled" to "disabled" actually made > the problem disappear. > > I don't know why I had that enabled. It looks like the default is disabled. > > Maybe I enabled it sometime in the past while trying to diagnose > something else and left it enabled since. > > So, to fix it for me disabling that option is ok, and thanks for helping > me finding out! > > But maybe some safety is still required to avoid other stumbling in the > same problem. Or at least a notice in the docs. > > My BIOS presents the disabled option as a compatibility thing for > Windows 95, which could encourage people tom enable it. > Try this patch, with the option enabled. diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 6e36ae97523..55db65ffc63 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1581,6 +1581,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) identify_cpu1(); identify_hypervisor(); + identify_cpu_fixup_bsp(); identify_cpu2(); initializecpucache(); diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 286c01261f0..8f53b41fd19 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -129,6 +129,7 @@ void dump_drop_page(vm_paddr_t); void finishidentcpu(void); void identify_cpu1(void); void identify_cpu2(void); +void identify_cpu_fixup_bsp(void); void identify_hypervisor(void); void initializecpu(void); void initializecpucache(void); diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c index 8e406f053ba..56186b2f3ba 100644 --- a/sys/x86/x86/identcpu.c +++ b/sys/x86/x86/identcpu.c @@ -1467,6 +1467,19 @@ identify_cpu2(void) } } +void +identify_cpu_fixup_bsp(void) +{ + u_int regs[4]; + + cpu_vendor_id = find_cpu_vendor_id(); + + if (fix_cpuid()) { + do_cpuid(0, regs); + cpu_high = regs[0]; + } +} + /* * Final stage of CPU identification. */ @@ -1478,12 +1491,7 @@ finishidentcpu(void) u_char ccr3; #endif - cpu_vendor_id = find_cpu_vendor_id(); - - if (fix_cpuid()) { - do_cpuid(0, regs); - cpu_high = regs[0]; - } + identify_cpu_fixup_bsp(); if (cpu_high >= 5 && (cpu_feature2 & CPUID2_MON) != 0) { do_cpuid(5, regs);