From owner-freebsd-current@freebsd.org Tue Aug 14 22:18:07 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 45E571066A42 for ; Tue, 14 Aug 2018 22:18:07 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id DD44E8BA3F for ; Tue, 14 Aug 2018 22:18:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id A11E71066A41; Tue, 14 Aug 2018 22:18:06 +0000 (UTC) Delivered-To: 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 8FE651066A40 for ; Tue, 14 Aug 2018 22:18:06 +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 1180B8BA3D for ; Tue, 14 Aug 2018 22:18:05 +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 w7EMHtMs006061 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 15 Aug 2018 01:17:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w7EMHtMs006061 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w7EMHtA6006060 for current@freebsd.org; Wed, 15 Aug 2018 01:17:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 15 Aug 2018 01:17:55 +0300 From: Konstantin Belousov To: current@freebsd.org Subject: EFIRT on machines with pcid after r337773 Message-ID: <20180814221755.GV2340@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 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: Tue, 14 Aug 2018 22:18:07 -0000 If you use UEFI boot, have EFIRT compiled in kernel (the case of GENERIC) or pre-loaded as module, and efirt is not disabled by a tunable, and the machine resets during kernel initialization, try this. diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d5d795ab502..c9334eab916 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1188,7 +1188,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr) kernel_pmap->pm_pcids[i].pm_pcid = PMAP_PCID_KERN; kernel_pmap->pm_pcids[i].pm_gen = 1; } - PCPU_SET(pcid_next, PMAP_PCID_KERN + 1); + PCPU_SET(pcid_next, PMAP_PCID_KERN + 2); PCPU_SET(pcid_gen, 1); /* * pcpu area for APs is zeroed during AP startup. @@ -2651,8 +2651,8 @@ pmap_pinit0(pmap_t pmap) bzero(&pmap->pm_stats, sizeof pmap->pm_stats); pmap->pm_flags = pmap_flags; CPU_FOREACH(i) { - pmap->pm_pcids[i].pm_pcid = PMAP_PCID_NONE; - pmap->pm_pcids[i].pm_gen = 0; + pmap->pm_pcids[i].pm_pcid = PMAP_PCID_KERN + 1; + pmap->pm_pcids[i].pm_gen = 1; if (!pti) { __pcpu[i].pc_kcr3 = PMAP_NO_CR3; __pcpu[i].pc_ucr3 = PMAP_NO_CR3;