From patchwork Wed Aug 24 06:03:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 12952950 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 358C5C32792 for ; Wed, 24 Aug 2022 06:04:38 +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: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GpBKsPRMOqgx//h+GRoI049FfGP1dTfVtplmqawX9H8=; b=hZGurzDblgVA3C E4kawYGSXjSUBMIXRGJzpAVZ155cIPa0owky5DWe7Z2tva2AXj14Ntm2NpPqqM5OZfw2S3ZTYXlz9 8D6Gxktj2gfLTQMltybVRfl9JMqU113HeugQW8ng66iMxiF6vziO42RLwSeuqDWT/PutCiBFIWnEV 7nTGEHoMdpzTDgjiDmbSV4/BsgdPXLRP2qjk/vdomiizqs2ama3CDCqrOx16wF35feSoYjo9jbzFG Jb1K1pcFeTcRSIG2khEn/7VISxo427bQJXm7z6TtTj2uz1s1pfrlLLzCCGwhpn0J6NUNtRQwB5KFO 7vn2mzYR9PXexK1BmHDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQjUG-00AmcQ-Vx; Wed, 24 Aug 2022 06:03:37 +0000 Received: from mail-bn7nam10on2125.outbound.protection.outlook.com ([40.107.92.125] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQjU6-00AmXo-8C for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2022 06:03:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oLpNID4YkxvTB3t9/CIX8S/4tbMYgq6mJ7SpH9u36BTYGW8coI4BeVHGWTroiDiiW0TypQ0ImYobTM2yhap/ODOwqTM9/iq1ART3pwzGjrMhX71H/21Tu59g/AchcysCbI5upthrtARby8grZahovcoQzkP6PiRF4gqZsvp34BivX/QclTCLekT65nzue7uh5QmVr2mReIlTZutaayaoFeCkQYHX06lMi0dhRtaFKpHwnztuVLQqDnHXg2+CfiC5uacr26vTa2KJpppUQsrKlbP/E1JIKCP1RXCfqecWteI8flzoVIo7ZqgLhSxOmOKPsRSS9mugFql+vZLjvzvfMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VrFHdmlh/0Ys+L38kDhMFewTignwonVRVzXZQinc6Rg=; b=XPOJhwLdDJnhA9nFHAiesFBHjmKON1stEt6VtPESWbpAEUTznDkqc6YBMeuVPv3WdQeoJ5dgdgU3C2Yyt87rTtFHPq/MwwtPT6jWZRSXP20XlxMIn0cOZ/OzI2r0pKU/Y9ezmsTR6i2h16Z3IdZ3kpMsua1jhgtnPrrqpUlEhDyXBrpvjS7EdeynjZYqbuO4eUwKcJ8+xWX7lmZC6zGsBipyX8oPMezjL4GqWV/AJT5Re6beab5x3PR0oT+OqO8409W5qrrYDQ6ocZQyo9S/YFxSCfXjwq8lifkW0IN/PI1/1cIpkoKVOvmp/iDbv+b3TlbU+djGFUTtGw6xUMMliQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VrFHdmlh/0Ys+L38kDhMFewTignwonVRVzXZQinc6Rg=; b=fbsAANdJiVj85myP5T65tS2S9emBxgXQUOBi1c4I35TX+TQsTrcx2sOxCGGZsWfSQ6PXJC5NqScqTuL12t0VDdk0j2R/7Wq9jbZbGjn6v+IXkRFzjHEDA5fVIoUg0Rg3NHLkxOmrZI1MviVeFnyksEyX7Abj93IEUUzGBOLrJO4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) by DM6PR01MB5914.prod.exchangelabs.com (2603:10b6:5:14f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.21; Wed, 24 Aug 2022 06:03:19 +0000 Received: from DM8PR01MB6824.prod.exchangelabs.com ([fe80::7058:9dd4:aa01:614a]) by DM8PR01MB6824.prod.exchangelabs.com ([fe80::7058:9dd4:aa01:614a%4]) with mapi id 15.20.5546.022; Wed, 24 Aug 2022 06:03:19 +0000 From: Ganapatrao Kulkarni To: maz@kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, scott@os.amperecomputing.com, gankulkarni@os.amperecomputing.com, keyur@os.amperecomputing.com Subject: [PATCH 1/3] KVM: arm64: nv: only emulate timers that have not yet fired Date: Tue, 23 Aug 2022 23:03:02 -0700 Message-Id: <20220824060304.21128-2-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> References: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> X-ClientProxiedBy: CH0P220CA0030.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::28) To DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9eca2283-afac-4ca0-fff6-08da859657bf X-MS-TrafficTypeDiagnostic: DM6PR01MB5914:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x4PpEvLFvN5FTEPCYCQiGlqPYu/7VxYZH3svGLkLcGTQ9SrYSMWnZkXK5eW2U3Q9eIYY3dm8wYhdLgJrxtVmuD+eUpplPJHtvO8EUgf7A7ta9GQ9M7LWtA2Eddy/Ua7/IgFv58R/CVT34Xr0arO5lxS1bQpbX8d29rL76Fe8qqLmiqQfYXyE6+2xMryJsccWFGs21Y8PTwpTrHloCaOtEqdCUideVkDArgDFWhstWrLV4+D8ezCkAFlbvUj/5KgB6PDmEPkDbcWZrhQJeASaRGdiFqkjarqVDNzT9VsS7Q/kZhHkgyRRQvT1ABqppnXCZQ1E10LE7kjooPW6dRCgEgX7kr7l4TTlwyOX9iD/TnqTRCySrYJQv/w1F2fpzmxh+hXDJ4BCP/5n5/j3Dw52FZv5oAOYE3kawN9jnMd780liJIAJ8cbHpVwUkQFF0VC7USv6AnbNZiupWYQYZoNh3kgP2LohIZdn4kLWXIfuUej8xr+QNubcWrtrA+lmfl2gaQ2shKjEwIopvzVRLTeBF6hlu0t5bX7oryX2sBc2JiYose2TRm6x6nk6DOcobOMvX2IDL5FUbObgOT1AGI0K1rj9XW3UW+xC5AvePyd99GRV5nhRDIIXkWoXG3WtM7uQImkT33tm6UcyeE23kEsxu32O1hWOy+NnKzvxbha6sbeQPywfR4sMyxf8Jfx1y7j4WF2khGPPS1Ddnz9YQzexOnNqZImDKYt/0m8hCwlmB/+D1ip+r8Y5nz3NLi6PzEX1jLLKLH6nk0rnWajem/5Vdg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM8PR01MB6824.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(39850400004)(396003)(376002)(136003)(346002)(86362001)(38100700002)(38350700002)(6916009)(316002)(2906002)(8676002)(4326008)(66946007)(66556008)(8936002)(66476007)(5660300002)(2616005)(1076003)(41300700001)(478600001)(6512007)(186003)(26005)(107886003)(6666004)(52116002)(6506007)(6486002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O/ya8Pz/VwmzUfcz7EyiwSYqj0pjjlgM3eyX7hDMEJ8uLUa3JXwSOM4nRaz4gpOOK+NC8+h38mq/h3xKrSETnJYUB6WqVbdtr1GnvNVuHGkht2NyBkJe6929HNqs9pk8Cvt3FhLvNi++UsRZBinTpTA5QSEKgHa6LUPRkvvu12KKDg2dTwvAl/pbUibOMjVx/6ETRha53sCCb/NoD86ftOBUu8nekLmQgLljwlDzjHvK/klVhBaErSL3mB0dM7BL4r15EviEvv/f3HPqTyg+n4GJJ1wgc44XSU0sDTTWzm3WZWILysXs+O8phCQfP/IX3r2/4DfGLdE3Ql05fbncJ+CbrTvjJeAw3YPVfWbvnx3PiPrPTXoB/W/GDwSa0srBIbia2TkYmykBoBPqfkY98Y2VPMQp9VJLTU2ILM4Hq5jFIPmWqiYHwNg3o0nRUxDChz1VozfNglmgPiVFekDyXRl008mZ2z9snS5r6J6nT8PWGaT8BZ2Whk2vmuVaB4McTaXqrwE0Hq+Vu5i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KbdyyQ2vzIDEMvL9BxN6MtuVgPkF+nBzU8n7vSiYn5JwY= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9eca2283-afac-4ca0-fff6-08da859657bf X-MS-Exchange-CrossTenant-AuthSource: DM8PR01MB6824.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 06:03:19.2323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VeH9axaXcvJ3XdIjzehy6d9bjNezPSHzGr4kSUoqReWWjT+DYFSBbBtRBlhLKpvYoujtyLZkHzzThrD7tW2fUbzvI8OBHhCXVzo0kQ8RRJHLN9+uiXOlU0TaeGpfFzQP X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5914 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_230326_317225_C17769A8 X-CRM114-Status: GOOD ( 11.45 ) 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 From: D Scott Phillips The timer emulation logic goes into an infinite loop when the NestedVM(L2) timer is being emulated. While the CPU is executing in L1 context, the L2 timers are emulated using host hrtimer. When the delta of cval and current time reaches zero, the vtimer interrupt is fired/forwarded to L2, however the emulation function in Host-Hypervisor(L0) is still restarting the hrtimer with an expiry time set to now, triggering hrtimer to fire immediately and resulting in a continuous trigger of hrtimer and endless looping in the timer emulation. Adding a fix to avoid restarting of the hrtimer if the interrupt is already fired. Signed-off-by: D Scott Phillips Signed-off-by: Ganapatrao Kulkarni --- arch/arm64/kvm/arch_timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c index 2371796b1ab5..27a6ec46803a 100644 --- a/arch/arm64/kvm/arch_timer.c +++ b/arch/arm64/kvm/arch_timer.c @@ -472,7 +472,8 @@ static void timer_emulate(struct arch_timer_context *ctx) return; } - soft_timer_start(&ctx->hrtimer, kvm_timer_compute_delta(ctx)); + if (!ctx->irq.level) + soft_timer_start(&ctx->hrtimer, kvm_timer_compute_delta(ctx)); } static void timer_save_state(struct arch_timer_context *ctx) From patchwork Wed Aug 24 06:03:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 12952952 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 156BCC00140 for ; Wed, 24 Aug 2022 06:04:53 +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: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u7FrQEq+hEx/dLg5DYXVSHL1y7v2aRNVlRkZFY9mY1U=; b=mFhm6FlR+vAanD aX2uET0scLfovoX4kyO8U9EMKHQYakB6s5sbrj/7EGJEAx8awQ+nUYQYbwsgwxKHqEdDieIXi92jA gyZluI7lfi2PbTRyyVR9cLshnB71WrOIDlbQM8KR/whF772HFLL0oOqF1URQ4CRMFYwCwjzCaXh8t ka4u732bti0iyysppNU0KbT71SfhOw93gVHIEB6YM83YygZozu4U5wkIhrQJFF1ArQQ/ReqO4bKRY hNWU8t6WJsxebQUy9TDAb3KwjeAYpP94ilPQhfE8zMRhgfqAwEEmMQURvwV1TqQH/BNqDYjpRp6q7 xv/NjBBWRvmCsdggAHzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQjUQ-00Amfo-7o; Wed, 24 Aug 2022 06:03:46 +0000 Received: from mail-bn7nam10on2125.outbound.protection.outlook.com ([40.107.92.125] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQjU7-00AmXo-Mz for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2022 06:03:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NE+txOlWRiAJJVAuhs14BLwzD8afWx5IY6dgXnBo2qGoFOZoXguHvgPHIqlANj4kuqRJcg1xl2N9sC8R9wuzqpjbdj7NF6rvll9MVosP0M1S2Xh8TpNKZbLcIZ/5uNLlFwmmiIbTAy3kTNQCDpfJzA+vomfpe5HOd2+X0oe4NHCyMAeQLBdIhe7maOldpzS6Pq+Y5iIdYsRrq41RQCKbpiXi52T2mnb+aq4jHqz/YMcwi3OxivJudwZ5wAVepvQh95KeR4yNXq7LLDSEZzq6FkYLK7WMFLPIEUAU32ZP3AtWMdVGwVIRwjruoY9WVGq+vDWLyGBDRpdps5BtvZ+eCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4GI+nLH2hYI1BE5BBfDK5c8OIdM2maIvQks9FeJHJNs=; b=PBSGC6Lkg3mE3Rxs4THHKOYtADLRIxSEzej+Ja/rmU0MHHKcLuJwijHBU782j0bLOFpCOapqxr2+4YqW2jgb4Lgbpyd8REoqXgO3Q2dg+ck0jdiGjTBvBBxgU9R6ddnmG9JAGKPXWD/RPE9TuzSEDn4Uh5gYW2puYDsX4/rQIj20qv+qSlFk9v8I5j+R1F4HpchMOH6qdgHwHqE2PEVB+PXD7gAX4U/irPMzIfOdanMy6terEbc++HI7O6S7U23orPetYZnM9Ce4WZzeqAqD+1NYIEeUIGfZ2YS/fXfXXK2erMFlzwGtSzFOx2O0cTAizGHvMLxUF/FGxTlpDXdj8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4GI+nLH2hYI1BE5BBfDK5c8OIdM2maIvQks9FeJHJNs=; b=uEIh4yDOHFaMFA1HN/ZfbPUTpx3lhWJh1YdLdwLGYXujXDEYYdYUeZXu7GiBf4yduU0ukl/TugaAPTs94zsSHRkfwWIvZwfFnepeuyyUrzH66T3eVTgLZ3lB4WuVCyn9eJw3rvLAcRjLvVRBxmq23tjgJVEsGJaeWMi+4XeAju0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) by DM6PR01MB5914.prod.exchangelabs.com (2603:10b6:5:14f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.21; Wed, 24 Aug 2022 06:03:20 +0000 Received: from DM8PR01MB6824.prod.exchangelabs.com ([fe80::7058:9dd4:aa01:614a]) by DM8PR01MB6824.prod.exchangelabs.com ([fe80::7058:9dd4:aa01:614a%4]) with mapi id 15.20.5546.022; Wed, 24 Aug 2022 06:03:20 +0000 From: Ganapatrao Kulkarni To: maz@kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, scott@os.amperecomputing.com, gankulkarni@os.amperecomputing.com, keyur@os.amperecomputing.com Subject: [PATCH 2/3] KVM: arm64: nv: Emulate ISTATUS when emulated timers are fired. Date: Tue, 23 Aug 2022 23:03:03 -0700 Message-Id: <20220824060304.21128-3-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> References: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> X-ClientProxiedBy: CH0P220CA0030.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::28) To DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73cc6139-db46-4d8f-a1e4-08da8596586b X-MS-TrafficTypeDiagnostic: DM6PR01MB5914:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A3dm44bmCamI+RtBiPrPO9fmKmSuMqoeaJ6zYXRoRFS/HPfXKQV0RYe91lPwLpEWkrjf6jFK/5Vsfpdj6ffeeMe5DeA85X9v11stdwiJ1IwqJKwkkHshXUMG8oddau36L/PwG9F+ZKwNdQ/ijPj8ctTUpkFNTvGzSYCjQegLnyWZTdLVQOM38gJXcK90+PPjrjrs5B7oKumgh1W9nxrVi/Bwa3Lmc+qzHeV3mThHhJ3gjJMjYYP39VV8YYi2A5JEQlsUVSg2I9rlCbeoH0OuSyWPJO6Ong2vxQd/f99uIkuWRtsKMPN8NlOrhyNlxl51v9jRUfna2EqYyCZjHYa+R3OMKPq5N0ZD5xwL8veU5Eu0WFg/aZwa0CiAClnPW3zFyG8yHnDu5ukklMalBmvG/UYHYbfE8MFsnTVPIntj3XJAm9r2NKiG8W+u5vQEX3mUDwlm2rToFliPNZGq6xEq6nMH0olIvo9SQg0drvYjbdj2L2BoKEAvy2V94bT6z+xOtYLSwLw1cXyaw2zdA+cTfl65cU3hi/NI+Jmi6rJEoZRgR4p0FOmIMC/cWiPh1+M2xEIt+VroMy+2z+r87RO5uu5kTlIOoPEK8KyJsOwFKPIM66o4wN29+msgq0ic+MXEb85Hvzg5gL1O0kFiRWcdFS5/sKnwGzvdvmi/4BLwfVXwWXbodKADCC/N0JTNpQ8flmt1oGewEMi44gmjeR7Qqe0PQlbcMhYpRZ97XebBQ6EIreaSBEH/9EJYvLp80+dAh7kXbPsgN74aKrUIGlgZcw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM8PR01MB6824.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(39850400004)(396003)(376002)(136003)(346002)(86362001)(38100700002)(38350700002)(6916009)(316002)(2906002)(8676002)(4326008)(66946007)(66556008)(8936002)(66476007)(5660300002)(2616005)(1076003)(41300700001)(478600001)(6512007)(186003)(26005)(107886003)(6666004)(52116002)(6506007)(6486002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6/rRiYdTavkf6rMwDC3ZJM5VEqdQx5whyokx+Blv/v333ue1f742GXgF9N/yLRKBxuHMxBT1IJmDWH2isJezzuD5lc3hrIuYrleyHZhPIKHU5Rkoyd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sdPBToT+a7/h3YHuuPUyK/9bj9Zdc/a1M/YTdmPeQA+w9UCkghGjVakQ/dgOITRkSeVWLC3tv83kgKhEivSYsdAskJY97xcFl+OZ21ZzHWCD2BE8s6l1lO++eKcl7XFxvgPuJdSXXGoHAgBtBRK/6q8v4IAgodUYPLJyFnBkRhmqUfnZjnPrGg4nwl2zxdcO7z5j0kQI1dVFO4u5d9B8mJwPI6XZ1jBMLfWO+UQDK/adws5XfFhFuBozf20idX6/m6pY/bEzXZTqmVLWY/HjWDhBBvF1b5cYsucOFu6OPcK96w6VH+Zf5ge3w0eFDZ0/88xRySFP1/4AcNlzgFG7s999+8JSAxRnu3jKef+rvLJbs/eDUFFifnVlil0K9v/Er4RpU5qBOvXCfH5bYiH+QZXeht57qpcEzTDkgO4FXQCNmM3X/v33U4y5w6ZwUGPz7wMqhZK+aUc= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73cc6139-db46-4d8f-a1e4-08da8596586b X-MS-Exchange-CrossTenant-AuthSource: DM8PR01MB6824.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 06:03:20.2477 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8ZQVqfrz5C4Jrj6uvRV+wx7jzNbTYD+49kCahV3yG19jebTsUR4pGMieuw1WZ3Cr4X6ozYlOOhAGJFGPgsvXI2u349tkccXgK3JHdYicWmM0X+ZH+2WYLE/N0dnIxe9H X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5914 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_230327_818103_7974EBBE X-CRM114-Status: GOOD ( 10.95 ) 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 Guest-Hypervisor forwards the timer interrupt to Guest-Guest, if it is enabled, unmasked and ISTATUS bit of register CNTV_CTL_EL0 is set for a loaded timer. For NV2 implementation, the Host-Hypervisor is not emulating the ISTATUS bit while forwarding the Emulated Vtimer Interrupt to Guest-Hypervisor. This results in the drop of interrupt from Guest-Hypervisor, where as Host Hypervisor marked it as an active interrupt and expecting Guest-Guest to consume and acknowledge. Due to this, some of the Guest-Guest vCPUs are stuck in Idle thread and rcu soft lockups are seen. This issue is not seen with NV1 case since the register CNTV_CTL_EL0 read trap handler is emulating the ISTATUS bit. Adding code to set/emulate the ISTATUS when the emulated timers are fired. Signed-off-by: Ganapatrao Kulkarni --- arch/arm64/kvm/arch_timer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kvm/arch_timer.c b/arch/arm64/kvm/arch_timer.c index 27a6ec46803a..0b32d943d2d5 100644 --- a/arch/arm64/kvm/arch_timer.c +++ b/arch/arm64/kvm/arch_timer.c @@ -63,6 +63,7 @@ static u64 kvm_arm_timer_read(struct kvm_vcpu *vcpu, struct arch_timer_context *timer, enum kvm_arch_timer_regs treg); static bool kvm_arch_timer_get_input_level(int vintid); +static u64 read_timer_ctl(struct arch_timer_context *timer); static struct irq_ops arch_timer_irq_ops = { .get_input_level = kvm_arch_timer_get_input_level, @@ -356,6 +357,8 @@ static enum hrtimer_restart kvm_hrtimer_expire(struct hrtimer *hrt) return HRTIMER_RESTART; } + /* Timer emulated, emulate ISTATUS also */ + timer_set_ctl(ctx, read_timer_ctl(ctx)); kvm_timer_update_irq(vcpu, true, ctx); return HRTIMER_NORESTART; } @@ -458,6 +461,8 @@ static void timer_emulate(struct arch_timer_context *ctx) trace_kvm_timer_emulate(ctx, should_fire); if (should_fire != ctx->irq.level) { + /* Timer emulated, emulate ISTATUS also */ + timer_set_ctl(ctx, read_timer_ctl(ctx)); kvm_timer_update_irq(ctx->vcpu, should_fire, ctx); return; } From patchwork Wed Aug 24 06:03:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ganapatrao Kulkarni X-Patchwork-Id: 12952953 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 9B15AC00140 for ; Wed, 24 Aug 2022 06:05:02 +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: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lPc9hBDFYnmiAFk4M8RBqdUbEZWI57da72lMlmk9QyE=; b=BDPtskcZ7exRBZ 107i7u+oslCcK/NXjRu2h1WGHGr9li5/+xmaBIlmE/SQ9l05isOXYTuFYrSgUHvu9fGADmyh7YbUg Z1fTjXCtmO//72vAfRAMD/brwFDeAiP9bb7KB8Fx44bR8WNKXWPpKAABD5ih/Ud5R2hu4MBwQoAXK 5pQ4/OZPf7QqikQ0xTaKKvBHcJLPnFHjaqjU5zbFkhyRmftnDyHDepm4DZcoZCgX29tTHFnR9hGXG Wn7QBaEYGPJ7IFRNg1bY4ynZkf1OMGkc+AQ8YQFFVQ5fn8XGswlMSbvw2UfEb7DKAbdQnLz814jGM 6eERnuANhccpB/H2KMbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQjUa-00Amii-50; Wed, 24 Aug 2022 06:03:56 +0000 Received: from mail-bn7nam10on2125.outbound.protection.outlook.com ([40.107.92.125] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQjU9-00AmXo-BI for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2022 06:03:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WGln9/1HLdh9uEIyJLUUiNmtoVxiluhWXep8oGnfy67jOQgvGqB801OEPYeMtmaTN54nWhoZ1Ro9VBb+Qb+LY3PRQ/uwg1e4LjuYkNVyIOrw2IAeTGJSvVItSdX32pmN5j19fJSHcWoieOEiyZd2BZeXKwsE7ZprjeTq9ErxWLqgWCtjjpT3egc4Hql3KhZNi717C5XXsiwzp3/OL1R7G9wusM/jDN/PuEVmmANt9amP3io+VrRvRhKafvS1UYJMRQPq/Bwd8kH3f9ga3pJkVn+u2LJWpFhQMTbjiQrFiwcQESkOZZvD4OTgC5CT1QEPbKG5+ej8NQlGSslBRBn/7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hMNZhh3Q+Q0iINSFvyTaXjao3sluRWLjEuNBAJmNGF8=; b=mqpf562uEujZ49T1lQN82f9lydOR8ZVuf7kSyYMt1K3aACF4wfZqwkOak8hmKB6iTNJ9bjTd9QWviLlFeANGerE8Min1V3hXxDCn24RuWwQ6soHzamkOqmsDTLGPgUNh2NPS/GGZw6kqurQ6DwRVIan8XYS/jcLo4zPVqAjTGGbGMR/DtG4dNwdNBkMXK7lhAC0z7qsHXAMAcPSbd3aK4cwJdGlDPSB2gQbCgR22ngWoq3oKUYe3CpX+3Q9r9MCF1GP6AeAooqxp8m+TSkOLZBIGv7MwQTt6Ka6SG2WHYMDo0TQD22BJL5MfS6kG5Yifcrjda+V5DFZApCfMWeyxRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hMNZhh3Q+Q0iINSFvyTaXjao3sluRWLjEuNBAJmNGF8=; b=SwWpCuZQ/pctoRy56Pez600kX6AHkJud5rnRVMzjt1KQkjBRCLsB+HQYo00FPDYgcxn5juL76rWl7TVcZh6upWZRMq7v+mRKjUxyu917xzLkwqR/qhthI2XtWjUy9qssOCSzM1HklUQzen4YroLOBnqjTlRYaND1Zb1DqS8/Bzg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) by DM6PR01MB5914.prod.exchangelabs.com (2603:10b6:5:14f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.21; Wed, 24 Aug 2022 06:03:21 +0000 Received: from DM8PR01MB6824.prod.exchangelabs.com ([fe80::7058:9dd4:aa01:614a]) by DM8PR01MB6824.prod.exchangelabs.com ([fe80::7058:9dd4:aa01:614a%4]) with mapi id 15.20.5546.022; Wed, 24 Aug 2022 06:03:21 +0000 From: Ganapatrao Kulkarni To: maz@kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, scott@os.amperecomputing.com, gankulkarni@os.amperecomputing.com, keyur@os.amperecomputing.com Subject: [PATCH 3/3] KVM: arm64: nv: Avoid block mapping if max_map_size is smaller than block size. Date: Tue, 23 Aug 2022 23:03:04 -0700 Message-Id: <20220824060304.21128-4-gankulkarni@os.amperecomputing.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> References: <20220824060304.21128-1-gankulkarni@os.amperecomputing.com> X-ClientProxiedBy: CH0P220CA0030.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::28) To DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dbd58d47-72c3-40da-9b9f-08da85965930 X-MS-TrafficTypeDiagnostic: DM6PR01MB5914:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 67r2G2I86q1d6W+od5N1MJSw7uNSyD0kfrKxU81lC9HCVj/W7oJ87d4BeAcuWXD/lEcpVp9NpUdNHx/tXswpG6S9WgBHYp0DixIT2/ornRqPP2Z7cmH31J+TJg25TaKeNoNJ1QLb+HUAnNCFOmafNkBulta2x5JehEM+hv4MUMQIFG1L00Bexi6MU/GN34331kCD4tL0TK2Plt6SxwKriTk0qUhhLfqvpjTr5pPrWTgXLCfH7RjjfOoqs/8ysUavGZ80Bzgx9dcG1El2K4I3CQ6fK5BRqLcFLX5kQDA6c2n+3GqvJtKZzDjIoALC20lNnS9KRjP11XpAIUqO7feObqyHMm593pWu+A1IfYBryflGOnLLyZ2pGCrX7NCjwHPjYwkEVIbbcMLfaGXEllTaenqP2PknxHXnymtbp+tdJVjHy9l6/YsF3eK6ZQvnNjIERM6LKS0SD2h1w9UXsXRRcJreWgDITH/auL2aDxx8AgspUhTM1P8UtaA5M6KtJV+e37iSC3ajhOTeX4PDxfLtom8739FCxFtRFz6qfFgeVWnKUt9EY3QBzZjobFAAVIIBGLC7CqHl+yBpLB3HtxDPgRyoCpqjREhTu7NIcQG6nabuOfPAfi0qzCu1FTR6pZYe2AVzYwdkK9JtlAHHBHCGm4NiPybNoFepbD1FVsTQ8ZOnumxjBeLPDdWT1jKrMkNAzYgltUJxsTskDbTJinLAQwbMoIP460fdlSFGyvNnmTG0Lw6rPPGws3witbKaovYKNwi8x1d/Fq/fnxCh4laCuA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM8PR01MB6824.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(39850400004)(396003)(376002)(136003)(346002)(86362001)(38100700002)(38350700002)(6916009)(316002)(2906002)(8676002)(4326008)(66946007)(66556008)(8936002)(66476007)(5660300002)(2616005)(1076003)(41300700001)(478600001)(6512007)(186003)(26005)(107886003)(6666004)(52116002)(6506007)(6486002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JFXaUH0xGB98h60Qgs24NDf871Q6jUUiRgKLYBBoaeF5SoDVShjhcC6J7RqEJDcm8Ci8jPF2q2fY7jbDdUPfrrlrfSkBcXC2D6EozfCIzMbpW+mA/A8GqeVttKfgR29OEAjsUhyf5djm7gZe7FUzSXl9HvVDJ06LQXZCu4qmxKiKViCm+N75DzQ5HJOheGhU4bu151ljq1wLZIX4d4P6Dy8UjIu7dwaqHgJ0M7tOa8zevkB3kw4nSlj7Iob/J6qbVgKcUDdqjvOAKPWxJBIL/Fy3kZ/NJJn1MwtXEGE7huWryrV14H/sTdUOyS7sY039kYb8bJA0waf4Vr5CDTPBeez4rdmY6F97v8bkzJOoIx48/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4Ur9twnr2QDRpqoMd+INVCPXSJdGyukmBabsfaLSeg5WVloeAGKFEYkXjDF0iYXSJp8hN0NsfEZW49pJJ6wmO1/LPs900DtHFywEwQJBvqPwUQn649gPmfeTYIhZNtkTVU2B8ViEk7GBmU8Av/CJZeCPnLSGkQQM77Gaxruzj7vr2Lg7Kz7JY3q5SfJ7YA+ye9rsPt3S3yeOpcfF/XE= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbd58d47-72c3-40da-9b9f-08da85965930 X-MS-Exchange-CrossTenant-AuthSource: DM8PR01MB6824.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 06:03:21.5386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: riBuPikBVx9Qkrpes0FCPxANvte0s90Li4F4F0dO8r4hKKsiLwig+jfo4oIcIaQKs4Fs7RaV5ouadys83ly7UtSnOTCtfShfxVKcFvy9U1boOdjBurh85KlDDf/HR/P2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB5914 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220823_230329_431964_A9D47994 X-CRM114-Status: GOOD ( 10.71 ) 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 In NV case, Shadow stage 2 page table is created using host hypervisor page table configuration like page size, block size etc. Also, the shadow stage 2 table uses block level mapping if the Guest Hypervisor IPA is backed by the THP pages. However, this is resulting in illegal mapping of NestedVM IPA to Host Hypervisor PA, when Guest Hypervisor and Host hypervisor are configured with different pagesize. Adding fix to avoid block level mapping in stage 2 mapping if max_map_size is smaller than the block size. Signed-off-by: Ganapatrao Kulkarni --- arch/arm64/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 6caa48da1b2e..3d4b53f153a1 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1304,7 +1304,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, * backed by a THP and thus use block mapping if possible. */ if (vma_pagesize == PAGE_SIZE && - !(max_map_size == PAGE_SIZE || device)) { + !(max_map_size < PMD_SIZE || device)) { if (fault_status == FSC_PERM && fault_granule > PAGE_SIZE) vma_pagesize = fault_granule; else