From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Thu, 3 Nov 2022 22:34:10 +0000 Subject: [PATCH 36/44] KVM: x86: Do compatibility checks when onlining CPU In-Reply-To: <20221103210402.GB1063309@ls.amr.corp.intel.com> References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-37-seanjc@google.com> <20221103210402.GB1063309@ls.amr.corp.intel.com> Message-ID: List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Nov 03, 2022, Isaku Yamahata wrote: > On Wed, Nov 02, 2022 at 11:19:03PM +0000, > Sean Christopherson wrote: > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index f223c845ed6e..c99222b71fcc 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1666,7 +1666,7 @@ struct kvm_x86_nested_ops { > > }; > > > > struct kvm_x86_init_ops { > > - int (*check_processor_compatibility)(void); > > + int (*check_processor_compatibility)(int cpu); > > Is this cpu argument used only for error message to include cpu number > with avoiding repeating raw_smp_processor_id() in pr_err()? Yep. > The actual check is done on the current executing cpu. > > If cpu != raw_smp_processor_id(), cpu is wrong. Although the function is called > in non-preemptive context, it's a bit confusing. So voting to remove it and > to use. What if I rename the param is this_cpu? I 100% agree the argument is confusing as-is, but forcing all the helpers to manually grab the cpu is quite annoying. From mboxrd@z Thu Jan 1 00:00:00 1970 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id C69FBC43217 for ; Thu, 3 Nov 2022 22:34:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 340BC4B0AC; Thu, 3 Nov 2022 18:34:19 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jy85hSzUO9IP; Thu, 3 Nov 2022 18:34:18 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F0C6549F51; Thu, 3 Nov 2022 18:34:17 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C0F7949ED7 for ; Thu, 3 Nov 2022 18:34:16 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2UDSvo6Y0Atm for ; Thu, 3 Nov 2022 18:34:15 -0400 (EDT) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 827E44106C for ; Thu, 3 Nov 2022 18:34:15 -0400 (EDT) Received: by mail-pl1-f170.google.com with SMTP id u6so3251343plq.12 for ; Thu, 03 Nov 2022 15:34:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=mkCIQ7bnuqf5rnZcP6hp5JREtMJ78/S1f1OWtkJaTeRse5OVZRNDMID1AYpz+jBJzg eTpW9c3Fpt1GJSjywJBWRecDimPLsqOLfN7Nt46XLz4VoW6wiMtnGP3QRSBmWb2Jy2Ue XIrU3j6Zv6WjRE+wBsl7MInjLBoh0ETGKk290BPhyym2xqAHPTTSp2piVfBSnA5Xqpa6 3LkVfTkbpSA7y+3xQukW44oEvhoV3ll0HshYQg8WmMixLpenp+usLAkNlELtK9JmVVTO f4CyPp1jxX+2aW0ZdvzjRbMLb0KbcueA1rrAX1kSu3aGK0UrE4ad6SuEvUCcApyckgBR ztmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=WcFuKWYt6Ff3qxCFkQH1TmjrEq8nlNCXGleyY/XrlaVUUQqGBC1qEFBfqeugvfuwVr YPVJc5rl/dCji/lb3tyZD2UZZDdLLhEhbfSe5u+P7cUxOsPTe6++LaQbOM+9u6BhNVmR CiR2UNGrtk+6I5X2uQGz9K2H0mkV0BOTMrx6+fGIKdYoIPzTyuZN8Clq58jcYC9wa87I d6PB+4O2H2yDAQ1Rk6J0Q05qjBucJhg7pzwwCmdRvCIPzbqvcBH4oB+XrKo9lB1UEmgL ht1z3DoUDFtyp8VNaYZ2XqRTW8wQBGoa2Pc9XQKJhfHsKGx1BOJImziOeTqm6TW77x7U eIIg== X-Gm-Message-State: ACrzQf1lpU/LEH6fz5gLR/S6OXtR/WHCUb2tcoeyeaDAvkhUChgpKqe0 A0CvdbtM/+rTH8+ePBE0AmpuzA== X-Google-Smtp-Source: AMsMyM4x/1h/4H3vdmKr9CnvGb6Osipgsi8YDrhqpMcYmjYNzerzqYc2UHi5AhKhfTxXN1DVaborYg== X-Received: by 2002:a17:90a:6045:b0:212:fe9a:5792 with SMTP id h5-20020a17090a604500b00212fe9a5792mr49415367pjm.178.1667514854306; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u10-20020a170902e80a00b00186ad73e2d5sm1151929plg.208.2022.11.03.15.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 15:34:13 -0700 (PDT) Date: Thu, 3 Nov 2022 22:34:10 +0000 From: Sean Christopherson To: Isaku Yamahata Subject: Re: [PATCH 36/44] KVM: x86: Do compatibility checks when onlining CPU Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-37-seanjc@google.com> <20221103210402.GB1063309@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221103210402.GB1063309@ls.amr.corp.intel.com> Cc: Matthew Rosato , David Hildenbrand , Yuan Yao , Paul Walmsley , linux-kernel@vger.kernel.org, Michael Ellerman , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, linux-s390@vger.kernel.org, Janosch Frank , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Christian Borntraeger , Chao Gao , Eric Farman , Albert Ou , kvm@vger.kernel.org, Atish Patra , kvmarm@lists.linux.dev, Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Isaku Yamahata , Fabiano Rosas , linux-mips@vger.kernel.org, Palmer Dabbelt , kvm-riscv@lists.infradead.org, Paolo Bonzini , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Thu, Nov 03, 2022, Isaku Yamahata wrote: > On Wed, Nov 02, 2022 at 11:19:03PM +0000, > Sean Christopherson wrote: > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index f223c845ed6e..c99222b71fcc 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1666,7 +1666,7 @@ struct kvm_x86_nested_ops { > > }; > > > > struct kvm_x86_init_ops { > > - int (*check_processor_compatibility)(void); > > + int (*check_processor_compatibility)(int cpu); > > Is this cpu argument used only for error message to include cpu number > with avoiding repeating raw_smp_processor_id() in pr_err()? Yep. > The actual check is done on the current executing cpu. > > If cpu != raw_smp_processor_id(), cpu is wrong. Although the function is called > in non-preemptive context, it's a bit confusing. So voting to remove it and > to use. What if I rename the param is this_cpu? I 100% agree the argument is confusing as-is, but forcing all the helpers to manually grab the cpu is quite annoying. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B084632 for ; Thu, 3 Nov 2022 22:34:14 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id g24so3288371plq.3 for ; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=mkCIQ7bnuqf5rnZcP6hp5JREtMJ78/S1f1OWtkJaTeRse5OVZRNDMID1AYpz+jBJzg eTpW9c3Fpt1GJSjywJBWRecDimPLsqOLfN7Nt46XLz4VoW6wiMtnGP3QRSBmWb2Jy2Ue XIrU3j6Zv6WjRE+wBsl7MInjLBoh0ETGKk290BPhyym2xqAHPTTSp2piVfBSnA5Xqpa6 3LkVfTkbpSA7y+3xQukW44oEvhoV3ll0HshYQg8WmMixLpenp+usLAkNlELtK9JmVVTO f4CyPp1jxX+2aW0ZdvzjRbMLb0KbcueA1rrAX1kSu3aGK0UrE4ad6SuEvUCcApyckgBR ztmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=Fdo6vza1BXuEJO4qb15pcwEWRvSsYmpuFmR5TECHraEQfZdAt2TjFbGswrQEtUrF27 a1DOHByc6AlYX0S5eNyXMKZItPLt+kZOuJVGA+/sQcPTqTm0KqtmJ+sqBxq7efmbtSln 6IliKIYC6F/jNjUKWiNTHdH0KREOpocngjTWOekXp3v1xV0Qf2GY25GCosV/sxaltcqm 268NTrdWFzvcBmj4xvckhBO7gHhiFI9EDA+3veH9XfF02eC30C01aRp3xEnD9Zickimm bWv6Ubk4+2OH6H/BJoKs+MUvkf9c3n4op6RwtlS+UMen5vZsOpImMXdeAOs8XZdpYrRo 7+4Q== X-Gm-Message-State: ACrzQf2E0CC9wO8v5jd2gS9G78Tgsuc228hqtMixDjc77Hri8kmQ8+tY d3yV4tQVMx+DQa2X2mhxF1z/Lg== X-Google-Smtp-Source: AMsMyM4x/1h/4H3vdmKr9CnvGb6Osipgsi8YDrhqpMcYmjYNzerzqYc2UHi5AhKhfTxXN1DVaborYg== X-Received: by 2002:a17:90a:6045:b0:212:fe9a:5792 with SMTP id h5-20020a17090a604500b00212fe9a5792mr49415367pjm.178.1667514854306; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u10-20020a170902e80a00b00186ad73e2d5sm1151929plg.208.2022.11.03.15.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 15:34:13 -0700 (PDT) Date: Thu, 3 Nov 2022 22:34:10 +0000 From: Sean Christopherson To: Isaku Yamahata Cc: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Chao Gao , Thomas Gleixner , Yuan Yao Subject: Re: [PATCH 36/44] KVM: x86: Do compatibility checks when onlining CPU Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-37-seanjc@google.com> <20221103210402.GB1063309@ls.amr.corp.intel.com> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103210402.GB1063309@ls.amr.corp.intel.com> Message-ID: <20221103223410.iLlu7MZn7FQY54uVCitSUMSKAm69nmgN9csIL4SfqXE@z> On Thu, Nov 03, 2022, Isaku Yamahata wrote: > On Wed, Nov 02, 2022 at 11:19:03PM +0000, > Sean Christopherson wrote: > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index f223c845ed6e..c99222b71fcc 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1666,7 +1666,7 @@ struct kvm_x86_nested_ops { > > }; > > > > struct kvm_x86_init_ops { > > - int (*check_processor_compatibility)(void); > > + int (*check_processor_compatibility)(int cpu); > > Is this cpu argument used only for error message to include cpu number > with avoiding repeating raw_smp_processor_id() in pr_err()? Yep. > The actual check is done on the current executing cpu. > > If cpu != raw_smp_processor_id(), cpu is wrong. Although the function is called > in non-preemptive context, it's a bit confusing. So voting to remove it and > to use. What if I rename the param is this_cpu? I 100% agree the argument is confusing as-is, but forcing all the helpers to manually grab the cpu is quite annoying. From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 F0AD1C4332F for ; Thu, 3 Nov 2022 22:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ljyRQqcn0YA+upCLwjrMhYJYI5l8bmaZGn2OGvFVqOc=; b=P21Z0tgpBJCVt6 Qh87QrqbvQqsnck+fCs6fg7FfZP7uQxPC2qm1PK4KVpk1qemLRyvchVbwh2q8zoSUVdIo/TxYUfkw s1wAs6L0ISQ5gs089sQfBf31OL4to9+Q3Xsxs3D9Mx0DQUxA2ZjBYA8vXkd9qxMX0CqsOnZEZyNoY kbArsTuYjy4sGEQkJdUjTIYUBz/j/474bROimALC0wdk4cfUdBgfwxOL2rTUBanBq+KhGB4KXLvb7 viVkJQdoHB3OEPgCG+s88fchw9lzX17i2sBm1IAgr7DPNDad/jwoNBm80NeFoyv03i6vn1Md6lnXL Eahrm8lvBSX/A/C7jBtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqinB-001tJg-TO; Thu, 03 Nov 2022 22:34:33 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqimv-001tEL-Fn for linux-riscv@lists.infradead.org; Thu, 03 Nov 2022 22:34:23 +0000 Received: by mail-pj1-x1033.google.com with SMTP id l6so3017362pjj.0 for ; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=mkCIQ7bnuqf5rnZcP6hp5JREtMJ78/S1f1OWtkJaTeRse5OVZRNDMID1AYpz+jBJzg eTpW9c3Fpt1GJSjywJBWRecDimPLsqOLfN7Nt46XLz4VoW6wiMtnGP3QRSBmWb2Jy2Ue XIrU3j6Zv6WjRE+wBsl7MInjLBoh0ETGKk290BPhyym2xqAHPTTSp2piVfBSnA5Xqpa6 3LkVfTkbpSA7y+3xQukW44oEvhoV3ll0HshYQg8WmMixLpenp+usLAkNlELtK9JmVVTO f4CyPp1jxX+2aW0ZdvzjRbMLb0KbcueA1rrAX1kSu3aGK0UrE4ad6SuEvUCcApyckgBR ztmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=XBao0RWgobb9/9L/0ngz/GZqanG38WaFDwx3i64GNu0XOofNbWt4I8KEnZHMJ191rK 8gfm7zGyxBiQarZZwpq5SNh5pnFcH6Tji97VqxMpgLxz3yQqR++ablufVtBQbc/HCRmX UqHAow4b+++I+n4nRqRqUNi0xjdX4fISFTDrWeW2Y+R9+yJh1Jydde4EladwVBgIY9Fz u+hSFzG0Eu/XqEY6GVxIUau2V5Y26BKwi9tcRsNWQ/7ksxMoUvrdxvgNnTHoSe5eHWln PnCk36zz72193eLJhjlxnL7hPVv9gDUPTB5QyGMqGwY+wCb2131ObxTPsBIKgFlGmXk/ S01A== X-Gm-Message-State: ACrzQf3KMAIJgDDLfpENCpmrDesVBuF/XicvX+y9t3mRj3g01ARcpsjF Dw556jHVa4xyGvLdJhQGLO0PpA== X-Google-Smtp-Source: AMsMyM4x/1h/4H3vdmKr9CnvGb6Osipgsi8YDrhqpMcYmjYNzerzqYc2UHi5AhKhfTxXN1DVaborYg== X-Received: by 2002:a17:90a:6045:b0:212:fe9a:5792 with SMTP id h5-20020a17090a604500b00212fe9a5792mr49415367pjm.178.1667514854306; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u10-20020a170902e80a00b00186ad73e2d5sm1151929plg.208.2022.11.03.15.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 15:34:13 -0700 (PDT) Date: Thu, 3 Nov 2022 22:34:10 +0000 From: Sean Christopherson To: Isaku Yamahata Cc: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Chao Gao , Thomas Gleixner , Yuan Yao Subject: Re: [PATCH 36/44] KVM: x86: Do compatibility checks when onlining CPU Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-37-seanjc@google.com> <20221103210402.GB1063309@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221103210402.GB1063309@ls.amr.corp.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221103_153422_713005_B74AC236 X-CRM114-Status: GOOD ( 16.31 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, Nov 03, 2022, Isaku Yamahata wrote: > On Wed, Nov 02, 2022 at 11:19:03PM +0000, > Sean Christopherson wrote: > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index f223c845ed6e..c99222b71fcc 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1666,7 +1666,7 @@ struct kvm_x86_nested_ops { > > }; > > > > struct kvm_x86_init_ops { > > - int (*check_processor_compatibility)(void); > > + int (*check_processor_compatibility)(int cpu); > > Is this cpu argument used only for error message to include cpu number > with avoiding repeating raw_smp_processor_id() in pr_err()? Yep. > The actual check is done on the current executing cpu. > > If cpu != raw_smp_processor_id(), cpu is wrong. Although the function is called > in non-preemptive context, it's a bit confusing. So voting to remove it and > to use. What if I rename the param is this_cpu? I 100% agree the argument is confusing as-is, but forcing all the helpers to manually grab the cpu is quite annoying. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 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.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 88C87C4332F for ; Thu, 3 Nov 2022 22:35:11 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4N3JVP6VWhz3cj6 for ; Fri, 4 Nov 2022 09:35:09 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=mkCIQ7bn; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::102a; helo=mail-pj1-x102a.google.com; envelope-from=seanjc@google.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=mkCIQ7bn; dkim-atps=neutral Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4N3JTP5hR9z3cJ2 for ; Fri, 4 Nov 2022 09:34:16 +1100 (AEDT) Received: by mail-pj1-x102a.google.com with SMTP id l6so3017363pjj.0 for ; Thu, 03 Nov 2022 15:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=mkCIQ7bnuqf5rnZcP6hp5JREtMJ78/S1f1OWtkJaTeRse5OVZRNDMID1AYpz+jBJzg eTpW9c3Fpt1GJSjywJBWRecDimPLsqOLfN7Nt46XLz4VoW6wiMtnGP3QRSBmWb2Jy2Ue XIrU3j6Zv6WjRE+wBsl7MInjLBoh0ETGKk290BPhyym2xqAHPTTSp2piVfBSnA5Xqpa6 3LkVfTkbpSA7y+3xQukW44oEvhoV3ll0HshYQg8WmMixLpenp+usLAkNlELtK9JmVVTO f4CyPp1jxX+2aW0ZdvzjRbMLb0KbcueA1rrAX1kSu3aGK0UrE4ad6SuEvUCcApyckgBR ztmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=1kuYeqgavn24bDqbtOpceHgKDaD0hLQLCi5UkQ1xzPVl/OQy0QbwiIgH0rkXpKInGH 53TYdYWdkrmguny/QyAM7TTJTdGGB8vpeI63ZY6gbfFH0eE4Tyds7AICCX+Muw7bZ5V/ twtlDf9cqfa3jjZH2EmzArqLzCsRHCh2LlJH0b1aATmFPnsbgRFMVnlTT2nSfn+DfEOP tw0BuKvKTkEJIAR86scO0lKy2jDL4cH0rDcEyWdHY3AYCfcVZALcBqz9Zax1KXyWGWmq jXsLMPQO1NC87qNgkDC+oF3iGc4hikWJiKr1eAn7BDT0lnvDjmvyOTlmvrSjsLwu0/xI eycA== X-Gm-Message-State: ACrzQf1hVb6tW8pha0g0flPZ4Yd3AYORxF/sjDoi/2tbxGpJZlftz2eu 7pQNvXtVMYVlg9eCk4nw5zuViA== X-Google-Smtp-Source: AMsMyM4x/1h/4H3vdmKr9CnvGb6Osipgsi8YDrhqpMcYmjYNzerzqYc2UHi5AhKhfTxXN1DVaborYg== X-Received: by 2002:a17:90a:6045:b0:212:fe9a:5792 with SMTP id h5-20020a17090a604500b00212fe9a5792mr49415367pjm.178.1667514854306; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u10-20020a170902e80a00b00186ad73e2d5sm1151929plg.208.2022.11.03.15.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 15:34:13 -0700 (PDT) Date: Thu, 3 Nov 2022 22:34:10 +0000 From: Sean Christopherson To: Isaku Yamahata Subject: Re: [PATCH 36/44] KVM: x86: Do compatibility checks when onlining CPU Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-37-seanjc@google.com> <20221103210402.GB1063309@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103210402.GB1063309@ls.amr.corp.intel.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Rosato , David Hildenbrand , Yuan Yao , Paul Walmsley , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, linux-s390@vger.kernel.org, Janosch Frank , Marc Zyngier , Huacai Chen , Aleksandar Markovic , James Morse , Christian Borntraeger , Chao Gao , Eric Farman , Albert Ou , Suzuki K Poulose , kvm@vger.kernel.org, Atish Patra , kvmarm@lists.linux.dev, Thomas Gleixner , Alexandru Elisei , linux-arm-kernel@lists.infradead.org, Isaku Yamahata , Fabiano Rosas , linux-mips@vger.kernel.org, Oliver Upton , Palmer Dabbelt , kvm-riscv@lists.infradead.org, Anup Patel , Paolo Bonzini , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Nov 03, 2022, Isaku Yamahata wrote: > On Wed, Nov 02, 2022 at 11:19:03PM +0000, > Sean Christopherson wrote: > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index f223c845ed6e..c99222b71fcc 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1666,7 +1666,7 @@ struct kvm_x86_nested_ops { > > }; > > > > struct kvm_x86_init_ops { > > - int (*check_processor_compatibility)(void); > > + int (*check_processor_compatibility)(int cpu); > > Is this cpu argument used only for error message to include cpu number > with avoiding repeating raw_smp_processor_id() in pr_err()? Yep. > The actual check is done on the current executing cpu. > > If cpu != raw_smp_processor_id(), cpu is wrong. Although the function is called > in non-preemptive context, it's a bit confusing. So voting to remove it and > to use. What if I rename the param is this_cpu? I 100% agree the argument is confusing as-is, but forcing all the helpers to manually grab the cpu is quite annoying. From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3CA65C433FE for ; Thu, 3 Nov 2022 22:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r7mu3E1I2uyJAPhabEZuncpSn+Jp+rz7AOFZjCsuD98=; b=d3Ynvh2q6aScuu ibo8sFNFs/roD/dPNKtsVIGAF6tUJFZqFcraSnEK+yoqapSKiyhYtZ/4XCO7YUM62dVt4/a/oAN/u BC9+vxDgfgGhxBEHLvHo/YYaApxbysrALy0mtREuiFAW+kJ2Ay4qNqUmAcAdjOjozf3A8PX1aHKPS Mum0wmeCRpTkKN2WRzhlZ55sPXUbxto2BXSbTsebPm97wZkP3BKK/Acbf2lBz4eYX9zpqv5ipm2Ro jnFsiOhXzEvLoNtP3Jplep/j6qvZNcJo2YaUK1prv3tQaWLcFnTj72CwHy8MXQgaOClDucUCxxMCU 3X5Vt8ImeKBAtv4GNnvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqin3-001tH7-3b; Thu, 03 Nov 2022 22:34:25 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqimt-001tEM-Cx for linux-arm-kernel@lists.infradead.org; Thu, 03 Nov 2022 22:34:19 +0000 Received: by mail-pj1-x102e.google.com with SMTP id z5-20020a17090a8b8500b00210a3a2364fso6578921pjn.0 for ; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=mkCIQ7bnuqf5rnZcP6hp5JREtMJ78/S1f1OWtkJaTeRse5OVZRNDMID1AYpz+jBJzg eTpW9c3Fpt1GJSjywJBWRecDimPLsqOLfN7Nt46XLz4VoW6wiMtnGP3QRSBmWb2Jy2Ue XIrU3j6Zv6WjRE+wBsl7MInjLBoh0ETGKk290BPhyym2xqAHPTTSp2piVfBSnA5Xqpa6 3LkVfTkbpSA7y+3xQukW44oEvhoV3ll0HshYQg8WmMixLpenp+usLAkNlELtK9JmVVTO f4CyPp1jxX+2aW0ZdvzjRbMLb0KbcueA1rrAX1kSu3aGK0UrE4ad6SuEvUCcApyckgBR ztmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ldFAJy69ux+7z8nNCEANq8kYxugZwXEN2GoxlipQK+E=; b=IuxNaivm59XK87tHg/g8xXJti/jqW765fznXEMi/nJwQNtzI/jl77RWzq80ilJz2dq oZaHa8zMrrCVuq4uPTCohdiQWJRQj7y0IfZjZK32JjAERLx1UPWde9m8r3yMrPP4kCKB Yf0pprDMV5sN0RrFkYWvBPCmANmrtE1ht8alp5mkAsxmmNlcUPNFb12MbPlHUpFGqVAf O7WKadrJ9TvifzYltJFCx+UJ+0wgIy16HUi9cScP1UY31TfYkDubCpc65lLG7pfSSXCP q9WWB4SCkCOeRo7DeW6ckXscdXhYETb9dE9TnG4quNOoP1NdbofKIf7ftVvjBD/cmxmR nXDQ== X-Gm-Message-State: ACrzQf0nRYc38PLfkEvewadNixzNI3s+s88sMAflCXvueuV+XljeWenH 8FFljH1zvG+xOM/7ffSwwHPgEw== X-Google-Smtp-Source: AMsMyM4x/1h/4H3vdmKr9CnvGb6Osipgsi8YDrhqpMcYmjYNzerzqYc2UHi5AhKhfTxXN1DVaborYg== X-Received: by 2002:a17:90a:6045:b0:212:fe9a:5792 with SMTP id h5-20020a17090a604500b00212fe9a5792mr49415367pjm.178.1667514854306; Thu, 03 Nov 2022 15:34:14 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u10-20020a170902e80a00b00186ad73e2d5sm1151929plg.208.2022.11.03.15.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 15:34:13 -0700 (PDT) Date: Thu, 3 Nov 2022 22:34:10 +0000 From: Sean Christopherson To: Isaku Yamahata Cc: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Chao Gao , Thomas Gleixner , Yuan Yao Subject: Re: [PATCH 36/44] KVM: x86: Do compatibility checks when onlining CPU Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-37-seanjc@google.com> <20221103210402.GB1063309@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221103210402.GB1063309@ls.amr.corp.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221103_153416_876731_FD9F3744 X-CRM114-Status: GOOD ( 17.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 03, 2022, Isaku Yamahata wrote: > On Wed, Nov 02, 2022 at 11:19:03PM +0000, > Sean Christopherson wrote: > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > > index f223c845ed6e..c99222b71fcc 100644 > > --- a/arch/x86/include/asm/kvm_host.h > > +++ b/arch/x86/include/asm/kvm_host.h > > @@ -1666,7 +1666,7 @@ struct kvm_x86_nested_ops { > > }; > > > > struct kvm_x86_init_ops { > > - int (*check_processor_compatibility)(void); > > + int (*check_processor_compatibility)(int cpu); > > Is this cpu argument used only for error message to include cpu number > with avoiding repeating raw_smp_processor_id() in pr_err()? Yep. > The actual check is done on the current executing cpu. > > If cpu != raw_smp_processor_id(), cpu is wrong. Although the function is called > in non-preemptive context, it's a bit confusing. So voting to remove it and > to use. What if I rename the param is this_cpu? I 100% agree the argument is confusing as-is, but forcing all the helpers to manually grab the cpu is quite annoying. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel