From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5746C433E2 for ; Tue, 8 Sep 2020 18:42:44 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 553702080A for ; Tue, 8 Sep 2020 18:42:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 553702080A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 37D93870B4; Tue, 8 Sep 2020 18:42:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wptnwJrkIOFV; Tue, 8 Sep 2020 18:42:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 3B3238707C; Tue, 8 Sep 2020 18:42:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2259CC0052; Tue, 8 Sep 2020 18:42:42 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F0C2AC0051 for ; Tue, 8 Sep 2020 18:42:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DEF8B86C40 for ; Tue, 8 Sep 2020 18:42:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A5xSxCYaE4NB for ; Tue, 8 Sep 2020 18:42:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by whitealder.osuosl.org (Postfix) with ESMTPS id 2D0C186BB7 for ; Tue, 8 Sep 2020 18:42:40 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E4510AD39; Tue, 8 Sep 2020 18:42:38 +0000 (UTC) Date: Tue, 8 Sep 2020 20:42:34 +0200 From: Joerg Roedel To: Borislav Petkov Subject: Re: [PATCH v7 67/72] x86/smpboot: Load TSS and getcpu GDT entry before loading IDT Message-ID: <20200908184234.GE23826@suse.de> References: <20200907131613.12703-1-joro@8bytes.org> <20200907131613.12703-68-joro@8bytes.org> <20200908172042.GF25236@zn.tnic> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200908172042.GF25236@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) Cc: Juergen Gross , Tom Lendacky , Dave Hansen , Mike Stunes , Kees Cook , kvm@vger.kernel.org, Peter Zijlstra , Cfir Cohen , Joerg Roedel , x86@kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , virtualization@lists.linux-foundation.org, Martin Radev , Masami Hiramatsu , Andy Lutomirski , hpa@zytor.com, Erdem Aktas , David Rientjes , Dan Williams , Jiri Slaby X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Tue, Sep 08, 2020 at 07:20:42PM +0200, Borislav Petkov wrote: > On Mon, Sep 07, 2020 at 03:16:08PM +0200, Joerg Roedel wrote: > > +void cpu_init_exception_handling(void) > > +{ > > + struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw); > > + int cpu = raw_smp_processor_id(); > > + > > + /* paranoid_entry() gets the CPU number from the GDT */ > > + setup_getcpu(cpu); > > + > > + /* IST vectors need TSS to be set up. */ > > + tss_setup_ist(tss); > > + tss_setup_io_bitmap(tss); > > + set_tss_desc(cpu, &get_cpu_entry_area(cpu)->tss.x86_tss); > > + > > + load_TR_desc(); > > Aha, this is what you mean here in your 0th message. I'm guessing it is > ok to do those things twice in start_secondary... Yes, I think its best to do it twice, so that cpu_init() stays the CPU state barrier it should be, independent of what happens before. Joerg _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F21EC433E2 for ; Tue, 8 Sep 2020 18:54:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AD562067C for ; Tue, 8 Sep 2020 18:54:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728264AbgIHSnb (ORCPT ); Tue, 8 Sep 2020 14:43:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:45334 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731306AbgIHSmj (ORCPT ); Tue, 8 Sep 2020 14:42:39 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E4510AD39; Tue, 8 Sep 2020 18:42:38 +0000 (UTC) Date: Tue, 8 Sep 2020 20:42:34 +0200 From: Joerg Roedel To: Borislav Petkov Cc: Joerg Roedel , x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v7 67/72] x86/smpboot: Load TSS and getcpu GDT entry before loading IDT Message-ID: <20200908184234.GE23826@suse.de> References: <20200907131613.12703-1-joro@8bytes.org> <20200907131613.12703-68-joro@8bytes.org> <20200908172042.GF25236@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908172042.GF25236@zn.tnic> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, Sep 08, 2020 at 07:20:42PM +0200, Borislav Petkov wrote: > On Mon, Sep 07, 2020 at 03:16:08PM +0200, Joerg Roedel wrote: > > +void cpu_init_exception_handling(void) > > +{ > > + struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw); > > + int cpu = raw_smp_processor_id(); > > + > > + /* paranoid_entry() gets the CPU number from the GDT */ > > + setup_getcpu(cpu); > > + > > + /* IST vectors need TSS to be set up. */ > > + tss_setup_ist(tss); > > + tss_setup_io_bitmap(tss); > > + set_tss_desc(cpu, &get_cpu_entry_area(cpu)->tss.x86_tss); > > + > > + load_TR_desc(); > > Aha, this is what you mean here in your 0th message. I'm guessing it is > ok to do those things twice in start_secondary... Yes, I think its best to do it twice, so that cpu_init() stays the CPU state barrier it should be, independent of what happens before. Joerg