Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8553548rwp; Wed, 19 Jul 2023 11:28:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlGG3NEbwJh29GXazUt9H1o9ePCdr/R2sv0uVRqZhfm6yAmu5GQ56Z7jL7FiAzoxe8gtRZXH X-Received: by 2002:a17:907:2beb:b0:991:d05c:f065 with SMTP id gv43-20020a1709072beb00b00991d05cf065mr2883090ejc.52.1689791304215; Wed, 19 Jul 2023 11:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689791304; cv=none; d=google.com; s=arc-20160816; b=gnhUeLQ20f3gj2FBav5msQsLvyvkGssnkE+hdm0mzWwniHB8klE8QEC3bc/l29Xddk og4sK28+iL/rdtykWkR0eRIf3B027N4PMHTcYpclpX+IWSIFVlMdUOrjbVWrEU8FG6Mx Lsl/StOn9tZqpR1s+3FPG/wFyRU0ivzwiZYz+3XkPJSmt1PPSpIn2FfDVHuWrdv2M5sq BhHHgjJJvJ2OORkBzjAirz6jcaqhsrws3O1blXCUOXvxRzy/aUE9w4d/5lhU5ffZHnxx N4l7bT6he+xgDwvVUs1CPg2KdXjpyGfsZbLieCW8m31oMrsqkfmQfzP/u+4/66xwSIEH zc8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=0kxZ4Z80lUcSFdp3GgQl/jQwBGNAtEogOtDD6DT+le8=; fh=KTEx20bofIfHC4U0b3O5hp+kIf4hzWzzEbPhxCIwTfM=; b=SORSbXWJiQZooJp1GebpT9Y65VPVJhIdvpeY3s26N6+aD2YNQ5ddJbeGVVjWJvjxyE GQpnsXY3kKFggw5sFWGlNb1BqJhvfmoiUA8imQDm8Q8RLgZ2KvBw0NbeVaDS17SrnhV7 Cw2DtithFdLIb8cW/5GQKMkv267cXTjnv33LAn6Ff99RoD74Z5IFwVoVahVp0xK894vC Yg07s+7qFt7lcdOZ5fQfHD6ZSAU9M5Qw9HtJXoLv6OLPsfs1oLuNjMi0N6KTGknGKwsa PAfCOP62OgytSjHtGoPdlsLqarAtAm4rpnw1XKePJdQi1uiYIsk4o4wfY0aebvuZK+ki pAqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=NdNKIYqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n26-20020a1709065e1a00b00992e2881836si3077651eju.819.2023.07.19.11.27.59; Wed, 19 Jul 2023 11:28:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=NdNKIYqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbjGSRyG (ORCPT + 99 others); Wed, 19 Jul 2023 13:54:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjGSRyG (ORCPT ); Wed, 19 Jul 2023 13:54:06 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 262D31BF5 for ; Wed, 19 Jul 2023 10:54:05 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-57320c10635so64386997b3.3 for ; Wed, 19 Jul 2023 10:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689789244; x=1690394044; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=0kxZ4Z80lUcSFdp3GgQl/jQwBGNAtEogOtDD6DT+le8=; b=NdNKIYqEldjUUQV4h+XNM1ILmBpma9z9AEdBtYn1qcrFOenwJmBXrHw6mTbkprQj8p r+YtkbikqlLfJdQZIoTiQv/TZpBxRXEg0gSoK35Ky48bcLRFCn0Qj0DsnXRublL7LccU VbZhu6d+zj+n5OuXYLNNjo3SaPP6NC8/yNGWRhVbEHVJlHuLX5Gsll/rQ8aLyHWCbZUs /8pD6jrn0k0jGKj8o91kas/Vof7SZ7T7M6Y8JVFS9L6EnZODlq5wuOfEPi4IxaVWx6IY g0cXiBg3AzBUjksD04dElZ9FVrB9vd1h8Wu2ap7UEulstmwA86OoTJopktyhvQXeMD9s GkBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689789244; x=1690394044; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0kxZ4Z80lUcSFdp3GgQl/jQwBGNAtEogOtDD6DT+le8=; b=Xlmh/uwJH77jtnimbqevTjS9AkvqsH9ZKjV5myYFRtQQzpdsTlLKsBnIJS+HKtnE7o +cKyL8WD1rQfOlSMsmZm+PYcvkae0rzlnDBvfXVxbkYz9zjX8hC5N+k+uUX/RD709bhY BZjB2cQawaS93nFBobwkqLbqZzn1e9TTbj8ZyhpbRnVZBPjURsMojXv0h4Qy9pa7zc2t /oCube6sRdJjEIpTEtqWOUCCpnqDuyLQuWV+3OYyfE/jkDTZF+xyzODMDnNVNNcaXIcy 3eXg3l4QQ0yGKZKZe3i1kX75uzCdjt0zLDMoNtypoE4esCio7ES3F7LyFzGVhwsWBfIy WFEg== X-Gm-Message-State: ABy/qLYi439rMQGpqVcuVLPyDsNNdtta74PC60uVZpVqQwOEebvCLJnR LmOc/yqOS+ofvzQvqoSJMXmhQUlOYvKk X-Received: from rananta-linux.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:22b5]) (user=rananta job=sendgmr) by 2002:a81:d00a:0:b0:56d:502:9eb0 with SMTP id v10-20020a81d00a000000b0056d05029eb0mr34446ywi.6.1689789244409; Wed, 19 Jul 2023 10:54:04 -0700 (PDT) Date: Wed, 19 Jul 2023 17:54:00 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Message-ID: <20230719175400.647154-1-rananta@google.com> Subject: [PATCH] KVM: arm64: Fix CPUHP logic for protected KVM From: Raghavendra Rao Ananta To: Oliver Upton , Marc Zyngier Cc: James Morse , Suzuki K Poulose , Will Deacon , Fuad Tabba , Jing Zhang , Colton Lewis , Reiji Watanabe , Raghavendra Rao Anata , kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For protected kvm, the CPU hotplug 'down' logic currently brings down the timer and vGIC, essentially disabling interrupts. However, because of how the 'kvm_arm_hardware_enabled' flag is designed, it never re-enables them back on the CPU hotplug 'up' path. Hence, clean up the logic to maintain the CPU hotplug up/down symmetry. Fixes: 466d27e48d7c ("KVM: arm64: Simplify the CPUHP logic") Reported-by: Oliver Upton Suggested-by: Oliver Upton Signed-off-by: Raghavendra Rao Ananta --- arch/arm64/kvm/arm.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index c2c14059f6a8..010ebfa69650 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1867,14 +1867,10 @@ static void _kvm_arch_hardware_enable(void *discard) int kvm_arch_hardware_enable(void) { - int was_enabled = __this_cpu_read(kvm_arm_hardware_enabled); - _kvm_arch_hardware_enable(NULL); - if (!was_enabled) { - kvm_vgic_cpu_up(); - kvm_timer_cpu_up(); - } + kvm_vgic_cpu_up(); + kvm_timer_cpu_up(); return 0; } @@ -1889,10 +1885,8 @@ static void _kvm_arch_hardware_disable(void *discard) void kvm_arch_hardware_disable(void) { - if (__this_cpu_read(kvm_arm_hardware_enabled)) { - kvm_timer_cpu_down(); - kvm_vgic_cpu_down(); - } + kvm_timer_cpu_down(); + kvm_vgic_cpu_down(); if (!is_protected_kvm_enabled()) _kvm_arch_hardware_disable(NULL); -- 2.41.0.487.g6d72f3e995-goog