Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp963759lqb; Fri, 24 May 2024 23:04:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGPstqiRm0eaLepNGivvrkqXtzdn5qtOKI1RpKlBxm4SYbEph14NkKqwT5UUaFRBnu0A2Ux97pbK82loUFVQmwWcUzcRImVaP91kkqjw== X-Google-Smtp-Source: AGHT+IFcnKgb+kpAtTQQ+hYMqWRtY+NW9YfdumY8EO/UGCBBKKiZEQD1WszzDBnrBKFAiB1oWWaI X-Received: by 2002:a05:6a00:44cc:b0:6f3:f447:57de with SMTP id d2e1a72fcca58-6f8f36f9044mr5409535b3a.19.1716617048425; Fri, 24 May 2024 23:04:08 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc051083si2591686b3a.37.2024.05.24.23.04.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 23:04:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189289-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="QLFqT/Te"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-189289-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189289-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D8293B21D4B for ; Sat, 25 May 2024 06:04:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A480DC8F5; Sat, 25 May 2024 06:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QLFqT/Te" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF920E566 for ; Sat, 25 May 2024 06:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.17 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716617035; cv=fail; b=MPFKr1LGMx9AgNcXpBvlQoL2a+fCYwWKx0cYtaNHYWJBrHfBG8qOgY8//iOgqW5lYHtWgv2zgcF31ZciE35dCgps0p8y87ZzXPEhy0MlkFfUr5PDkHZig5YI2FFY1UGPKK79yXCGSAYpztBD3nDgfgDN28xyVdIalIdEmGpUl7U= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716617035; c=relaxed/simple; bh=ZjL3g4RRJsK4rnjDqYkgx+Kj8eM3/w61QzphUTj+6+8=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=i2wjfIMenG3dOtLOKoANxUZCIAY69gP8JXKpoeNjwEBxTic8NumwjlPMOzjTjToUeioc3XJY6/1N2r/vzWL4DjXL0QdbQ9RnhRvmXtBygOoJoHC7SJrTBj8AJ7GoDAXQ5ushlCo2PPjBYpn9jXFrVmGIBZQm+WDK6lixW2TiZr8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QLFqT/Te; arc=fail smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716617033; x=1748153033; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=ZjL3g4RRJsK4rnjDqYkgx+Kj8eM3/w61QzphUTj+6+8=; b=QLFqT/TefgtFASKQMPGH2uZm/UjKZeveSM387ALhXkIY0Ilpixs6RsLx +gXDaTPsZDb5IAqS9gXNdFzQ3m7/chLpoX/JE0o4rjZZ53h/Vf0n/DKOg FFxSebwA0iOBy68f/1Nm7e+zdxFd43mkJ6poIX4ebOz8qOGxlNZG/PH4N g2HvYUvM/cq8YwrKVQIYKmqMjKFCTHN9skRgdRRWSdMf3BDmE/l1EKhmQ 9WXZCcjUNL/9VN9sxSQ6NZ5gfgULo8Y74kKP2naAKOYZsGn3lf4eHjPpU U3IfyIjJiGzI5fM57o+huA7WUxtr89pLo8Gy5xPK9VdSx4Fk/hufS1KoS g==; X-CSE-ConnectionGUID: t25zWL6zSVmPYwAiS43N6Q== X-CSE-MsgGUID: yKE6f4p5TqSGz9QwkuzeSQ== X-IronPort-AV: E=McAfee;i="6600,9927,11082"; a="13119840" X-IronPort-AV: E=Sophos;i="6.08,187,1712646000"; d="scan'208";a="13119840" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2024 23:03:53 -0700 X-CSE-ConnectionGUID: 4kOaJtGzS6SvAp6nIX0Jow== X-CSE-MsgGUID: TvFFU27ES1WgDiw5HAupMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,187,1712646000"; d="scan'208";a="34732011" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orviesa006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 May 2024 23:03:52 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 24 May 2024 23:03:51 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 24 May 2024 23:03:51 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 24 May 2024 23:03:51 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 May 2024 23:03:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTe0kXpjxnPXIZ26kBqUn/Hg/C91qlaVjVYomSUijQuh7FnPLU/VugQdRr2cXfoj12cWIk3oZLStmVeBHEKWQ313TNKOpTVar1KOSK+0HJfxqManeQi+PcO0+GLhBlBEaPswrhoVuOjhMTXtmGr57vtnm2J4BQiin3P/E5pmWC8Uu+OxG0FbCVFB8jAGyHNY2mcQ2s909NFh0Kqwr0cvN+kTtfJBETeLY3IZD2/R1PGclvDAgbX+tG9R5CnBHn1ft04lHtmue2D1r0eE2Dfsal2uVcakH40tJpCsFvECvJbrztJXGVgbFrHzo7aXy2WwGl6ztQq3U3MKbv8iSp3XAg== 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=XR7VdvOUDU83HIQgb4JVDHIdDmBIwkbRsqVeXBnKY8c=; b=gnYbYr9BYGzeRWScY/Y8AnEqgmfw/AaZWcnMFwSKlha/O44CWnUWuUUnkn8UCPY8Mh5Prl/BzYpuncvajv5+XytvO9yTdScx/XIq5vZF5CPJvNhyIFjbCzAErEL3IzgJpkkqvAfbSblXAIgq0hK/jqbuxcrCB150767jzFUpivnAg/H1clm9A0PI30LWWAGsTDExYg/7AsdVIEqCW73X6cHC3fmuK0PUKJJEiCwJyS0NrZ876mLfHuIzOuinDFT5XyifxPjJubZ5dLJs6Vj2napyMctIPsyabNqhjefIdqFUbAiWmPg4MZk0/qYRySeQTHoJ460Ock0Afi/Y/FrqUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6020.namprd11.prod.outlook.com (2603:10b6:8:61::19) by MW5PR11MB5931.namprd11.prod.outlook.com (2603:10b6:303:198::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Sat, 25 May 2024 06:03:44 +0000 Received: from DM4PR11MB6020.namprd11.prod.outlook.com ([fe80::4af6:d44e:b6b0:fdce]) by DM4PR11MB6020.namprd11.prod.outlook.com ([fe80::4af6:d44e:b6b0:fdce%5]) with mapi id 15.20.7611.025; Sat, 25 May 2024 06:03:44 +0000 Date: Sat, 25 May 2024 14:03:26 +0800 From: Chen Yu To: Dave Hansen , Juergen Gross CC: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Juergen Gross , Ajay Kaher , Alexey Makhalov , Arnd Bergmann , "H. Peter Anvin" , , , , Qiuxu Zhuo , Prem Nath Dey , "Xiaoping Zhou" Subject: Re: [PATCH] x86/paravirt: Disable virt spinlock when CONFIG_PARAVIRT_SPINLOCKS disabled Message-ID: References: <20240516130244.893573-1-yu.c.chen@intel.com> <7b8d1dd6-3913-45fe-941e-aac2c15916dc@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <7b8d1dd6-3913-45fe-941e-aac2c15916dc@intel.com> X-ClientProxiedBy: KU1PR03CA0026.apcprd03.prod.outlook.com (2603:1096:802:19::14) To DM4PR11MB6020.namprd11.prod.outlook.com (2603:10b6:8:61::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6020:EE_|MW5PR11MB5931:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a7620c4-0448-4a1f-5274-08dc7c806f02 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|1800799015|366007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?gDtY859RsGR8dj59sYAPiRUiOS+Z8RTJ4hdr1HlmKzLn1v8YA33dEc4oBQtQ?= =?us-ascii?Q?tjHr8cNjRCPxN+lVdDz2GceojZyxaIvn20hu36Kv5NOU8aP/Rie2EAkPn107?= =?us-ascii?Q?hz2Mi8JFV8euRTjP1ktyRgSB2l91Y5jOypVoBy+LtlLw48IcmSZZFQaC+5p0?= =?us-ascii?Q?45BLQ/eJe7eH/uoQ2nK/NFQ/ZVMmPvmiuyq5yVkxp7ozIS2O9aKu+RRXQImg?= =?us-ascii?Q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9QUn9G5fzh3/6EdxwykTU3rz9j?= =?us-ascii?Q?/qq664bjYS8da8hxEg6dUxpopXYsRMDU6SGZdTZaaJh790GkjadUz3UvU4u+?= =?us-ascii?Q?y50r+RTClLAt4lyXp2REqTSOYfdKwg1q9aOsY2baUQRaRbTQpymAAcLx0z9u?= =?us-ascii?Q?OyoEDriQGQHx7BLrOuOCkEVgWTbbKhJ6/6pOkcvwAA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB6020.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wCUWavelJYKTcaY7cRl/4i3/ZOAFmghDy7bzWOheZ1gJt6xR38RhXIxdPTgo?= =?us-ascii?Q?wqYM6/1ivUEnQPltBPi1WmwAxvytVbuF1KOUh41rzKKjKT8zcHnKpA5cGhnS?= =?us-ascii?Q?UnsQtIyExDgeys9QWMgYrlggUUwwA5QgXf0h1keuVDhyUtIB4t7vK7XCmeAX?= =?us-ascii?Q?NI/AOzjK30eUON+flsnbGa5ugWaRpfOXvKqn1N3jj5wLjn5KqypLt2b9CzGt?= =?us-ascii?Q?a6I/hx/0VqAc7/Fp4YCSe/Xtz/Mv50DO5jXsvFGkyNYoq1krLCo+ziGQ3aT1?= =?us-ascii?Q?PSl+T0CahP93P+rFDQRkq1vXxHy3a4KLhn2zar34GDZcr0gOQQMZJFqTFz3g?= =?us-ascii?Q?7PORdbPHIHmizz/nogkc1z5EdnDePsgnqqHsJyaCATpuF15qFCoPvE6XGoDA?= =?us-ascii?Q?sE50bzgYkcNi3VjiSVa2jiVPEq/iePc8uKTgNa0HdXGHRinLVzRuP3NLnP4u?= =?us-ascii?Q?bzUNXiJcpqXlgGLAKKScvdFcHu2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ascii?Q?QKiYGDlfhrZ/aPMfYNHTKGneetudw0liI0FR7MjPLn+5HSO00FzkZFT6t2iI?= =?us-ascii?Q?s8sEwq5QhuktXQw6P9kbLg2onrkNvTAw2rk0Frml0hNhFzski/vBsSsGXCls?= =?us-ascii?Q?1S9dlswFyRc1AvzcrlSoHslDxEagyFFx8nn/lczCuF8SebpBmbFtyK9wxVsf?= =?us-ascii?Q?EF0F7lcnhPjfvQ2F+FLi/Xtm5q/6CTQdD5Mc7GtQ?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0a7620c4-0448-4a1f-5274-08dc7c806f02 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6020.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2024 06:03:44.3681 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ddwh/sKDpPvTULLGWzsQlgyHD6AfdIRdE59i286oSRnS9NO93oaoYnYfrsmLPBFdY8s47VCob7LmqjE+vF3XYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR11MB5931 X-OriginatorOrg: intel.com On 2024-05-23 at 09:30:59 -0700, Dave Hansen wrote: > On 5/16/24 06:02, Chen Yu wrote: > > Performance drop is reported when running encode/decode workload and > > BenchSEE cache sub-workload. > > Bisect points to commit ce0a1b608bfc ("x86/paravirt: Silence unused > > native_pv_lock_init() function warning"). When CONFIG_PARAVIRT_SPINLOCKS > > is disabled the virt_spin_lock_key is set to true on bare-metal. > > The qspinlock degenerates to test-and-set spinlock, which decrease the > > performance on bare-metal. > > > > Fix this by disabling virt_spin_lock_key if CONFIG_PARAVIRT_SPINLOCKS > > is not set, or it is on bare-metal. > > This is missing some background: > > The kernel can change spinlock behavior when running as a guest. But > this guest-friendly behavior causes performance problems on bare metal. > So there's a 'virt_spin_lock_key' static key to switch between the two > modes. > > The static key is always enabled by default (run in guest mode) and > should be disabled for bare metal (and in some guests that want native > behavior). > > ... then describe the regression and the fix > Thanks Juergen for your review. And thanks Dave for the write up, I'll refine the log according to your suggestion. > > diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c > > index 5358d43886ad..ee51c0949ed8 100644 > > --- a/arch/x86/kernel/paravirt.c > > +++ b/arch/x86/kernel/paravirt.c > > @@ -55,7 +55,7 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key); > > > > void __init native_pv_lock_init(void) > > { > > - if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) && > > + if (!IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) || > > !boot_cpu_has(X86_FEATURE_HYPERVISOR)) > > static_branch_disable(&virt_spin_lock_key); > > } > This gets used at a single site: > > if (pv_enabled()) > goto pv_queue; > > if (virt_spin_lock(lock)) > return; > > which is logically: > > if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS)) > goto ...; // don't look at virt_spin_lock_key > > if (virt_spin_lock_key) > return; // On virt, but non-paravirt. Did Test-and-Set > // spinlock. > Thanks for the description in detail, my original change might break the "X86_FEATURE_HYPERVISOR + NO_CONFIG_PARAVIRT_SPINLOCKS " case that, the guest can not fall into test-and-set. > So I _think_ Arnd was trying to optimize native_pv_lock_init() away when > it's going to get skipped over anyway by the 'goto'. > > But this took me at least 30 minutes of scratching my head and trying to > untangle the whole thing. It's all far too subtle for my taste, and all > of that to save a few bytes of init text in a configuration that's > probably not even used very often (PARAVIRT=y, but PARAVIRT_SPINLOCKS=n). > > Let's just keep it simple. How about the attached patch? Yes, this one works, I'll refine it. thanks, Chenyu