From patchwork Wed Apr 19 02:18:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 13216285 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 6AD03C77B75 for ; Wed, 19 Apr 2023 02:20:10 +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:Cc:To:From:Subject:Message-ID: Mime-Version:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=VcRvgEu0syYzyaO/IgMJXRW4AYbubXiTV+xTxD7aZ+Q=; b=PWv 6nnOESfWkZY/9EBCHGmDPfLvStYlQ7i6+qa0sgBGkO25bFjSM+if/KEX2474cprrl4OpwBHnNONXC QPoR/w05k6DxH9hToTWEhhS1gZN1rGHAohtEG4TW0j4JAnmh5/I7xhM3Ur9VGN0bW+NoTD76fyVI5 FLTAX2Ec9KJDA2MCrnnJ3ExNRZ3Q6pARVYWSOkSUwCetAJ1bRokWdR5aEYduGhFp99PBwcarrbKE7 yYZT+poH9F75HpolNmLiCXTXA/7EK6Mra7+x4tsbYkdmY2rFIASV9zSKsAF98fVHAGSLNu0aidM8y eydyNE/onYOYNLXd96MHY5wgsbTORuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poxPX-003lpa-0j; Wed, 19 Apr 2023 02:19:07 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poxPU-003loD-1Q for linux-arm-kernel@lists.infradead.org; Wed, 19 Apr 2023 02:19:05 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-54f89e7de94so190589337b3.17 for ; Tue, 18 Apr 2023 19:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681870740; x=1684462740; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=uIQVFmX2aoFoB7i2FrXfQsGBMoh8PIBdIK2tuO4hjcE=; b=ONU8xLR+iEO1bp4KRX0tM/qLYxwTC6Bl3CY5kkSNXzDwRBp2IhtFf3e57OkM62pItO S8XcfsmwtlMnb70mDDijlH0DHfgeBo1b+n+A0JBLRxAWB6+uyPy7xRBRzglbg4qvyAjX n0BnCIUkn0UwRBWKhRCOLKNAMl7FbjT7uhoC+qKe+byq5YAiOnOvSb+URhV+OelEaNLg EQ26IpCahWEIBYmAIWrlK0sEZQdQVQc8Qkg7d88bCoDWrD1zGpXrGH1bCsCzFRWgFwde g6dgM0oKISl6YJdHWQCQH5GpOFif0pSZWaCRoI1nl5q6G96Lvxz69OrLGFWeaZPz+NUk xbyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681870740; x=1684462740; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=uIQVFmX2aoFoB7i2FrXfQsGBMoh8PIBdIK2tuO4hjcE=; b=aB7c/xhn2WrDMP/ejdBFxFDVKLCuZNrR+txaJnzAsxTfHY+6Fuhav6cV1Ry4qxhqPx gfZovWb7tDb462SwqbjzmOKIMcLTTS6NpPMb1BhXMCJ+B4hGALbL7Sad8LkJaGmygccj rn2ZR5YWW9Uvvx8tR8O+LLdtPp/QAWnT0HLt2VMqajdESfGXm6rR3k+ZVM9y8k/1fSwy 31mj4DTAh8DDRc+RdXiIfWeqg97ofZ7VpHzqsrZcV+yNNhvWQ8NnS2QX2uewHmJuAiB8 SfY5HD7qLndw5nvpj9UIEPyshyjrccHSEnuQ11uoQabKj2JHWX2L8uvlRFV1sIudsxjJ Vc7g== X-Gm-Message-State: AAQBX9ft78wdz7SfgSTOiNJAUEma+mbsGLExasVsC6nYL6ODiKCsfTDm 1kaP9D71VqymsaSObj3fqcjyQZzz8f0= X-Google-Smtp-Source: AKy350ZLWc6OkYyhEAgKi+QBFBzZGsmT+IJkc0Q/GXXtRpvSXCQVykIPCe0taP5PrBoHwrlqYeadfzkeFv0= X-Received: from reijiw-west4.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:aa1]) (user=reijiw job=sendgmr) by 2002:a05:690c:2787:b0:54f:e2ca:3085 with SMTP id dz7-20020a05690c278700b0054fe2ca3085mr649642ywb.1.1681870739753; Tue, 18 Apr 2023 19:18:59 -0700 (PDT) Date: Tue, 18 Apr 2023 19:18:50 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.40.0.396.gfff15efe05-goog Message-ID: <20230419021852.2981107-1-reijiw@google.com> Subject: [PATCH v1 0/2] KVM: arm64: Fix bugs related to mp_state updates From: Reiji Watanabe To: Marc Zyngier , Oliver Upton , kvmarm@lists.linux.dev Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Zenghui Yu , Suzuki K Poulose , Paolo Bonzini , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , Will Deacon , Reiji Watanabe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_191904_483999_5578E167 X-CRM114-Status: GOOD ( 11.14 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series adds fixes that were missing in the patch [1]. The patch [1] added the mp_state_lock to serialize writes to kvm_vcpu_arch::{mp_state, reset_state}, and promoted all accessors of mp_state to {READ,WRITE}_ONCE() as readers do not acquire the mp_state_lock. Since the patch [1] didn't fix all the relevant code, fix the code that weren't addressed yet. This series is based on v6.3-rc7 with the series [2] applied. [1] https://lore.kernel.org/all/20230327164747.2466958-2-oliver.upton@linux.dev/ [2] https://lore.kernel.org/all/20230327164747.2466958-1-oliver.upton@linux.dev/ Reiji Watanabe (2): KVM: arm64: Acquire mp_state_lock in kvm_arch_vcpu_ioctl_vcpu_init() KVM: arm64: Have kvm_psci_vcpu_on() use WRITE_ONCE() to update mp_state arch/arm64/kvm/arm.c | 5 ++++- arch/arm64/kvm/psci.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)