From patchwork Thu Jan 20 14:05:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12718697 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 009E3C433F5 for ; Thu, 20 Jan 2022 14:05:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.259078.446846 (Exim 4.92) (envelope-from ) id 1nAY3z-000877-9x; Thu, 20 Jan 2022 14:05:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 259078.446846; Thu, 20 Jan 2022 14:05:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nAY3z-00086y-6Y; Thu, 20 Jan 2022 14:05:19 +0000 Received: by outflank-mailman (input) for mailman id 259078; Thu, 20 Jan 2022 14:05:17 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nAY3x-00086o-Be for xen-devel@lists.xenproject.org; Thu, 20 Jan 2022 14:05:17 +0000 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.109.102]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fe5a1628-79f9-11ec-8fa7-f31e035a9116; Thu, 20 Jan 2022 15:05:16 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2106.outbound.protection.outlook.com [104.47.17.106]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-27-h-UCJEbNMF-Q3noT29XyHw-1; Thu, 20 Jan 2022 15:05:15 +0100 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by DBBPR04MB7643.eurprd04.prod.outlook.com (2603:10a6:10:203::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Thu, 20 Jan 2022 14:05:14 +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.010; Thu, 20 Jan 2022 14:05:14 +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: fe5a1628-79f9-11ec-8fa7-f31e035a9116 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1642687516; 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=Ki88Bt745Kcm6s6wmFvsK/mpmFMQIsi3fvdnsTbkCRg=; b=D67rw/gdZiBrrX3ho+xcRyr4J+XfrgrxKZR9CzvbXVDflhe+N3+Dx9hXzlfEm5Y3itsMZy dpLi5Jpt/MbeXMOqNr08FRDYkvNowc9hNjV1kVASSGQ/Lfl32TcrIraBAUbizWqTE5aWuc BDvmitxJgrngUdNgLvXpwfKHtXRqI3M= X-MC-Unique: h-UCJEbNMF-Q3noT29XyHw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HILrtr//VkJcVq2upy2lyOAv+/g4fS+ydQ8UvgpnXIUwDbaTb5290o0iBQ2l69v1NCl/4ejW9+3ZKOjMdo5EDm6IvPOuWJw10XjGd16yNPS60HFyhONlWDsUGkT/yEOJApqdVoXO+NEIUavqyl6Kz3uV7HNG9BEcFmJB9t+cXKp+485Tua61yTTo8tFa/saw1cQLm69HXlwKb36BSLd9Cvm6ZbERpTfmoI1sxeD6PlCsIBokzaFiXoCExS6MsMaOoIcW9q/GAJkBMp/nFJzmnbum7kbKVzs2VcQtyOs0Mo8QNPHJgP2/43TKBUYnulOYMO51ju+byfhaZtOUZ9OgKg== 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=Ki88Bt745Kcm6s6wmFvsK/mpmFMQIsi3fvdnsTbkCRg=; b=EOCJhFgg2rW6AkWMHGepmDM2SDmuUSGpShByA78TBO2ByoDPWISzDz4MW2BBIgLal1+PWY4h7gsWHTbxF+9CcTd4mC5LzK1L0L6nHRAo8Wk2J5wTyfOYMAxnyD1fmfGHpuYT2Jvf8ApkEePqXnkxlP0cBI/D2phea7EKYEEcRe78ibZIV458YAHOqRpyS1IWA26M9/IPDt16z3Ff1ZxINKXf295bwUlc/6QgkvDDxrEdSDr5N1dBQRY3v7Df64etjumMozwop06TNZB7V8rUKToSKn5NpABIOmIFaZuN65CUjHzp85UAxG4MmloVodYy0MyKLel/IVytz7QC0vdRVQ== 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: Thu, 20 Jan 2022 15:05:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: [PATCH RFC v2 5/5] x86/mwait-idle: squash stats update when not actually entering C-state 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: <568cb6dc-127a-9c8f-0073-2df173d4677b@suse.com> In-Reply-To: <568cb6dc-127a-9c8f-0073-2df173d4677b@suse.com> X-ClientProxiedBy: AM6PR10CA0056.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::33) 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: e45165f2-d0bf-478b-d03d-08d9dc1de113 X-MS-TrafficTypeDiagnostic: DBBPR04MB7643:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ADc6HcxE6dFwD9vo7mpglQoi5RkNPccye5ZbVnLGfrAttZtDpQMQ0yvbt6sXpQVoxjIQTEQaqHaCIW0JLXi7ozbZtzohnh/chlEa3nMK7ByAeXHMYVbju0C7al/1U3PIcAcXkWXkKElwCRHam/97Hn3dxymupZUnjzlAVpc0TQsSGtUgGPUD461ISiCPh+nooDVYPbelfnIuEJeLWy94GzwCBOp8Ytz9jwH9jrzvmfZHoXvmJcUkuDHiywMuypf5wdGfFVtCRImFTu7ccJTEUfzDcqyd6nJ7eE8S0Nbaaxj8A3KeNs0lvaXXHroX+UXYHJ7RIF2x75uy7ZFp3ZkyHg1BKATz5Cfwlwe6YotsHZjdUB/3ju+MdzBls9P7MURI70oelWw0hJN8pbWlUq0PzoyiUyl6z4vEpC6zpiXM3rEwSmT7SEDpUL7Ptw/lECMyj9CoauWV1xL9l3IYeoh/SS0uvCJYMUr7FsMfTmEtsm57CGSPdtB0NeSgIPjcjzACmjZEaC4tuD3SbCa91ny4uNx5omjsYbIxc9ehUfAv1abV6D4nnTtxnG83786eWoCL3FG696Wqk5vndEtMNrTJayyC8mQSVwCvk+ff7tth1HGGfHbxCUJeFD9VaTpN2OkKkWq/jpRJeggLN1hBuYQ6j1PlHuY6RqNT7r5U3b6kJ6DQSFtdVb6WUjq7DG3sMObU2H1eUoDnUL00/sowm4cFDa0OVYAVTRsXGO1NGu8jEQAL1wsDX1uNds+eD3cosEpo 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)(6506007)(31686004)(36756003)(66476007)(508600001)(8676002)(31696002)(8936002)(38100700002)(6486002)(86362001)(186003)(2616005)(83380400001)(6916009)(66556008)(66946007)(4744005)(316002)(2906002)(15650500001)(5660300002)(26005)(6512007)(54906003)(4326008)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?gB+2F28duTbr8xzZLXQV3Mlbh7yu?= =?utf-8?q?XBWeOu+GEiM1jXHT7OLGHQZ1E/br2ihVQp7ZH0avgmlaUUnFTkYCOucgz44zYIB/g?= =?utf-8?q?4C6J3j4AERhrmHq+dFRqAvtQQ57jIK+0W+iuZDhWtDcd4f/h0yuhbbGOYQuwT9V/e?= =?utf-8?q?8Ek975kq6DhX7s6o96UxQWAe2fIrTVspayz8RdNzXirUOXVC6dxyGZXD/zwqLQzkz?= =?utf-8?q?fGcl3nGx+LWapdfPZNgFzyHz2YWoB2Uv1ncjCTe1Zi01fPd7r3M38DmgE2dxaK1g4?= =?utf-8?q?2wiYOXu0CSutNtbw28/aHzwGrB/3ntdJQh8SAyFmjDlwgLDdqA9wOVW7kNkBoICYk?= =?utf-8?q?tfLavZ+/51/ukkpwT0K+Gah+8OJwP2Auay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7psNj5wuDJD1K+lR?= =?utf-8?q?Tjw0kpVuiPKFtQxY0k1nTLWmudeyv3z3Wz5+7keX+SGUUAQAoimh9nkOFVVTJAA8i?= =?utf-8?q?ujzBHjrrHBXtgd52G8I/wVN+wPXEApbA72VFuuE7zEuZCF0wPA7Sz9DM1X1j/8y4C?= =?utf-8?q?jz+ukIBxlkJDvvYUj1umB21Mv6m0CGbBROsliL8gQAPpBQvFz1k6r4tJcG/bkfCgO?= =?utf-8?q?1vFPEIv8bt+kFU2T+md42X2Wg4uRbVwUDLalg6SIKkRJSBJpmRR71afbrpopFz3pC?= =?utf-8?q?KiO4pLYM4GZco+Kik4nZ4QnJpVrOrY/JC9ft9QYN9rZ8R/PE6MAi41Q=3D?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: e45165f2-d0bf-478b-d03d-08d9dc1de113 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2022 14:05:13.9319 (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: Rf3PEFF4rBQXN5aMVIWqBIesyxgdQlUo7RQCYq4qiz4ZyCgqS+ejZb9NUMixc+XsusJ4YT+FKQ1k0i/Z1CutIw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7643 While we don't want to skip calling update_idle_stats(), arrange for it to not increment the overall time spent in the state we didn't really enter. Signed-off-by: Jan Beulich --- RFC: Arguably more of what follows could be moved into the if() - thoughts? --- v2: New. --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -861,9 +861,11 @@ static void mwait_idle(void) mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK); local_irq_disable(); - } - after = alternative_call(cpuidle_get_tick); + after = alternative_call(cpuidle_get_tick); + } + else + before = after = alternative_call(cpuidle_get_tick); cstate_restore_tsc(); trace_exit_reason(irq_traced);