From patchwork Mon Jan 24 08:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12721656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 680EFC433F5 for ; Mon, 24 Jan 2022 08:27:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.259740.448246 (Exim 4.92) (envelope-from ) id 1nBuh9-00020q-Vq; Mon, 24 Jan 2022 08:27:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 259740.448246; Mon, 24 Jan 2022 08:27:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nBuh9-00020j-SG; Mon, 24 Jan 2022 08:27:23 +0000 Received: by outflank-mailman (input) for mailman id 259740; Mon, 24 Jan 2022 08:27:22 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nBuh7-0001ma-RO for xen-devel@lists.xenproject.org; Mon, 24 Jan 2022 08:27:21 +0000 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.111.102]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 72f826c3-7cef-11ec-bc18-3156f6d857e4; Mon, 24 Jan 2022 09:27:21 +0100 (CET) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03lp2056.outbound.protection.outlook.com [104.47.8.56]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-8-MlpCDL89PwaveK-ItzmYGA-1; Mon, 24 Jan 2022 09:27:19 +0100 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by DBBPR04MB7883.eurprd04.prod.outlook.com (2603:10a6:10:1e9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17; Mon, 24 Jan 2022 08:27:19 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::5951:a489:1cf0:19fe]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::5951:a489:1cf0:19fe%6]) with mapi id 15.20.4909.017; Mon, 24 Jan 2022 08:27:19 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 72f826c3-7cef-11ec-bc18-3156f6d857e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1643012840; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O+QV9f4zvS046E/T2Qkac91dJy0u0hz2Q9q4aDSre0U=; b=SSvWxix2sqHQ+3V0n8akPVEOeNbNO9aS9+7jkirrDXZ9c76Zeu4LgdiRDv1ia2upE1tzkW TPePX0ububpok2pJrN/cC4LsRDpLb39t8gEqwCZYx0XGgGdZeb2ZWroHbqZSCzgm/BgRo5 3WI/2z9LKmqBl8DM8ryUheHrx2ycJHY= X-MC-Unique: MlpCDL89PwaveK-ItzmYGA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jPF3fsv677gRFuI+4lcPe0QcHd1jGlmbuSV0l8k7Xhk6kPAxoswPpzK3btFfUJmfi+J9yzmjJs0qmTSfswnD0ohXE2dAv2zREWOkuIs7TEsi65EtW1eRefC1NsH9JBfw0UFbnlWBLGv7KJpbf5+7Jtb3LoipQUU9dsMM2Cyo+dwROZXBYKXLLBr/a9Q4pIQYmPOO6mHIlD1U/2FztA0xyJxKm0lTU1DdnuZ9lsG04HURlzN0afiMFGRnaYuebb34bBd7Iugnz7VPADyUzfow4rWw6nk+YQwWZAlcfw05coYM5PU7bcdIOs0uhAK7EUHONiORluRvxADFhYqGkrndqQ== 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=O+QV9f4zvS046E/T2Qkac91dJy0u0hz2Q9q4aDSre0U=; b=V9d9w6t7xoQ+ElksITgGs/TMhq6hGDXGB2i/t+3P86OfJEz/CeW1cj+YBZ+segw2X3vsMZI7PthV46/dGjTJREawEjH5w9f/gFKpTe40Iih43ltRPAiNP4o5wnBdf7CnqbvQFJz61gE8yf1cNYy3jw372dd5UrLs8OfnzdRtZJmcLyu+R5zqME3sJG7FDcGnNY1LM9OKpbc4I2Tu8UuWKL/kOK4qKrj2/6qFOsILFbZxFU+uUaEwHuU8ho1uGeuppBclOSo8xv20dQ+ilSabnDF93pc1+rg6pLwdtKBmk8jkAWhfoN1bq/0GTCKbxMJDadZVyVOmBsDrhd+BNLTUaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Mon, 24 Jan 2022 09:27:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: [PATCH v2 3/4] x86/APIC: skip unnecessary parts of __setup_APIC_LVTT() Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: <879e5b70-bffd-b240-b2c8-c755b09d41a9@suse.com> In-Reply-To: <879e5b70-bffd-b240-b2c8-c755b09d41a9@suse.com> X-ClientProxiedBy: AM6P191CA0094.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8a::35) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dec3f041-acac-4aae-75d9-08d9df1355e8 X-MS-TrafficTypeDiagnostic: DBBPR04MB7883:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kW74TiHBbTl44YAsDTfMXiV3lDwzJGrEsCQ32HFjqJc75uZD5/pwmCdCYuxk2SUqhOSBXOqqzp6AZDK37dSDcFf1DfUt5cS5rH5CDSOxyPdYtYnpZAPu4DQDTOdoNJVwI2bZTcH9BD59aOMHF4CXU+nsHWCNOOxgavNBpxfdqdvgES2sPfaq+9TC9GyvmaR/4BQeOOH0TSfctvPGXrYnYVhVFOxUvFea1FTJAdB+aWQxeiLEc5ThE5NIihXhPG/EbjrpsDbdH3zl3G18F9n0ST7g7hRaWT4xKYaMJFJLh9j/c1pd0+/tq1bNRSUR2JYzNBIFSWdlRaN/MHYQxnOAb5fegSuJkcKqpsJX5GEyo4b3dqqKsEDuobb3o3G5iN29SIIYkIwd1mbtz6xrP9ZTJUDr/f3+8yqDpdb3d4PqivgHBAs+dZ/u5lxtV6T/OZvs0IQcGts/UJijNe28OFf8ruROsAOul+qo5/AdDXWz72vrG6amCWJEDydb0Qdn99IqAIux7MduNlgsmyGz7BNOp1odUALgqSBh74PNw2rzG5dthBwX7nJB5IsrPGVc6RQx3hmetjU8hCqyio7AzLkOygqgjC4hpYkXM5OsyG1v/mBH0533tMPsAFmK6nswh41UycWU7xEcbrujPF0LjUC25uymU5Aq/C0Vf7+hw4caf0YH37P4UwrLbZ0YI1sK7Lsk0KLNRi3yPZvTp31K0lU0iKV5VMWjeq4drQS4/C4csMIYZ+p2k3+nUerY3XDlGAvd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(2616005)(36756003)(38100700002)(6666004)(54906003)(4326008)(86362001)(66946007)(6916009)(8676002)(31686004)(316002)(31696002)(5660300002)(6512007)(26005)(508600001)(66476007)(2906002)(66556008)(6486002)(186003)(6506007)(8936002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?oM4q3a7BOA42xBQs46UhItwptxCB?= =?utf-8?q?sgGuOlOqqqCuTeJzbOtT24yNFT84E4JUkK8eKf5mkd/jRVGQWCARqCBDtPPLmgO5n?= =?utf-8?q?/HGVfhMT6ezOh9yuKkllHAOc11MDLG8v2sU+Gxh3NBfIRIDgD3BoMRdB8i9tuEgiR?= =?utf-8?q?dQvH1N0SB8G+Qw7738NfQc3h+1ieDTKqcRpxHmb6/EiD/Vleh8Sy4Qo2H5+MOJHAw?= =?utf-8?q?yO9LRgE22XQMdu4YudnNy1x5x3++52+k+BgCzO+HH91tXDYddB2puEHi7aYhwpEAB?= =?utf-8?q?ssUpdBwu48MD7J22G0o04bORl5c6moIA2bUdOGoUXoFqngbrhiXnl4r55sH5xbSoJ?= =?utf-8?q?lTtIXoQ/jnVGQzlA5s4CqTLDzvTLSzMmp4FvrpK+b13n3EWvI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qTHY/D?= =?utf-8?q?jQQBxHCyeyTBqcw2A2VQhZSzNvH7y9JTA/i+21W+wPidc0QZcDQYfnpfsG2NyCRtx?= =?utf-8?q?hiEJyHfj6ztxIIGiz4IEPNlEipU9afIzgF2stuZ+upswhuBH7HONFe2pu15F8f6nA?= =?utf-8?q?ruHCZfWB5U/lcwHr06ZwSLNzwlX3QFD/4xh0NDYQzJ9A7f9lSzCfq4TSjOgCocczi?= =?utf-8?q?84lcu8V/pdeD2wyYi2usQ0ffhxQuSZbAHpxixcEy1Yn3bzgrY+nySzhZZ6XPUuBWw?= =?utf-8?q?eZh50AY7R44/lYEM0dnH55CrvL/0QOsWVh1Mf4TJ5Xhy4SZH3FqKLTA=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: dec3f041-acac-4aae-75d9-08d9df1355e8 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2022 08:27:18.9445 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1tNHaldZRTsmwLmum13HagpSllmxajMicpmk5S//yG7XnCg2a3XFGisu8SIXzbQn24Z1ZcgEzbBB9ZTt6mQNXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7883 In TDT mode there's no point writing TDCR or TMICT, while outside of that mode there's no need for the MFENCE. No change intended to overall functioning. Signed-off-by: Jan Beulich --- v2: New. --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -1059,24 +1059,25 @@ static void __setup_APIC_LVTT(unsigned i { unsigned int lvtt_value, tmp_value; - /* NB. Xen uses local APIC timer in one-shot mode. */ - lvtt_value = /*APIC_TIMER_MODE_PERIODIC |*/ LOCAL_TIMER_VECTOR; - if ( tdt_enabled ) { - lvtt_value &= (~APIC_TIMER_MODE_MASK); - lvtt_value |= APIC_TIMER_MODE_TSC_DEADLINE; + lvtt_value = APIC_TIMER_MODE_TSC_DEADLINE | LOCAL_TIMER_VECTOR; + apic_write(APIC_LVTT, lvtt_value); + + /* + * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode, + * writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized. + * According to Intel, MFENCE can do the serialization here. + */ + asm volatile( "mfence" : : : "memory" ); + + return; } + /* NB. Xen uses local APIC timer in one-shot mode. */ + lvtt_value = /*APIC_TIMER_MODE_PERIODIC |*/ LOCAL_TIMER_VECTOR; apic_write(APIC_LVTT, lvtt_value); - /* - * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode, - * writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized. - * According to Intel, MFENCE can do the serialization here. - */ - asm volatile( "mfence" : : : "memory" ); - tmp_value = apic_read(APIC_TDCR); apic_write(APIC_TDCR, tmp_value | APIC_TDR_DIV_1);