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 4E10BC4167B for ; Fri, 1 Dec 2023 12:16:37 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fcmSoby7WdKHu4pDzH3WvPxClIkbgDOMbnFFDfPVfaM=; b=L2tdO1HMb2Mjim x+UbkJ+bzNVUp4Ixlj0Vet9br87wiFhAC114KI8lr3HB8DA/G/Qx3IczRE5NpJnWtQNZMPw4iGjR5 gtwpn6CLr+6E/uaqB+d3Y9Rtu8eYTARinJsZOIilPasg3YIAs2KA8yxe0pnwpvjdCVwXqqUCMxPV/ gRLxnMQglEWcraRjrE7USMnxEVjmydMzXfp8mAquvF8RVJ8vVz13kdrhLTW0Ymaca5+Vl7eOXQqkW IHn52UZQQCQEX5UCKaTg56QhTbgK2MS01NuYOJCWIcVM97gIwFItziqHetPjMf6io+Z3Z8jzNdLSt qBWntBZgXA6WQw2k90jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r92RF-00DXIX-1f; Fri, 01 Dec 2023 12:16:09 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r92R8-00DXGP-0R for linux-arm-kernel@lists.infradead.org; Fri, 01 Dec 2023 12:16:07 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3434A62155; Fri, 1 Dec 2023 12:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0463C433CA; Fri, 1 Dec 2023 12:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701432960; bh=TtoSxyQtOJ6tC1yKOx3Q1L5BgRytk+gwlOHXcbivH5U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kl7MSOXpddo+13XbEopQh8ZVsn7KhLh4ke5ecAWJsezrPEZe2y/ONWv9mRUqtT8vV KF5O5KNGZBvzcIzuyRO/L6PqMI4cA3eScwUjg3tHmjZanx9bXzBx+4RklFgp4aSeVO BC5E7SWko3txI8LQLWzNMqtmS/B++fA9fDD6+FZmelhEYiHDchytm77jxhqDFrm2si kb+LgkZs+KenMdVOTqCzWrZJap7xNu3kne4GIT7VISUK+/6bbmk+7CRUFKnIEP5CXU ZrUTuNQCeC4Q0rNpF827P/VrExZWkjqHvueLUyvg6bCFiUVkUaSNRfoQrIGavLnZWT jk4jBVSgVt45g== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r92R4-000Y7D-5x; Fri, 01 Dec 2023 12:15:58 +0000 Date: Fri, 01 Dec 2023 12:15:56 +0000 Message-ID: <86y1eeazk3.wl-maz@kernel.org> From: Marc Zyngier To: "liting (Q)" Cc: , , , , , , , , , Subject: Re: [PATCH] KVM: arm64: fix MPIDR to vcpu index cache to support vcpu change at runtime In-Reply-To: References: <20231128135402.1943-1-liting8@huawei.com> <87il5k8j1p.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: liting8@huawei.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, zhengchuan@huawei.com, xiexiangyou@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_041602_261088_5434D50C X-CRM114-Status: GOOD ( 22.35 ) 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 Hi Ting, On Fri, 01 Dec 2023 10:48:54 +0000, "liting (Q)" wrote: > > On 2023/11/30 3:18, Marc Zyngier wrote: > > On Tue, 28 Nov 2023 13:54:02 +0000, > > l00313349 wrote: > >> From: Ting Li > >> > >> Consider vcpu change at runtime, for example online_vcpus is 8, > >> but only start 2 vcpu threads, MPIDR to vcpu index 0 may be overwrited > >> and vm hangs. When start other vcpu threads, cache will be outdated > >> and always get mismatch. > > If userspace creates two vcpus with the same vcpu_id, and therefore > > the same MPIDR value, that's userspace's problem. Don't do that. > > > > Why should we do anything else? > > > > M. > Hi Marc, > Thanks for your reply. Maybe you have misunderstanding about it. > The problem is not two vcpus with the same vcpu_id, but different vcpu_id > have the same MPIDR value in some situation such as vcpu hotplug. But that's *wrong*. The whole point of MPIDR is that it distinguishes between CPUs. By definition, MPIDR *must* be unique in the system, and if you have two vcpus with the same MPIDR, you have a broken VM. > In my case, total vcpu count is 8 but only start 2 vcpu at the beginning, > then vcpu_id 2-7 will get the same MPIDR value 0 with vcpu_id 0, so > index 0 will be overwrited to vcpu_id 7. And that's wrong as per the letter of the architecture. Here's what it says: "In an implementation containing multiple PEs, each PE is identified by a unique affinity value reported by MPIDR_EL1{Aff3, Aff2, Aff1, Aff0}" (D12.4 Attributability). You don't have a case here. You are creating a VM that is in complete violation of the architecture. It is your choice to do so, but don't expect things to work. > Please check, thanks. I did. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel