From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.43]) by mx.groups.io with SMTP id smtpd.web10.11957.1652277975765214113 for ; Wed, 11 May 2022 07:06:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=aK2VKXtZ; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.93.43, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oNrZf95ObPFOmv4CHGj3bD9G2MCd+PwqUcNRjU+eTmnVAuBh4w4Pqh7Gqgtxi9HjfZiYLPoONecJEwtFYX8GMDmtRYY1w2drjUzKX+CSDnUZcTf62Ukhu4rOoyXhdURyu6McJ9rb7e8BAogu5jgaDpaEZ9RYCzQotnteQkpP5EDFoT4ixNIA4NY9gyBGJZif+PsepqwkuXiY0YMsel5f/3Fa50nBjmrGTKX9LWXjanz5Wkf+ae58ohSijSjFSB5DQxgihekw0lBWj0JViKVHxavc1ZgfDlxhn8km3ryMO5ZW4soff8v+LZLoJE286IrY0wwBR+IOrqiOuuqdKflSeQ== 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=4f4cmB4AQnBe03n7NCaxQTunEdj7woZmtee5mDjwI8k=; b=AZurihqm6umUYzlgWDR1h6iLxuLrLaffV0W5AFrm4FkaD++A+LUAK2KqYKoIFCkQMaQ1ajWuk7Ce6CTN9f6MB5hIutzc9YMeCehP6D2eAXpGFQ/V+UxF1XzG45CtNLMwbNNoSNs9GJ7c7OLzxjUSJBu0Lmrn0plYKVO61bh5XqcN1Zskowc1ycvn90xe0nqaF6HTKWM54f6ouosb/IXg2OZVoitCxpfEQKHbZepxElJVkxFUHf0PtfYLbs17TEzX1golvjVlHf9yQL0+ENN6EPMWYC5ZNcuKNfvDVpzhkWnP7GzFzrPeuopN15gJDFKMlUGuaZHayDtuyEvFDB/XhA== 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=4f4cmB4AQnBe03n7NCaxQTunEdj7woZmtee5mDjwI8k=; b=aK2VKXtZcMffR6VmVdFyjWAghf4AuUccI0+3GKvkpLN7D+Q5w0qOlEHqfijUNTpP/kcTBff6/kb4ilfyt8L53wDION7602hbk0tPhjVQuU8mNLw0vwHUj4YcdYSZ3aYH0ewtISyoGIqL6UWt6QpBk1+XWU+PwskkVSpgigkPcX0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by BN9PR12MB5147.namprd12.prod.outlook.com (2603:10b6:408:118::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22; Wed, 11 May 2022 14:06:13 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::db8:5b23:acf0:6f9a]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::db8:5b23:acf0:6f9a%4]) with mapi id 15.20.5227.023; Wed, 11 May 2022 14:06:13 +0000 Message-ID: <0389cf2a-e9ba-0ba2-ac90-73ae402f7a08@amd.com> Date: Wed, 11 May 2022 09:06:11 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [edk2-devel] [PATCH V7 36/37] UefiCpuPkg: Setting initial-count register as the last step To: "Xu, Min M" , "devel@edk2.groups.io" , "Ni, Ray" Cc: "Yao, Jiewen" , Gerd Hoffmann , Anthony Perard , Julien Grall , "Dong, Eric" References: <2d6f5751-e7de-3c1d-3985-849a9ae16462@amd.com> From: "Lendacky, Thomas" In-Reply-To: X-ClientProxiedBy: MN2PR01CA0053.prod.exchangelabs.com (2603:10b6:208:23f::22) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) Return-Path: Thomas.Lendacky@amd.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2856d379-6e27-4930-0ffb-08da3357689f X-MS-TrafficTypeDiagnostic: BN9PR12MB5147:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dNCmCdgOPHjVw1wUgsPF+iJLo+Std63fBOFFvcdHqJ/q6zbsoqKRCBUv631RqGqn78JxR3AhOFY4De6BDUIXxtpj+1hgVhqLvcKb106ART8ifE2/7pdVn6um8TuqTAYbyq9sIkW/3JS5RYa+v5usublLQ5gGoNhMmZfv17FqLNGWNh9HbDxdd8StlOYtowvEqsDCBrVivE1zeQwv0muR/0bBOQ0dCjxLogx2GMBLs0yQVE6sm/w8gcLmsY03ojUC995QKwZTV2eWSLjRHopsvVIW1npF+3Ka2qdUQpWArttVC6kmz5qnagcjNF5XnTRLGkVzapSaAO/GB0YxCLhN6NDSgS1lv1nada/PqLfrmgdJK8VcakJs6WlGBbNEfNL72bDjNonye8BZ5ulBfVG39KWKazTynA7S+8FE+p2nGWM03LsT7fT2xYHJrpxdlwlldSYbnCpV4AhV08A2ZStp6bfp98NGBsFCYDIuGU2OmAXZysoz4qD/NvcApexFFrIfcaldQrlXl19otEYUtzoOhvdpRHK+qfW0qsBS3LhmLGgtbfgpW8BFL2zJteBIpg+HLyTcu3AXCxIHmDJ3wR86Of/0fHjNC1pP2Gulde8XVfCJGLOVlEmdG34hclbqKkcD7D6iwZ/lp+wLW56E5g0IgP5ohg6hiTyfPcN2s1KEXEzqSrRQ3NhExFRBEhIptyQ4tgr0lUV2At8B90jJadIuGfJTZXpXhu8Sgq3u45EHHfExyei5m5gnPxeeJ4gaC3Zd0x9/miHZzoc6ZN+OiJNLlUpaHwxxDzvT/3N3ko1Suf1RGf0/8Y+7YbcsloV3wr36GwTBh7rK83KNqUuoIQDxXA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(36756003)(2906002)(31686004)(8936002)(38100700002)(31696002)(5660300002)(45080400002)(508600001)(186003)(4326008)(83380400001)(66556008)(8676002)(66946007)(2616005)(66476007)(54906003)(316002)(53546011)(6506007)(110136005)(26005)(6512007)(6486002)(966005)(86362001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?alh6ZmpNT0pLNmtVUndzVmRETENzdWlmazlFdEp4YzZnOWpMWHgybVdJd0ph?= =?utf-8?B?YW5WdUlnVkVubUhDdDBpWGxSZFdMQ0NRZTRiclBDOHNuUFZhVGErTEFYMlB6?= =?utf-8?B?MUpNSWU1YXN2dlg5cDZmZW9QOTJGbkdKWklDVmpnMHQzZ2RQWk15YUJiUWk1?= =?utf-8?B?U1JTdVdIT0dkQnVzUUlGNUFRV0FXTXc5Z1pPaCtqUGk5MWxBQ1NrRy9FaXFX?= =?utf-8?B?Q3FNUHkySEM4VFZKTXBLWUFPd1htblJFZFRSSmdsK2VjOUNJRjRKdENsc0xo?= =?utf-8?B?VHNtcFlTTDNnd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ZDNoN01L?= =?utf-8?B?VEcxYU80OE5kNVBPa3JuaXNXNU1uNUx0T1UyYVhOZE5qSXVHMkhTNElZTXdE?= =?utf-8?B?UVNyR3Z3QUMxZThiVGszaXlHL3lLL2E5THRpc0RLclNPR2d4UFJJK1VKb245?= =?utf-8?B?TmcrU1o0cDRoRXJOU0g4dis4TkQzUll5aXJiSWsvU0N1eiszNytwNXhDWmtq?= =?utf-8?B?UjFuWWVCTlVTVzQ3YW9RZ0FzSHltU0d0Rk5aWi9ZTEhET3p0dmFqZz09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2856d379-6e27-4930-0ffb-08da3357689f X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2022 14:06:13.8190 (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: UjqDiFABL7sVLF0bm3JRzOzz+X9AbP15xzcOV4WnnBxjUUy2jzME025jINTEHEXZU+v6vskwt+CdUYRznzW7xA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5147 Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/10/22 21:00, Xu, Min M wrote: > On May 11, 2022 4:30 AM, Tom Lendacky wrote: >> On 2/28/22 01:21, Min Xu via groups.io wrote: >>> BZ: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3711&data=05%7C01%7Cthomas.lendacky%40amd.com%7Cce8cd76e1b054fe277d808da32f20976%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637878312370633666%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=C%2F0BMTV%2FoZdUxLwRbqzjNVdlMvEKfl20z6RwKeMzr2c%3D&reserved=0 >>> >>> Per SDM, changing the mode of APIC timer (from one-shot to periodic or >>> vice versa) by writing to the timer LVT entry does not start the timer. >>> To start the timer, it is necessary to write to the initial-count >>> register. >>> >>> If initial-count is wrote before mode change, it's possible that timer >>> expired before the mode change. Thus failing the periodic mode. >> >> I'm replying to this patch since I can't find patch V12 46/47 anywhere in my >> email. >> >> I've bisected a regression in the Linux kernel to this patch when an SEV-SNP >> guest is booted. The following message is issued in the kernel for every AP >> being brought online: >> >> APIC: Stale IRR: >> 00000000,00000000,00000000,00000000,00000000,00000000,00000000,000 >> 00020 ISR: >> 00000000,00000000,00000000,00000000,00000000,00000000,00000000,000 >> 00000 >> >> Possibly a timing issue involving the mode switch with the interrupt >> unmasked. If I leave the interrupt masked and only un-mask it after the >> programming of the init-count, then the message goes away. > > Do you mean in InitializeApicTimer, it should follow below steps: > 1. mask LvtTimer. (set LvtTimer.Bits.Mask = 1) > 2. Do other stuff, including programing the init-count register. > 3. un-mask LvtTimer (set LvtTimer.Bit.Mask = 0) Yes, I believe so. I'm not an expert on the APIC timer, but that seems reasonable to me. Thanks, Tom > > Thanks > Min >