Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2847398rdh; Mon, 30 Oct 2023 09:17:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0rMCchCPAPnypqPp/92mev+J2shmKZT9gvn9DWGWcgNHadZi+sPUMyBLi5XYUkZrS9QdM X-Received: by 2002:a05:6358:6f82:b0:168:e637:a819 with SMTP id s2-20020a0563586f8200b00168e637a819mr12881783rwn.12.1698682659138; Mon, 30 Oct 2023 09:17:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698682659; cv=pass; d=google.com; s=arc-20160816; b=zGb2I2/R3QusYCzjDTFtCmAUZjBS3r48XvcN25c/DJcWWiCgYo3tLW3rEgnqetSYP3 dleuBJmLf3E0uhZ7b+lGhOb/taqX/onUUZa+khkT/UCSz1eKPEX9MZh69nOaLyzmMLrB m5hRAWp9uRuMFxkfOF2RFS1sUfUrmEb04Lnq/FOYEYbO9zl5Wjf2y1NLlLhSFrPyReeU FWqI18iBsPd0TpeTfXitAh8EGmFwghO3iFBucawOG3uzoiZ80misG2rGtfK794Q8pvpF Gk99nhZO2ErmRgY7qiJPJ7iKeUrTMG8//fw2TbKgYibtJZG0sWGrERMC3FpM09rjWaqB yP1Q== 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=8dj4/aTXKHZZG1AZpy8lmyppcI1CqjqHF+gLH2yyYM8=; fh=b4Eoz5BSATi3y+BygiEFmUqKIP3dcfpKQ3/tzwvy7xI=; b=AcUxyDApm4HG2DgIyxunC3LiXN9FngYvCq/gMXaCW0Xdk5lQT0auHFk9xmh1tL1Vlk aLsxfVkyfNRTDYJ9g97ANjA3uCP3Mi69tBKBZReRiBmnOkjrvlJcujrwZE6qEM55KeDb dCUyURjsTs8JLm0CSTPjAFHWrk2QvP7vwT8DTch6d+NETHsBQLyNrIGPam8BvxAs5Ful 9/NiklgKy2uZ3PzOZ9UcN69v0oPstMezieV+1mbasqPBn+aDXwWESnecQc/+oFhybl6y ufs3WereSY7BxaWC9TUJtFqi9iwqqN6VUAQ/C5JhXywOr0sQkMOVgahCwl0AahirTMeb koOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=0fnLza0D; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o12-20020a656a4c000000b005648b1d63aasi5169828pgu.553.2023.10.30.09.17.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=0fnLza0D; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B79A1805A78F; Mon, 30 Oct 2023 09:17:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232938AbjJ3QR2 (ORCPT + 99 others); Mon, 30 Oct 2023 12:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbjJ3QR0 (ORCPT ); Mon, 30 Oct 2023 12:17:26 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C9CC2; Mon, 30 Oct 2023 09:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XNEWITsrSlVqE6daEdxkqPWNJBB0YGNdLA4GH5cF8sGZzH4fYvKJIRU6Vr25dDmoxqAzinzVus8rWMgrRuyH3CwUynG/o2dsS7Kfx/CEbrONZA6LMKXrN97MvZF0/9zPBE08l51vA28EmgmvL42j1KQt+87OwlUBeGj8SlQlgx2QTY+Fb6r/qhFTaO/PKy5W1WdKlnuSLniF+mHwZ1S9abNmzLhvu3mpCD8G0E15fxfyyPdbw1EEY3g0ISOrDCsGhHDVpgUHMuwBNOQCQOAew85P6OyhVD1tedaUUyBF/IxM4XIXVXp/J5QPBnthiqUR1PocpzonCYavT7Ktx7IbpA== 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=8dj4/aTXKHZZG1AZpy8lmyppcI1CqjqHF+gLH2yyYM8=; b=ZklY79HLkE9csmHcJ8pq/ELAQeuiv9lanX43EXk2Uh7FkVwvt3WPqXKRkEVRo3ueAneh6RRlji6514XGUh6BUhxtCrI+DPQFsTxB/qzRWTwLBuFKSsyIAq2cmoVFBpamn+Voq9DopDgdQjKsh2oLZe3nEXKxIMtFmo74so4mEKdoD7eb1c94qQAOobOAolYnvkXvmAVZd+5gA+f5CsQR3fEpCU5fOmc5LGwnfvpV3RsSNEoJhL0q/S9LTZz08ZGkVfKTCT4fOu7kkfwQ4giUYH32y20ll71eu97UzHXLwOXMR/99SIjJMs+v5+rPx/V5jzGgGz20dm0mpZLyyYWBhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8dj4/aTXKHZZG1AZpy8lmyppcI1CqjqHF+gLH2yyYM8=; b=0fnLza0DNpRoVaUWBcH91OFb5f82v+xKaUqE0R+EexLtd/rJO4N/+Ha/aeUVbZPpEQR76na3gmzuMXVH4ymrTBMdeaU3XsVYrRFpmV9PB+3D5r6xXfCm0nXJmoo2+/Q3/sjHdejqQygASYOwnCsHvlJ1Jy0znzymaHFWSd5DOzQDlwdYv5vCr5Puu/77ktryoQ14dCOYGh8UHDqv5P0jDYPKU6ZEHIOCz5H8y+jDcZ26a4TUJmy4qLMaEzMx6zcp1b39OAy/zzodclDIpCNcMvyUJfDB+fAXE13VoPFR87z0k0HYE8v4nVzYI09Sp2wR9SlY9LzcixtetGKpSJZkgw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from PA4PR04MB7790.eurprd04.prod.outlook.com (2603:10a6:102:cc::8) by AS5PR04MB9754.eurprd04.prod.outlook.com (2603:10a6:20b:654::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Mon, 30 Oct 2023 16:17:21 +0000 Received: from PA4PR04MB7790.eurprd04.prod.outlook.com ([fe80::6bbb:37c3:40c4:9780]) by PA4PR04MB7790.eurprd04.prod.outlook.com ([fe80::6bbb:37c3:40c4:9780%4]) with mapi id 15.20.6933.019; Mon, 30 Oct 2023 16:17:21 +0000 Message-ID: Date: Mon, 30 Oct 2023 18:17:16 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] KVM: x86: User mutex guards to eliminate __kvm_x86_vendor_init() Content-Language: en-US To: Sean Christopherson Cc: pbonzini@redhat.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231030141728.1406118-1-nik.borisov@suse.com> From: Nikolay Borisov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: VI1PR0102CA0078.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::19) To PA4PR04MB7790.eurprd04.prod.outlook.com (2603:10a6:102:cc::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PA4PR04MB7790:EE_|AS5PR04MB9754:EE_ X-MS-Office365-Filtering-Correlation-Id: 5daf183a-6d80-44d4-ec89-08dbd963b1ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GhhHULMA5Byb0v1dzgwBvZDiZMSRElMnCnEZlAaMcKvmz9zy7lNjPXYRcD6AORD91T/PTzBh/E5qY5yx+bH3DcS0Q2sfeYdqwgwlv2UDZHpnJEuQ7THtr2t/zcDyVEauQDQKgaAXSgsQNEK6a/v5v3Nb+IqLUYklaHyfnI/todoYp5ZcoapcxmS40i3G1wOiv3lfz04Zu4ZRXQ34PVwNAWXPENg5Zw58x38ES95YgK0dCUVYBXJn+Rdbe5cWuYiGpkmIDME1G9yS95NPgxNtysUjcHZPvxn20JK7cv4sNO8Kx9wcInwWACPWv+tp/t21e584U5vVZqoN8ayBTBZlbTkz0KKJhFabEp1b0I7x8PNGl+3TFMO9uY+mTDAyio2EBWDXMqYJgzzVzzMJHgx8joCywuQYWcwJDDJYGro/0TqyEQ7B3lVT4ycocjz6bMtPb+zsmbtg5UkrC2sZpWGj3NCdWjgqPIZ02MgD615hSsscUF+LWzNJmWWXJxr0TUAjXTQq7tis4KnX2mBPxlkE6XZGAVre8gOpbASEkGt6463IAfKgnFclwUdb3+/oSvwzrBoXZ53DiLi3WgT1VE2SbrjJCVleMOjxFu+FNuW4lss3fdYDJB7H5ZOa4C8436giDNAA0nhAry6vVY4i2pI76g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB7790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(366004)(396003)(39860400002)(230922051799003)(1800799009)(186009)(64100799003)(451199024)(6506007)(2616005)(8676002)(86362001)(36756003)(6916009)(31696002)(5660300002)(6486002)(6512007)(41300700001)(6666004)(66476007)(4326008)(66556008)(83380400001)(478600001)(8936002)(66946007)(2906002)(316002)(38100700002)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OXJYSGFMUkRiMDF6QlNtOXZRNzYwSFZoejFrNExVYWlwUjZUMHk0VktFMXF6?= =?utf-8?B?SW1QZlFMRmkrcnlKNUpDeDhXLzFKODJheEZCTnNRT3p2ZGFWNFdSeGhSUkE0?= =?utf-8?B?Sy9QZDUvVmFjanVFZ2x3US8xRVZWbWpFN0dPM25vengvZEc5eDZrZ0JKNS9R?= =?utf-8?B?WHFLNDNxMGUwdjRBMkpkaU1EaWlNZkxSWmlwM0Z1cExIY2RYQ3pQNDEwZlVa?= =?utf-8?B?VW50OHR4NU11ZWJ4MTFuTklSdjZ1b2J1OUxPVDl4VkV6WFhBSUNCQ2NOTTk4?= =?utf-8?B?TDVvTlBZcnpOcEpPdm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UDg4dVZG?= =?utf-8?B?eDFLWkErUWZYcUl1UTVFMEtPQnFLbjVMVXVKMUdLTUllVFVQak1IWFgwQXhm?= =?utf-8?Q?cB7lundLN/vTZs+c7Q2D7SkPoIdOjx+KZz/JVNSQ9gFe?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5daf183a-6d80-44d4-ec89-08dbd963b1ab X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB7790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2023 16:17:21.1775 (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: 8SQLgfPyGaaIDPqMMf+3B0ZJYrtw3z+1CCis+T/fu3S7rjq8ohoF9HjK2mXeCTZfbiRGOIIFbmst3g5sm//SCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS5PR04MB9754 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 30 Oct 2023 09:17:36 -0700 (PDT) On 30.10.23 г. 18:07 ч., Sean Christopherson wrote: > On Mon, Oct 30, 2023, Nikolay Borisov wrote: >> Current separation between (__){0,1}kvm_x86_vendor_init() is superfluos as > > superfluous > > But this intro is actively misleading. The double-underscore variant most definitely > isn't superfluous, e.g. it eliminates the need for gotos reduces the probability > of incorrect error codes, bugs in the error handling, etc. It _becomes_ superflous > after switching to guard(mutex). > > IMO, this is one of the instances where the "problem, then solution" appoach is > counter-productive. If there are no objections, I'll massage the change log to > the below when applying (for 6.8, in a few weeks). > > Use the recently introduced guard(mutex) infrastructure acquire and > automatically release vendor_module_lock when the guard goes out of scope. > Drop the inner __kvm_x86_vendor_init(), its sole purpose was to simplify > releasing vendor_module_lock in error paths. > > No functional change intended. Thanks, I'm fine with this changelog. > >> the the underscore version doesn't have any other callers. >> >> Instead, use the newly added cleanup infrastructure to ensure that >> kvm_x86_vendor_init() holds the vendor_module_lock throughout its >> exectuion and that in case of error in the middle it's released. No >> functional changes. >