Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2043808rda; Tue, 24 Oct 2023 10:31:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXBgTD60d4FzdvRGiNkqsxh1Cq+VuCzx/YLOPsiS9au5CtwmAOvxUUDWLo5Dn3QroeYNZK X-Received: by 2002:a05:6a00:2285:b0:68f:a92a:8509 with SMTP id f5-20020a056a00228500b0068fa92a8509mr24393243pfe.7.1698168673932; Tue, 24 Oct 2023 10:31:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698168673; cv=pass; d=google.com; s=arc-20160816; b=KIECAVQZrTVGkKXzFR0yZUFdcRrJ+uGHnkv0G9JT5YCBwwK4URB/roroyo//N7YxYt 4BywCFYRV8bxkmuDIxDdANax+XuXLqm5upFlcS8CJNyuP1yXP/XgGXv4ldC3QEfffGz9 C/+wl9Hr8o8/+djp3P9DqKL70tTMlj0AS/ySYcIxu+cJHzeILsLaCiiLZGteO6PmpLR5 ErIuO8eTKAxruWBcE+kDbTlcqdNQM/gxPM0JivGQV9AHe8vL9vXwuCy7H5kbNv4BJUV6 EaJ5NzNqu8eDn3avJmYt7TJOBWRnb2eT/nZof30gBgZDxhL0sKZPeQrg7tyohR3hEdYC f3YA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=DAfTneH1g2W9YCD5Tg3joRlMaCEPvaqAwGKpiPOizRk=; fh=agfinydQ5xngk5BLNGfLiedl5S3bzkM0dumIxytUCH8=; b=AjGu3/u+UnhsuIc1M44bm98dYpy7g9grwg7pbLQA6CjorZyXC+kOPSQdlCzgp5aGa4 vvggbrrKEH0jh9gbkMN6kAn5wD6cJrmB/YUPaVjD/t0F5wJKNx2tMkZS20tMNfNCo79W PzaIrSkvPxTb/ezrwpwi8nnqpflmQg3WaRHul13t4QSjLzOEpuPmExC8jkswpFUOTyOD 52rDbeVdrqTbUalmKU8DB3rPD26svdXIhwEiLaDofgXwkBXFUwVayhqvJMH/+ReItWkA KFpQSozraGm/ppcXH8Z+3rqQL32LeAfjP02gumeC2r0aQSzj6X7+p2WoV0JpCJDs7Ska RPvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=BZoxe9X6; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id g16-20020a056a001a1000b00690c951d2cesi8809991pfv.191.2023.10.24.10.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 10:31:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=BZoxe9X6; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3105D809DE5F; Tue, 24 Oct 2023 10:31:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343885AbjJXRa7 (ORCPT + 99 others); Tue, 24 Oct 2023 13:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234908AbjJXRaw (ORCPT ); Tue, 24 Oct 2023 13:30:52 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2077.outbound.protection.outlook.com [40.107.244.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D2110D9; Tue, 24 Oct 2023 10:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QnhIfy1XBzb3P5Nb1OfsSV/UQrbreoTST65555U9xhnCSW+Bp2VKyJcPvOvTuc+fbx+jF19GUzHmNBLTDdquPgpDwrM1Go1vktY0HEq7Q0wGePxpMoahpLIunVrw0kV6bywqMVO5dq9miVqsPR+Xhrn2pWJgLdbxBtBG4/aXKllrgmpoZE5BQsqWU2XoNvUPUrGUugoUjOWoAqr3BEpBdIOBMlyPWAswF6VpzBVGUeTzZ71fXcHILfw/xyiVINHjcVBTPr9REWFBVvqmTaAwUh1/6wlJ3e2hlGectA6hXX7rvH2QPZvCbhGPgnvKufz4ONzMtA6gNLyU+4l/dupH7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DAfTneH1g2W9YCD5Tg3joRlMaCEPvaqAwGKpiPOizRk=; b=CNxQXy/q1xK+TzNEtzj1MPjb+Wx4eF9pj21l15xzPNuYkmijhGx4BKtpGc2f/Nu6oSFJ2b0TgXdNZC/Q5kQenq3VkBnKw/Qq8f1ZTBvK/Z7u/uq9xtDAZKhAf4QwLNlKE6t6nmJ6p8uivBzNklVUikBlEy4BIlrIlwcji8sn/HsY9YroEtRqMizm0wzWtVjRBm1hb2U4VdmrBsymmu6uq/8IZVPO//eM5yj2RbJcVNFlDoCPC2vm4pxDKnDi2NF3XpUAZsL7fHC/Lg359FtitTMoyKNPXdcLKid2Pw7LFyYRni5aLljCVL7tW4wvUphN/QYA3nhfNfmgkhkUPUwBPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DAfTneH1g2W9YCD5Tg3joRlMaCEPvaqAwGKpiPOizRk=; b=BZoxe9X6H6wdd4WKEoE0rpS40xEHp1vjOhk7AWGHy6pBfKB4zxZH84FDx2NJuHuuavknfk6EwVJfOA/8V5LJDZAzL6SCG7Zru6kuD/Vo4jzrCCawen3L2Dnt6l8nJrrWB7NpWp/MsnfOJ/0azdajw6owp5pOC2EZCOfwIIApQuY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) by SJ0PR12MB6878.namprd12.prod.outlook.com (2603:10b6:a03:483::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Tue, 24 Oct 2023 17:30:47 +0000 Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::e16e:d7f1:94ad:3021]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::e16e:d7f1:94ad:3021%7]) with mapi id 15.20.6907.032; Tue, 24 Oct 2023 17:30:47 +0000 Message-ID: <3e3ca8c6-d336-d675-fc07-6e4fdcd273a1@amd.com> Date: Tue, 24 Oct 2023 12:30:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 1/2] x86: Enable x2apic during resume from suspend if used previously Content-Language: en-US To: Mario Limonciello , Ingo Molnar Cc: Peter Zijlstra , Borislav Petkov , Thomas Gleixner , Dave Hansen , Sandipan Das , "H . Peter Anvin" , linux-kernel@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org, pavel@ucw.cz, linux-perf-users@vger.kernel.org, Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter References: <20231023160018.164054-1-mario.limonciello@amd.com> <20231023160018.164054-2-mario.limonciello@amd.com> <6894bebf-15ed-4bd2-aebc-f4ac0a30a395@amd.com> From: Tom Lendacky In-Reply-To: <6894bebf-15ed-4bd2-aebc-f4ac0a30a395@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SN7P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:806:123::15) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|SJ0PR12MB6878:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a3a7227-e31f-4dee-4b51-08dbd4b6f577 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p4T4ktfdgNL2QE4s+C+b66MysisyehSWuX9ED7qTy+DrEi5tkrvMzMLhKwLZvL0zcBMJR8iPE0+4McauHNNWpurbFE3fw9ZSZN689BioX3rYS4JkhnvQOHQfAGylKF4NmezVdc5cQ0L0HbEJKi/nuknhxBSJaSZZyKPH/mCF1da3TRqw/kWNn8LW0TL0OvkSqKIyT24xNQHQkz31p38SacJ8QSxpsocFxbJ8Ep1LgVsZuxHEKvb6e/GRt2JUWMSdsDR5f4rNTvBmqKDJfPJx4BPPaRoOFlQ5pB37CLKrKMsek7i53NCA204nL3CAtWlraOxKvPQxq3EBUAq9OI+rSln39T1pP207mQLVQZrwwMr59MNpFUzXXrjmv0GnqwYF7S+JJGGRk/V25o1f8BfoXR0QKPkeFPjsg/kLIxcRx7o+HMwwTyCgOs1Wiwa9AYzXuRJpVg05mbAmuof1CAdGS+mUIkpthXuHfJo3jC2G7/3XR4486a90v1aZNuhrdxsVGWBEfROkMXKZxFU6/LlbUdxibI5/uPhF8LSS68yq+7UF2RSeO/QJyaxL7RSgJzmLdjyEGeECdzSmPdTys2zKvt2hHLMyA+e2pbWk3ioeHyQ0z5KoPNaPB142QifGLDrSb6B8S+q5Hls4Rt1TfNcjdTtp0nBW1vj6ZlaMURWx9co= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5732.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(376002)(346002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799009)(64100799003)(186009)(316002)(2616005)(6486002)(26005)(15650500001)(6506007)(2906002)(6512007)(5660300002)(8676002)(66946007)(83380400001)(4326008)(41300700001)(478600001)(54906003)(8936002)(7416002)(31696002)(66476007)(110136005)(66556008)(38100700002)(86362001)(6666004)(31686004)(53546011)(36756003)(87944015)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RXJ0cWRmaU45Y1NlMXh5OTlKMDRxZksxUG1YWVpETHFuRStZNmVrRlllcHlk?= =?utf-8?B?QWh6VEFOQlNyMHpqTDN4TTk2aXdxTFNNdjZiUEtJV0dTWkNpNVU1RHRKZWJJ?= =?utf-8?B?N2UyVXBEckV0SGNUb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JPdFJa?= =?utf-8?B?bDZrVU9wTHZCYTYzSlV2SSt5aEhyUjVZSTM5Z0NYN2xEZERORHRLVWRTYThj?= =?utf-8?B?VlVCT2gvaWpEUmZIMEhpODRaTjJPYkN6TUZzcGJNaWVUOFlFWU9DVnZFc1ox?= =?utf-8?B?emdlUnZ2TzFQQ3NXZ1J4WWxYQkpYYWM4SXdxTnlGYTZheHU5bW9xeG9UV25X?= =?utf-8?Q?IUY178KQN8NUJRkPVUKBheJiD?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a3a7227-e31f-4dee-4b51-08dbd4b6f577 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2023 17:30:47.2087 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OFpnNZ/H1ZmLYfMhXPwTekYXnXbGm2drJaVGVkyo05FqAN1cY+/kCFvjOvelNVc1bJo6l/qvb/ywmonh8MA/Tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6878 X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 10:31:10 -0700 (PDT) On 10/24/23 10:36, Mario Limonciello wrote: > +Tom > > On 10/24/2023 03:36, Ingo Molnar wrote: >> >> * Mario Limonciello wrote: >> >>> If x2apic was enabled during boot with parallel startup >>> it will be needed during resume from suspend to ram as well. >>> >>> Store whether to enable into the smpboot_control global variable >>> and during startup re-enable it if necessary. >>> >>> Cc: stable@vger.kernel.org # 6.5+ >>> Fixes: 0c7ffa32dbd6 ("x86/smpboot/64: Implement >>> arch_cpuhp_init_parallel_bringup() and enable it") >>> Signed-off-by: Mario Limonciello >>> --- >>>   arch/x86/include/asm/smp.h   |  1 + >>>   arch/x86/kernel/acpi/sleep.c | 12 ++++++++---- >>>   arch/x86/kernel/head_64.S    | 15 +++++++++++++++ >>>   3 files changed, 24 insertions(+), 4 deletions(-) >>> >>> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h >>> index c31c633419fe..86584ffaebc3 100644 >>> --- a/arch/x86/include/asm/smp.h >>> +++ b/arch/x86/include/asm/smp.h >>> @@ -190,6 +190,7 @@ extern unsigned long apic_mmio_base; >>>   #endif /* !__ASSEMBLY__ */ >>>   /* Control bits for startup_64 */ >>> +#define STARTUP_ENABLE_X2APIC    0x40000000 >>>   #define STARTUP_READ_APICID    0x80000000 >>>   /* Top 8 bits are reserved for control */ >>> diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c >>> index 6dfecb27b846..29734a1299f6 100644 >>> --- a/arch/x86/kernel/acpi/sleep.c >>> +++ b/arch/x86/kernel/acpi/sleep.c >>> @@ -11,6 +11,7 @@ >>>   #include >>>   #include >>>   #include >>> +#include >>>   #include >>>   #include >>>   #include >>> @@ -129,11 +130,14 @@ int x86_acpi_suspend_lowlevel(void) >>>        */ >>>       current->thread.sp = (unsigned long)temp_stack + sizeof(temp_stack); >>>       /* >>> -     * Ensure the CPU knows which one it is when it comes back, if >>> -     * it isn't in parallel mode and expected to work that out for >>> -     * itself. >>> +     * Ensure x2apic is re-enabled if necessary and the CPU knows which >>> +     * one it is when it comes back, if it isn't in parallel mode and >>> +     * expected to work that out for itself. >>>        */ >>> -    if (!(smpboot_control & STARTUP_PARALLEL_MASK)) >>> +    if (smpboot_control & STARTUP_PARALLEL_MASK) { >>> +        if (x2apic_enabled()) >>> +            smpboot_control |= STARTUP_ENABLE_X2APIC; >>> +    } else >>>           smpboot_control = smp_processor_id(); >> >> Yeah, so instead of adding further kludges to the 'parallel bringup is >> possible' code path, which is arguably a functional feature that shouldn't >> have hardware-management coupled to it, would it be possible to fix >> parallel bringup to AMD-SEV systems, so that this code path isn't a >> quirk-dependent "parallel boot" codepath, but simply the "x86 SMP boot >> codepath", where all SMP x86 systems do a parallel bootup? >> >> The original commit by Thomas says: >> >>    0c7ffa32dbd6 ("x86/smpboot/64: Implement >> arch_cpuhp_init_parallel_bringup() and enable it") >> >>    | Unfortunately there is no RDMSR GHCB protocol at the moment, so >> enabling >>    | AMD-SEV guests for parallel startup needs some more thought. >> >> But that was half a year ago, isn't there RDMSR GHCB access code >> available now? That support requires an update to the GHCB specification to add RDMSR/WRMSR access to the GHCB MSR protocol, which hasn't been written, yet. The support would have to be present in both the hypervisor and the guest. Thanks, Tom >> >> This code would all read a lot more natural if it was the regular x86 SMP >> bootup path - which it is 'almost' today already, modulo quirk. >> >> Obviously coupling functional features with hardware quirks is fragile, for >> example your patch extending x86 SMP parallel bringup doesn't extend the >> AMD-SEV case, which may or may not matter in practice. >> >> So, if it's possible, it would be nice to fix AMD-SEV systems as well and >> remove this artificial coupling. > > It probably isn't clear since I didn't mention it in the commit message, > but this is not a system that supports AMD-SEV.  This is a workstation > that supports x2apic.  I'll clarify that for V2. > > I've looped Tom in to comment whether it's possible to improve AMD-SEV as > well. > >> >> Also, side note #1: curly braces should be balanced. >> >>>   #endif >>>       initial_code = (unsigned long)wakeup_long64; >>> diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S >>> index ea6995920b7a..fcfa79105928 100644 >>> --- a/arch/x86/kernel/head_64.S >>> +++ b/arch/x86/kernel/head_64.S >>> @@ -236,10 +236,15 @@ SYM_INNER_LABEL(secondary_startup_64_no_verify, >>> SYM_L_GLOBAL) >>>        * used to look up the CPU number.  For booting a single CPU, the >>>        * CPU number is encoded in smpboot_control. >>>        * >>> +     * Bit 30    STARTUP_ENABLE_X2APIC (Enable X2APIC mode) >>>        * Bit 31    STARTUP_READ_APICID (Read APICID from APIC) >>>        * Bit 0-23    CPU# if STARTUP_xx flags are not set >> >> Side note #2: you mixed up the comment ordering here. >> >> Thanks, >> >>     Ingo > > Sure, thanks for the feedback.  I'll adjust the style for v2. > >