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 CD82EC4332F for ; Thu, 17 Nov 2022 15:16:32 +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=x35dvsKaoTwipGwhPVJLyy+j6woM+qFvh2qXO0ynzno=; b=gGfKCvzhFhoJ6f 8zW05Af3dsKqGu6hl2HrEenFNdcarfm0sz7A2lKKqAyW4/DJcpnwEm8XrrBNAXlEIDKQcuEvkPtVs jJ4fGf2nPj8tYm0p0xBhKY/5620kN80KAlg3YeWSNgk2DntpaJUqbkcNeWiF5yE+oT++87aAW8QML 0x2c7RBqBC0bhpVY+XcCQ0T0+R/VNHTj4cPQsmFCoGbckIoeVlySCWXV+trftXbX8uMAdj48BlRCu y/eBTROqII0Z+mwJh4E4+4wQzhyzbQkl3E6G7f6K8r5sR6a0vPJHpn8Vmo0rTPrxsxOUvYg6o+yhi fxE1vAi1Z4/K7iYTlKNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovgcp-00F9Zi-4X; Thu, 17 Nov 2022 15:16:23 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovgcm-00F9Xn-H5 for linux-riscv@lists.infradead.org; Thu, 17 Nov 2022 15:16:21 +0000 Received: by mail-pj1-x1031.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so5680813pjc.3 for ; Thu, 17 Nov 2022 07:16:19 -0800 (PST) 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=im3ECY8irru0d2J3PmRkK1oS6XMYGDmkKrSKiLpQr6kggh65U519LacoANhp99/wDs yHeOZt/b6IK2ihlol7f0Ba2me3bs0cr3TxYhTcQThAifpYqs8dB3p/8NK2dEXBDay90O bW6pXrP7B14I1MNWa+NfggtZKbyTz1rnHhMsVYBCQiIPWqcakktYyuja6CoTLxQtkpfs JsqTKBMeEN72FgBWe/ihbCXP9h1x9TEb9ulziUgPn3ZIyNK23YQtGzg65j8/As9Xyk7K 3+HVs34s1miAiKC8ZfgoVMv73WwF3DJWJcQDYskZpYkejUuTFt6cPMAw/xSDBCQyvpM1 B6Kg== 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=JxrRXZGID9gvI6w0Ho6pvH9TUnGM6kQRKukxaPxkje+91LheQF3HbtpeI3AE6unokC 3WHiE9Pn620NJigzykK9p2Xm6CR5QKnhtQZUA7I/ueHqX2Lh5iz2bWhcUXKkOxE1vgeL 2tnpLBtEr4AZAalkpTVAIIYW46DUvkfuSu59XRgv5c1avxqCkCI890JnwoG9tMyWpN09 eODeSVxaaT2LRJSzO6g+Xvt6bUUXQGypdeyrd37QHXlKd9KZAjWBaBYpbdBuf+lSoo7X ja8vuXoF7zhMSr7ocYLuzCSoMYDO0NYT1lsCgJdHpvgzVl0KZf2b/D6Ibkxzl9Ouu420 fE8w== X-Gm-Message-State: ANoB5pmwnblYPeJJ1u7R1oopoKgBq4f7UBHiflBW/7h5TmnQNUOxeiRq 9SrqnNfN43uzEyThvxOm37xAkQ== X-Google-Smtp-Source: AA0mqf5Drbj5GGUy8zNXmPljMG8UuEFTPTHf+YuwVXyWlSocFeljs1OjIQ+Ab7mWXZMNXetmsxdGbQ== X-Received: by 2002:a17:90a:6b84:b0:20a:cbb0:3c9b with SMTP id w4-20020a17090a6b8400b0020acbb03c9bmr3280802pjj.81.1668698179289; Thu, 17 Nov 2022 07:16:19 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id r12-20020a63e50c000000b00476dc914262sm1135777pgh.1.2022.11.17.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:16:18 -0800 (PST) Date: Thu, 17 Nov 2022 15:16:15 +0000 From: Sean Christopherson To: "Huang, Kai" Cc: "borntraeger@linux.ibm.com" , "Yao, Yuan" , "tglx@linutronix.de" , "kvm-riscv@lists.infradead.org" , "kvm@vger.kernel.org" , "Yamahata, Isaku" , "suzuki.poulose@arm.com" , "pbonzini@redhat.com" , "david@redhat.com" , "linux-mips@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-riscv@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "mjrosato@linux.ibm.com" , "oliver.upton@linux.dev" , "farosas@linux.ibm.com" , "linux-s390@vger.kernel.org" , "palmer@dabbelt.com" , "chenhuacai@kernel.org" , "mpe@ellerman.id.au" , "aou@eecs.berkeley.edu" , "alexandru.elisei@arm.com" , "vkuznets@redhat.com" , "maz@kernel.org" , "anup@brainfault.org" , "frankja@linux.ibm.com" , "aleksandar.qemu.devel@gmail.com" , "james.morse@arm.com" , "kvmarm@lists.cs.columbia.edu" , "farman@linux.ibm.com" , "paul.walmsley@sifive.com" , "linux-arm-kernel@lists.infradead.org" , "atishp@atishpatra.org" , "imbrenda@linux.ibm.com" , "Gao, Chao" Subject: Re: [PATCH 38/44] KVM: Disable CPU hotplug during hardware enabling Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-39-seanjc@google.com> <88e920944de70e7d69a98f74005b49c59b5aaa3b.camel@intel.com> <95ca433349eca601bdd2b16d70f59ba8e56d8e3f.camel@intel.com> <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_071620_608694_0572B9CF X-CRM114-Status: GOOD ( 13.69 ) 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 17, 2022, Huang, Kai wrote: > On Wed, 2022-11-16 at 17:11 +0000, Sean Christopherson wrote: > > static int kvm_x86_check_processor_compatibility(void) > > { > > int cpu = smp_processor_id(); > > struct cpuinfo_x86 *c = &cpu_data(cpu); > > > > /* > > * Compatibility checks are done when loading KVM and when enabling > > * hardware, e.g. during CPU hotplug, to ensure all online CPUs are > > * compatible, i.e. KVM should never perform a compatibility check on > > * an offline CPU. > > */ > > WARN_ON(!cpu_online(cpu)); > > Looks good to me. Perhaps this also can be removed, though. Hmm, it's a bit superfluous, but I think it could fire if KVM messed up CPU hotplug again, e.g. if the for_each_online_cpu() => IPI raced with CPU unplug. > And IMHO the removing of WARN_ON(!irq_disabled()) should be folded to the patch > "[PATCH 37/44] KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section". > Because moving from STARTING section to ONLINE section changes the IRQ status > when the compatibility check is called. Yep, that's what I have coded up, just smushed it all together here. _______________________________________________ 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D990C43217 for ; Thu, 17 Nov 2022 15:16:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BBCFA4B6C5; Thu, 17 Nov 2022 10:16:23 -0500 (EST) 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 qPb3u-Ns70YZ; Thu, 17 Nov 2022 10:16:22 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 721394B81F; Thu, 17 Nov 2022 10:16:22 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id E13D34B822 for ; Thu, 17 Nov 2022 10:16:21 -0500 (EST) 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 U5v7xq-GpQna for ; Thu, 17 Nov 2022 10:16:20 -0500 (EST) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 985F74B6C5 for ; Thu, 17 Nov 2022 10:16:20 -0500 (EST) Received: by mail-pj1-f42.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so5680815pjc.3 for ; Thu, 17 Nov 2022 07:16:20 -0800 (PST) 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=im3ECY8irru0d2J3PmRkK1oS6XMYGDmkKrSKiLpQr6kggh65U519LacoANhp99/wDs yHeOZt/b6IK2ihlol7f0Ba2me3bs0cr3TxYhTcQThAifpYqs8dB3p/8NK2dEXBDay90O bW6pXrP7B14I1MNWa+NfggtZKbyTz1rnHhMsVYBCQiIPWqcakktYyuja6CoTLxQtkpfs JsqTKBMeEN72FgBWe/ihbCXP9h1x9TEb9ulziUgPn3ZIyNK23YQtGzg65j8/As9Xyk7K 3+HVs34s1miAiKC8ZfgoVMv73WwF3DJWJcQDYskZpYkejUuTFt6cPMAw/xSDBCQyvpM1 B6Kg== 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=QjUXNjBBGBeJKkR9PZhBmdt/fJjeRBn8u85PvVkVwcLjxne5dWbhsCrXrSecpatFbh k7QmMFcZiVH33CL2pnamGFtlTwhch0sHOQtpjY29NweWs3z5k4/x2hNdfzKKOYi9r+Xl +hdSR3l/kqV7JXFWFgG85VwJX45mPMZiJ2kQeZnHvMInjBrzzhsmTtyDsnP99fRlTqLa pDUCeZyrswt/+PIIj39wRnc/0xBZVS0F9eH1/aaId8E2C5ZjnUiq73mPBdkRD+zaULD6 ZnZ/wGQrFhcjscv0oCeVZHkIpuSL9+OG4rn3IrBnR2LCRr6AzkEbnS3aYsJk2pPnP6/o FltQ== X-Gm-Message-State: ANoB5pkDAWwjihk8QwlRd2wQnjF8Xz/RQVK+lzRdgVNWBvbOIGMVXAdH 7zX1yagYI9UvVgVcQx2Hq46cSw== X-Google-Smtp-Source: AA0mqf5Drbj5GGUy8zNXmPljMG8UuEFTPTHf+YuwVXyWlSocFeljs1OjIQ+Ab7mWXZMNXetmsxdGbQ== X-Received: by 2002:a17:90a:6b84:b0:20a:cbb0:3c9b with SMTP id w4-20020a17090a6b8400b0020acbb03c9bmr3280802pjj.81.1668698179289; Thu, 17 Nov 2022 07:16:19 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id r12-20020a63e50c000000b00476dc914262sm1135777pgh.1.2022.11.17.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:16:18 -0800 (PST) Date: Thu, 17 Nov 2022 15:16:15 +0000 From: Sean Christopherson To: "Huang, Kai" Subject: Re: [PATCH 38/44] KVM: Disable CPU hotplug during hardware enabling Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-39-seanjc@google.com> <88e920944de70e7d69a98f74005b49c59b5aaa3b.camel@intel.com> <95ca433349eca601bdd2b16d70f59ba8e56d8e3f.camel@intel.com> <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> Cc: "mjrosato@linux.ibm.com" , "david@redhat.com" , "paul.walmsley@sifive.com" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "imbrenda@linux.ibm.com" , "kvmarm@lists.cs.columbia.edu" , "linux-s390@vger.kernel.org" , "kvm@vger.kernel.org" , "mpe@ellerman.id.au" , "chenhuacai@kernel.org" , "aleksandar.qemu.devel@gmail.com" , "borntraeger@linux.ibm.com" , "Gao, Chao" , "farman@linux.ibm.com" , "aou@eecs.berkeley.edu" , "Yao, Yuan" , "kvmarm@lists.linux.dev" , "tglx@linutronix.de" , "linux-arm-kernel@lists.infradead.org" , "frankja@linux.ibm.com" , "Yamahata, Isaku" , "atishp@atishpatra.org" , "farosas@linux.ibm.com" , "linux-mips@vger.kernel.org" , "palmer@dabbelt.com" , "kvm-riscv@lists.infradead.org" , "maz@kernel.org" , "pbonzini@redhat.com" , "vkuznets@redhat.com" , "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 17, 2022, Huang, Kai wrote: > On Wed, 2022-11-16 at 17:11 +0000, Sean Christopherson wrote: > > static int kvm_x86_check_processor_compatibility(void) > > { > > int cpu = smp_processor_id(); > > struct cpuinfo_x86 *c = &cpu_data(cpu); > > > > /* > > * Compatibility checks are done when loading KVM and when enabling > > * hardware, e.g. during CPU hotplug, to ensure all online CPUs are > > * compatible, i.e. KVM should never perform a compatibility check on > > * an offline CPU. > > */ > > WARN_ON(!cpu_online(cpu)); > > Looks good to me. Perhaps this also can be removed, though. Hmm, it's a bit superfluous, but I think it could fire if KVM messed up CPU hotplug again, e.g. if the for_each_online_cpu() => IPI raced with CPU unplug. > And IMHO the removing of WARN_ON(!irq_disabled()) should be folded to the patch > "[PATCH 37/44] KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section". > Because moving from STARTING section to ONLINE section changes the IRQ status > when the compatibility check is called. Yep, that's what I have coded up, just smushed it all together here. _______________________________________________ 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 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 7B350C4332F for ; Thu, 17 Nov 2022 15:17:19 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4NCk6j5MmHz3cMm for ; Fri, 18 Nov 2022 02:17:17 +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=im3ECY8i; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=google.com (client-ip=2607:f8b0:4864:20::1034; helo=mail-pj1-x1034.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=im3ECY8i; dkim-atps=neutral Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (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 4NCk5g0Dn2z3bqW for ; Fri, 18 Nov 2022 02:16:22 +1100 (AEDT) Received: by mail-pj1-x1034.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so5722823pji.1 for ; Thu, 17 Nov 2022 07:16:22 -0800 (PST) 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=im3ECY8irru0d2J3PmRkK1oS6XMYGDmkKrSKiLpQr6kggh65U519LacoANhp99/wDs yHeOZt/b6IK2ihlol7f0Ba2me3bs0cr3TxYhTcQThAifpYqs8dB3p/8NK2dEXBDay90O bW6pXrP7B14I1MNWa+NfggtZKbyTz1rnHhMsVYBCQiIPWqcakktYyuja6CoTLxQtkpfs JsqTKBMeEN72FgBWe/ihbCXP9h1x9TEb9ulziUgPn3ZIyNK23YQtGzg65j8/As9Xyk7K 3+HVs34s1miAiKC8ZfgoVMv73WwF3DJWJcQDYskZpYkejUuTFt6cPMAw/xSDBCQyvpM1 B6Kg== 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=Pd+6v6JiMZWOhrWy/b1av+5CSxaKFrru1rQNwDRnwVLX/Yy7ymE8frjxF3ZlDyfNVT DfG4cVSLB3Xc5C7gsqd+1gaj6S8uLB6h0r44/oFQlDvFn2zVZlhMD1oeeU8gbmZZHZWF DS7iYhrzqtrKg1Ppwv8en/XJLtM0BRU2wKdSPtUdrCQfQ0/PbsrQdwi7GIwJPfiPAwol 2FhpIsZxxlPdHZssxIAbqiZjm6mtT0lwxaXpjKeWboqWGZ15SZU5hiONpix/s/DX2R4V wTP/bXsaonevIdu+fb6BV8LRJUntdZqRh5YYCIjfXRT3x0bFS42LldQIr5lzXYKToU7l myPg== X-Gm-Message-State: ANoB5pnRcylNWQ0Ov8mUAcVe5vnyhlR7xyADZnaySX8+wRgpqD7fj3JQ wwMDGSyCctkFh/O8vC4HdLyu0w== X-Google-Smtp-Source: AA0mqf5Drbj5GGUy8zNXmPljMG8UuEFTPTHf+YuwVXyWlSocFeljs1OjIQ+Ab7mWXZMNXetmsxdGbQ== X-Received: by 2002:a17:90a:6b84:b0:20a:cbb0:3c9b with SMTP id w4-20020a17090a6b8400b0020acbb03c9bmr3280802pjj.81.1668698179289; Thu, 17 Nov 2022 07:16:19 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id r12-20020a63e50c000000b00476dc914262sm1135777pgh.1.2022.11.17.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:16:18 -0800 (PST) Date: Thu, 17 Nov 2022 15:16:15 +0000 From: Sean Christopherson To: "Huang, Kai" Subject: Re: [PATCH 38/44] KVM: Disable CPU hotplug during hardware enabling Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-39-seanjc@google.com> <88e920944de70e7d69a98f74005b49c59b5aaa3b.camel@intel.com> <95ca433349eca601bdd2b16d70f59ba8e56d8e3f.camel@intel.com> <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@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: "mjrosato@linux.ibm.com" , "david@redhat.com" , "paul.walmsley@sifive.com" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "imbrenda@linux.ibm.com" , "kvmarm@lists.cs.columbia.edu" , "linux-s390@vger.kernel.org" , "kvm@vger.kernel.org" , "chenhuacai@kernel.org" , "aleksandar.qemu.devel@gmail.com" , "james.morse@arm.com" , "borntraeger@linux.ibm.com" , "Gao, Chao" , "farman@linux.ibm.com" , "aou@eecs.berkeley.edu" , "suzuki.poulose@arm.com" , "Yao, Yuan" , "kvmarm@lists.linux.dev" , "tglx@linutro nix.de" , "alexandru.elisei@arm.com" , "linux-arm-kernel@lists.infradead.org" , "frankja@linux.ibm.com" , "Yamahata, Isaku" , "atishp@atishpatra.org" , "farosas@linux.ibm.com" , "anup@brainfault.org" , "linux-mips@vger.kernel.org" , "oliver.upton@linux.dev" , "palmer@dabbelt.com" , "kvm-riscv@lists.infradead.org" , "maz@kernel.org" , "pbonzini@redhat.com" , "vkuznets@redhat.com" , "linuxppc-dev@lists.ozlabs.org" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Nov 17, 2022, Huang, Kai wrote: > On Wed, 2022-11-16 at 17:11 +0000, Sean Christopherson wrote: > > static int kvm_x86_check_processor_compatibility(void) > > { > > int cpu = smp_processor_id(); > > struct cpuinfo_x86 *c = &cpu_data(cpu); > > > > /* > > * Compatibility checks are done when loading KVM and when enabling > > * hardware, e.g. during CPU hotplug, to ensure all online CPUs are > > * compatible, i.e. KVM should never perform a compatibility check on > > * an offline CPU. > > */ > > WARN_ON(!cpu_online(cpu)); > > Looks good to me. Perhaps this also can be removed, though. Hmm, it's a bit superfluous, but I think it could fire if KVM messed up CPU hotplug again, e.g. if the for_each_online_cpu() => IPI raced with CPU unplug. > And IMHO the removing of WARN_ON(!irq_disabled()) should be folded to the patch > "[PATCH 37/44] KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section". > Because moving from STARTING section to ONLINE section changes the IRQ status > when the compatibility check is called. Yep, that's what I have coded up, just smushed it all together here. 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 AAA28C4332F for ; Thu, 17 Nov 2022 15:17:29 +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=/gAJoWp2aX8JcbCcyns1wkxazNPSTrzJoc1kqUCFtdY=; b=aEkwKJLjxSPul+ 1cIrkV82bpx6dUozdmyVwpVsCg2ghFpMXGyeT4bki1K59mEFLryIG7VYnwuQsgyKfk10BG0bGIjk3 hTCfgbZOhKsvxMLbrhhyaCqVulf8WRrztWNE1/+0waP58ZeA0dRYWbvKiucqX2BvHVL1wQFLjg+qU So36/5xiaqbupAsUslcMJ1CoLoO83B17EBOCI6zCOgJcdv6X6W7XWrSqNRMc0hkj/558/6b5QCH3m 1DmkVK6zhCrZGB1dw7PKMLKGZYqU2kJePycIrS2nh7d7EPnVTiu01APP5enb3ZmLrE5Xahqpvu7rP kXVLSVt+7MDTF9UPGRFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovgcr-00F9ap-FM; Thu, 17 Nov 2022 15:16:25 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovgcm-00F9Xo-SE for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 15:16:23 +0000 Received: by mail-pj1-x102d.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso5660056pjg.5 for ; Thu, 17 Nov 2022 07:16:19 -0800 (PST) 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=im3ECY8irru0d2J3PmRkK1oS6XMYGDmkKrSKiLpQr6kggh65U519LacoANhp99/wDs yHeOZt/b6IK2ihlol7f0Ba2me3bs0cr3TxYhTcQThAifpYqs8dB3p/8NK2dEXBDay90O bW6pXrP7B14I1MNWa+NfggtZKbyTz1rnHhMsVYBCQiIPWqcakktYyuja6CoTLxQtkpfs JsqTKBMeEN72FgBWe/ihbCXP9h1x9TEb9ulziUgPn3ZIyNK23YQtGzg65j8/As9Xyk7K 3+HVs34s1miAiKC8ZfgoVMv73WwF3DJWJcQDYskZpYkejUuTFt6cPMAw/xSDBCQyvpM1 B6Kg== 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=b7NhDoAxiuNPSMSpcMm3DV8/QtvjELLKxdc0A1bWwefWtj+Xp+tso02WYA4g5JRh+f Pq2KehMXsk0BYXRM5eLNFoIe+4GjdxvyJvZt203B6jA7My+KQ2PRxYVPuXI65ZuNlj0b tk/DV4YzTUkanuXk85FRkrybgWs90O15avVpQ6TkrGU9ujD1xAobEo1BCTYXjdy2M/md pVhx97KjqoYRdUmiI6oebV8Bzie9KagfIrNMF3OFvB9qHgcZLbu6cOf69EeRQSTB3xoJ JGGla/yb4Mmp+s/TtrlXNUr/Krz00aZ9bOrlxJbvglG9yzbt9DZPiwj4rkr3avCKNdl3 +WWQ== X-Gm-Message-State: ANoB5pnLLBPMNwhky3MDUL7tNS4Zp+dZIDXdZurID8XUq9/zIyVK9x0f 65ZFw8F7sCFljF+uM7vzprgUAQ== X-Google-Smtp-Source: AA0mqf5Drbj5GGUy8zNXmPljMG8UuEFTPTHf+YuwVXyWlSocFeljs1OjIQ+Ab7mWXZMNXetmsxdGbQ== X-Received: by 2002:a17:90a:6b84:b0:20a:cbb0:3c9b with SMTP id w4-20020a17090a6b8400b0020acbb03c9bmr3280802pjj.81.1668698179289; Thu, 17 Nov 2022 07:16:19 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id r12-20020a63e50c000000b00476dc914262sm1135777pgh.1.2022.11.17.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:16:18 -0800 (PST) Date: Thu, 17 Nov 2022 15:16:15 +0000 From: Sean Christopherson To: "Huang, Kai" Cc: "borntraeger@linux.ibm.com" , "Yao, Yuan" , "tglx@linutronix.de" , "kvm-riscv@lists.infradead.org" , "kvm@vger.kernel.org" , "Yamahata, Isaku" , "suzuki.poulose@arm.com" , "pbonzini@redhat.com" , "david@redhat.com" , "linux-mips@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-riscv@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "mjrosato@linux.ibm.com" , "oliver.upton@linux.dev" , "farosas@linux.ibm.com" , "linux-s390@vger.kernel.org" , "palmer@dabbelt.com" , "chenhuacai@kernel.org" , "mpe@ellerman.id.au" , "aou@eecs.berkeley.edu" , "alexandru.elisei@arm.com" , "vkuznets@redhat.com" , "maz@kernel.org" , "anup@brainfault.org" , "frankja@linux.ibm.com" , "aleksandar.qemu.devel@gmail.com" , "james.morse@arm.com" , "kvmarm@lists.cs.columbia.edu" , "farman@linux.ibm.com" , "paul.walmsley@sifive.com" , "linux-arm-kernel@lists.infradead.org" , "atishp@atishpatra.org" , "imbrenda@linux.ibm.com" , "Gao, Chao" Subject: Re: [PATCH 38/44] KVM: Disable CPU hotplug during hardware enabling Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-39-seanjc@google.com> <88e920944de70e7d69a98f74005b49c59b5aaa3b.camel@intel.com> <95ca433349eca601bdd2b16d70f59ba8e56d8e3f.camel@intel.com> <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_071620_930495_11B5399C X-CRM114-Status: GOOD ( 14.96 ) 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 17, 2022, Huang, Kai wrote: > On Wed, 2022-11-16 at 17:11 +0000, Sean Christopherson wrote: > > static int kvm_x86_check_processor_compatibility(void) > > { > > int cpu = smp_processor_id(); > > struct cpuinfo_x86 *c = &cpu_data(cpu); > > > > /* > > * Compatibility checks are done when loading KVM and when enabling > > * hardware, e.g. during CPU hotplug, to ensure all online CPUs are > > * compatible, i.e. KVM should never perform a compatibility check on > > * an offline CPU. > > */ > > WARN_ON(!cpu_online(cpu)); > > Looks good to me. Perhaps this also can be removed, though. Hmm, it's a bit superfluous, but I think it could fire if KVM messed up CPU hotplug again, e.g. if the for_each_online_cpu() => IPI raced with CPU unplug. > And IMHO the removing of WARN_ON(!irq_disabled()) should be folded to the patch > "[PATCH 37/44] KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section". > Because moving from STARTING section to ONLINE section changes the IRQ status > when the compatibility check is called. Yep, that's what I have coded up, just smushed it all together here. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B259C4332F for ; Thu, 17 Nov 2022 15:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239307AbiKQPVR (ORCPT ); Thu, 17 Nov 2022 10:21:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240521AbiKQPUN (ORCPT ); Thu, 17 Nov 2022 10:20:13 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03F7BBF43 for ; Thu, 17 Nov 2022 07:16:20 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso2147276pjt.0 for ; Thu, 17 Nov 2022 07:16:19 -0800 (PST) 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=im3ECY8irru0d2J3PmRkK1oS6XMYGDmkKrSKiLpQr6kggh65U519LacoANhp99/wDs yHeOZt/b6IK2ihlol7f0Ba2me3bs0cr3TxYhTcQThAifpYqs8dB3p/8NK2dEXBDay90O bW6pXrP7B14I1MNWa+NfggtZKbyTz1rnHhMsVYBCQiIPWqcakktYyuja6CoTLxQtkpfs JsqTKBMeEN72FgBWe/ihbCXP9h1x9TEb9ulziUgPn3ZIyNK23YQtGzg65j8/As9Xyk7K 3+HVs34s1miAiKC8ZfgoVMv73WwF3DJWJcQDYskZpYkejUuTFt6cPMAw/xSDBCQyvpM1 B6Kg== 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=Geqy1MGLbG4CNNhTg6ig5gMw4IRIu2ApDkqg8kUu6fE=; b=R8h+jKYQbW+WHQKCrqvNUN7ZEjjYTD4p777XUkFSXfDKoyv8lKr9qhh1Hwm/DSqVf6 v5AfiBH0qFs4pHU6W9+Izf1gkCzR2Ft3x2bN3feSOqDHMPyaqhLTcjApPrNRILSbj8GQ m5qxPaRXX6QTbWx4UmPwUVyYFz1+VnREhUEwPFI4ZQAw9gu/fI0x1lHC4za7z++0rdPf HNX2TMGf/pAp15dM97hyEGIKZEsHu2pkKfOSW7eBycjG+BZMxfHygPaSbmYC+lbFncDW 1D8MFID0A7T9uLMN9kKkI0A3kz+So8xzuPTGNwP6Q3CdMugJQfmkVEsSl8LIoX5KDgk2 lycQ== X-Gm-Message-State: ANoB5pmG1cguGhtREkZT51A6zCjX6mowfqQY8M/mpF2lKBBcF7w6wART 1daa8n0A9gxlf8wTT/u9KWBkiQ== X-Google-Smtp-Source: AA0mqf5Drbj5GGUy8zNXmPljMG8UuEFTPTHf+YuwVXyWlSocFeljs1OjIQ+Ab7mWXZMNXetmsxdGbQ== X-Received: by 2002:a17:90a:6b84:b0:20a:cbb0:3c9b with SMTP id w4-20020a17090a6b8400b0020acbb03c9bmr3280802pjj.81.1668698179289; Thu, 17 Nov 2022 07:16:19 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id r12-20020a63e50c000000b00476dc914262sm1135777pgh.1.2022.11.17.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:16:18 -0800 (PST) Date: Thu, 17 Nov 2022 15:16:15 +0000 From: Sean Christopherson To: "Huang, Kai" Cc: "borntraeger@linux.ibm.com" , "Yao, Yuan" , "tglx@linutronix.de" , "kvm-riscv@lists.infradead.org" , "kvm@vger.kernel.org" , "Yamahata, Isaku" , "suzuki.poulose@arm.com" , "pbonzini@redhat.com" , "david@redhat.com" , "linux-mips@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-riscv@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "mjrosato@linux.ibm.com" , "oliver.upton@linux.dev" , "farosas@linux.ibm.com" , "linux-s390@vger.kernel.org" , "palmer@dabbelt.com" , "chenhuacai@kernel.org" , "mpe@ellerman.id.au" , "aou@eecs.berkeley.edu" , "alexandru.elisei@arm.com" , "vkuznets@redhat.com" , "maz@kernel.org" , "anup@brainfault.org" , "frankja@linux.ibm.com" , "aleksandar.qemu.devel@gmail.com" , "james.morse@arm.com" , "kvmarm@lists.cs.columbia.edu" , "farman@linux.ibm.com" , "paul.walmsley@sifive.com" , "linux-arm-kernel@lists.infradead.org" , "atishp@atishpatra.org" , "imbrenda@linux.ibm.com" , "Gao, Chao" Subject: Re: [PATCH 38/44] KVM: Disable CPU hotplug during hardware enabling Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-39-seanjc@google.com> <88e920944de70e7d69a98f74005b49c59b5aaa3b.camel@intel.com> <95ca433349eca601bdd2b16d70f59ba8e56d8e3f.camel@intel.com> <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7fb66c497b6c41049167b05c63267cbc301b1c20.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 17, 2022, Huang, Kai wrote: > On Wed, 2022-11-16 at 17:11 +0000, Sean Christopherson wrote: > > static int kvm_x86_check_processor_compatibility(void) > > { > > int cpu = smp_processor_id(); > > struct cpuinfo_x86 *c = &cpu_data(cpu); > > > > /* > > * Compatibility checks are done when loading KVM and when enabling > > * hardware, e.g. during CPU hotplug, to ensure all online CPUs are > > * compatible, i.e. KVM should never perform a compatibility check on > > * an offline CPU. > > */ > > WARN_ON(!cpu_online(cpu)); > > Looks good to me. Perhaps this also can be removed, though. Hmm, it's a bit superfluous, but I think it could fire if KVM messed up CPU hotplug again, e.g. if the for_each_online_cpu() => IPI raced with CPU unplug. > And IMHO the removing of WARN_ON(!irq_disabled()) should be folded to the patch > "[PATCH 37/44] KVM: Rename and move CPUHP_AP_KVM_STARTING to ONLINE section". > Because moving from STARTING section to ONLINE section changes the IRQ status > when the compatibility check is called. Yep, that's what I have coded up, just smushed it all together here.