Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp911621rwr; Wed, 19 Apr 2023 15:19:04 -0700 (PDT) X-Google-Smtp-Source: AKy350ZGooFoYB9u2YlA17wKOfiUEjjZtuE1MEL1NhcH3geiDj71OZvJQucJ9L//9gUL7fCnwQMB X-Received: by 2002:a17:902:c602:b0:1a6:d9de:1887 with SMTP id r2-20020a170902c60200b001a6d9de1887mr5732015plr.53.1681942744740; Wed, 19 Apr 2023 15:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681942744; cv=none; d=google.com; s=arc-20160816; b=fqo8u5cMhxSYsb+FL1ce8dbgvhGkkEGaD/C9HG2BTyT4StQj7JBaLZq9YQmMaMFKA0 ZMSRcapf/KfXrdUWWl5EW+h8nS1FRSukgTWw3jAzv/c/kVC91Si/7wFP1jcRcdGCEZFG aS2BkSdepumCC8bjQZOZSO9OfnUGaXcch977BPh+9S6ZQeJvF0NBp+AJDMs2YVsgNJ/3 eobUMDxqijhhPCYez4a69eEP9ZuPB7TLM3L6jqZWcG+201s73S3J217Gnwvk1CHC4oHt RchnBp5fNX1KB9iqFkBFHoasfuR/jVWEZlA9PPfx4CcaHWUd+C2qoshLexaCT8Adm547 C/NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QQ+Q1EB8U9VN9DkQE/7ZRwGYKH2CHxTB2A2ZNISqIdY=; b=rY4s5rDk/kH/EiVLIp4BcFjem70Vr/PfH4sxD+HYP5/5oG8Eo966kuaevR2cMeZinC V5eqUB+NmWfZEEe7dFjV7bqXPex2OkFLooKlG1Hh75COZAZLfgvSLhFwlR+x/kvkLSZX ES16yPTogonbhF7I7ClW/srrui1FOXCNneDPZ7y3LTE55mpEMpk41JsuCgshXu3NAlX+ T6dt4HfrHTFH85aEa425dkqgPHjiULcyyo7wUgerHeW10qx/5yoJdfcvFJL8fky29U3O K/AysT7BcmsZwRrQLF4UV7mOgEU9c/khjNnlKmAiNRViLOOA5u432xj/U8fyVGfd4PF0 lE+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=M7pMYKMh; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji5-20020a170903324500b001a5089fe47fsi16414252plb.326.2023.04.19.15.18.39; Wed, 19 Apr 2023 15:19:04 -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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=M7pMYKMh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231401AbjDSWRu (ORCPT + 99 others); Wed, 19 Apr 2023 18:17:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbjDSWRi (ORCPT ); Wed, 19 Apr 2023 18:17:38 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53A01BD1 for ; Wed, 19 Apr 2023 15:17:36 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1a6862e47b1so5504165ad.0 for ; Wed, 19 Apr 2023 15:17:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681942656; x=1684534656; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QQ+Q1EB8U9VN9DkQE/7ZRwGYKH2CHxTB2A2ZNISqIdY=; b=M7pMYKMh2fzPlQxiN+Er+1mRXb5xsvVBR/kCf0Xc6I4eRmeu17ZWxN3F+8Uh4bOfYt pLsryNkeitFt3/g2LwdIO4gRgf1eK0d0zd3qJJmJH0/Ytd9PXb2f4ZIv2vw9qF7rcmT+ +/5fNVmr7py0CepFxvid91vQee8LTDJ1trxwVh1r+SZa6D1ybCiNK5WtQpwcXBYzwzon 14Dk5NjS3zvhDHWUiYkgfDVG/0CawxYwCekaOcRjbz+KKATicit8f2wKNBE+FUv2M2pL VFRS7BwOkXZ7Z6aFPV2U5r0uWlcE+ptOAW8XtsMKVeJj+vK+/KtMoB1U0hUKE2I995ZX 1ZPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681942656; x=1684534656; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QQ+Q1EB8U9VN9DkQE/7ZRwGYKH2CHxTB2A2ZNISqIdY=; b=SrbpxkTmebTYTTH2YwqSCmlXL6TTPaAKAn+Dx6J5bQWFDoSWlxhkxsb2TA11kcfaPK qXlCy5+Y7A2hr4IPOCPHJytb81ggUHOL2BD/kHozo2Xkhb2w4YME5vcBkwbSoevxTp81 dz7unenj162LEUiQiYeo9r+dXrGIdAkLnCUsBvOgdNtKM91Lkerg9J/47Ln2wYTNBlEx X4YF4U5+1is/HmKMD/MX5vJDYJU3k745cQuorjO65eF1WEWHGy0jf2fIhRjsOBlowjy+ 7PmU9Sp+BVWRbFttr4TlvKOHF4DCqTvEG8IzvgbAbqwysyO//8Qqw58141Ej6BUddk1z dI3w== X-Gm-Message-State: AAQBX9eLpuNspPj3m7hBs7Ojqns/LySoWM9RoPDugZ0bHT0s2c/GjdTh VA8bLHBN2sDLE0W9GxB//3bzJ91xndiMgA9hu3w= X-Received: by 2002:a17:902:6bc1:b0:1a6:81fc:b585 with SMTP id m1-20020a1709026bc100b001a681fcb585mr6201339plt.41.1681942656169; Wed, 19 Apr 2023 15:17:36 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id jn11-20020a170903050b00b00196807b5189sm11619190plb.292.2023.04.19.15.17.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:17:35 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Alexandre Ghiti , Andrew Jones , Andrew Morton , Anup Patel , Atish Patra , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Suzuki K Poulose , Will Deacon , Marc Zyngier , Sean Christopherson , linux-coco@lists.linux.dev, Dylan Reid , abrestic@rivosinc.com, Samuel Ortiz , Christoph Hellwig , Conor Dooley , Greg Kroah-Hartman , Guo Ren , Heiko Stuebner , Jiri Slaby , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, Mayuresh Chitale , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Rajnesh Kanwal , Uladzislau Rezki Subject: [RFC 03/48] RISC-V: KVM: Invoke aia_update with preempt disabled/irq enabled Date: Wed, 19 Apr 2023 15:16:31 -0700 Message-Id: <20230419221716.3603068-4-atishp@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419221716.3603068-1-atishp@rivosinc.com> References: <20230419221716.3603068-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Some of the aia_update operations required to invoke IPIs that needs interrupts to be enabled. Currently, entire aia_update is being called from irqs disabled context while only preemption disable is necessary. Signed-off-by: Atish Patra --- arch/riscv/kvm/vcpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c index e65852d..c53bf98 100644 --- a/arch/riscv/kvm/vcpu.c +++ b/arch/riscv/kvm/vcpu.c @@ -1247,15 +1247,16 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) kvm_riscv_check_vcpu_requests(vcpu); - local_irq_disable(); - /* Update AIA HW state before entering guest */ + preempt_disable(); ret = kvm_riscv_vcpu_aia_update(vcpu); if (ret <= 0) { - local_irq_enable(); + preempt_enable(); continue; } + preempt_enable(); + local_irq_disable(); /* * Ensure we set mode to IN_GUEST_MODE after we disable * interrupts and before the final VCPU requests check. -- 2.25.1