Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp470541rdb; Tue, 19 Sep 2023 00:22:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmSvX+bHjpuOBCWs9VU43T7SET3wQe1mq1vZ2uirn0XCyD9FU2V+qFaHbNf3Q7j1Fm6uB9 X-Received: by 2002:a17:90a:d18c:b0:273:e090:6096 with SMTP id fu12-20020a17090ad18c00b00273e0906096mr2203786pjb.11.1695108157162; Tue, 19 Sep 2023 00:22:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695108157; cv=pass; d=google.com; s=arc-20160816; b=SFK0YQen3bVvCURGTYNGaRLg8cs5IJD7N+FSmltExzu0Mk5izqxx14KRP5LpQrRDtE HcBtZL2JiGEnury7T89MJPzTvGDsl/iy1IbaQKTmr96TfO9Fl1yugwcJ/srfZ50hxIKQ 70NpRinhXenAlf7EtuGIG4dhcswaEIYJ2K4ZQVdBbboESyh/Dw78VJ04zRf/31mnTcwe e5zfLsRbfFEy1etqf5Ybn9EJJQC3nzKBaxGa/YXjOFLppoRDKaNZeQjhEkz5TsLQWNtT LcGMgB4W5rHg4TYe7NERrQKWCZ1BxJLBibCto8LKmWS78sb0Aom5fZhm8hcbilAgms8b r9NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=wxoFpU40mFrwhrAZwd74nVyOsWtRMCj/iABkbLW12XY=; fh=49lcaX8fvDY8B3ZwtuVH2MxahoiLQ9qSo2ZLBxFvGWE=; b=W/F4+eg4XPZrTDbzq1PGGHoFcoZ0FqIDT7RSHR2E+n/ix4KP2l/wlP8wA7Ea0TGgbO eeISztHGfRabYSyZ2ATcXihRpecYQE6rviooq2BKx8lo4uFvaCQzMUlHEs/E9SR/ZhZc XNw8/6dEZNMni6t3HUDjwDXV7YzRC8xlorFCgrtQH3E0waxGu1msEOR37M5UTLF0nyRb mmsK7kseFtOLrOQ0bj8fz+pJEzektqbg16QJZFs6baM0B2Pe+yd2ww/wz9vhSN414/4f CKJ3xVG1WfBLQx18A2PSubjjicEVlRVDhLLRntEql18WP3xJJ3R7Ny+3gvwQGzLSmmx/ qFLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="Q+RbF7k/"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id d22-20020a17090ab31600b002597ed3cc4fsi9153976pjr.189.2023.09.19.00.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 00:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b="Q+RbF7k/"; arc=pass (i=1 spf=pass spfdomain=os.amperecomputing.com dkim=pass dkdomain=os.amperecomputing.com dmarc=pass fromdomain=os.amperecomputing.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amperecomputing.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 51DF180D293C; Mon, 18 Sep 2023 23:16:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230230AbjISGQI (ORCPT + 99 others); Tue, 19 Sep 2023 02:16:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbjISGQH (ORCPT ); Tue, 19 Sep 2023 02:16:07 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D1CE115 for ; Mon, 18 Sep 2023 23:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILT4lNRCCvulLPb9BJybkJPtBtOUj71Y6AnTi2LtrTemKwsnGKTWSkQCyNuWUM3CPkwpC+XyhwYDZbFi80Hikf1RCbaoJNbzPvaAo+LakK7HNiXOExkTCE++RN7SocdqKqizuz3dbfkgc50657oK97/8RPkItjow6zNcBxZuwwQQ3TZfvhlIoyfLvUDwbWPTxagdyACH3BKRnN6nM18WIku5/QLZcT4Ardtyg/B5vH77WS7NKlLLffuenAHxW4uf6ZMINEGslWoiPpd3kjUjHh4bnyt9Q3bVAEa8w4hg9Pm3A+V0pjY3KxZaof1Ogu1+CSa/RpHSCvcYmJa0dQyA/A== 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=wxoFpU40mFrwhrAZwd74nVyOsWtRMCj/iABkbLW12XY=; b=Z+MNxJ5v1nxvsD8tcvdzTbbW7fxYkP2BDLpuRF5eGyTi+QQfSHOCJuorwmzXnSFdgxrqyN3CDmn00EmlpMhJl8Qi1gj45C3z1SBVzUzaB1gtuLeDe6ZCmC7HuccehFJT7YXzVU3fm+S9M6bn7VDSBb2aAJ+oikNTJ0jYSw31IttG4Y1wrN9mksx3alanbbueJIvJkiCHoi4mxSk8S1y/sHhUYMTRhUqkQFo00IyxBOs/A9bEewin1peTRax76DEhaHtWT1UxGIFLkqNbXh6dZo/xfVKQutgxSOC6RX4Jf/eAyqMmLQulWQhjyEHhFQ1nGwg5poM++wMYKtWkEHeEZA== 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=wxoFpU40mFrwhrAZwd74nVyOsWtRMCj/iABkbLW12XY=; b=Q+RbF7k/yES3nUK6T5KIJgH9Wi7hDCTNaZSx6WsPj4qNs2F6p6Y4UwH7JsR5H7+soWLWhDEa8um5wIsUFoH0ofMfullMeyRx/lm0Zk4hmaiN/8fjxzcZv/HEoEyeMQJmEhSVa9KMQTriMtGtkVHUrT5ojXl+oh7TEF6SoM9S4a0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) by SJ0PR01MB6253.prod.exchangelabs.com (2603:10b6:a03:290::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Tue, 19 Sep 2023 06:15:55 +0000 Received: from SJ2PR01MB8101.prod.exchangelabs.com ([fe80::d686:ac07:89b3:e724]) by SJ2PR01MB8101.prod.exchangelabs.com ([fe80::d686:ac07:89b3:e724%3]) with mapi id 15.20.6792.026; Tue, 19 Sep 2023 06:15:54 +0000 Message-ID: <38722ba7-b7d9-368b-f946-b6c0c0a661b8@os.amperecomputing.com> Date: Tue, 19 Sep 2023 11:45:44 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v2 2/2] KVM: arm64: timers: Save restore CVAL of a ptimer across guest entry and exits To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Christoffer.Dall@arm.com, eauger@redhat.com, miguel.luis@oracle.com, darren@os.amperecomputing.com, scott@os.amperecomputing.com References: <20230904114218.590304-1-gankulkarni@os.amperecomputing.com> <20230904114218.590304-3-gankulkarni@os.amperecomputing.com> <86bkeadzf0.wl-maz@kernel.org> <8634zben3d.wl-maz@kernel.org> Content-Language: en-US From: Ganapatrao Kulkarni In-Reply-To: <8634zben3d.wl-maz@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: CH0PR03CA0448.namprd03.prod.outlook.com (2603:10b6:610:10e::11) To SJ2PR01MB8101.prod.exchangelabs.com (2603:10b6:a03:4f6::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR01MB8101:EE_|SJ0PR01MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: c385e5b4-3116-4cc3-a38b-08dbb8d7e151 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dz2VG9nz3dKriSt0QPK7t/rMMbU2CvDXpb9bDIe7ZhLE8eeIl4s0mejPnCUn8Fn4hT5OA0s6pIpledYbjPs/1oA4kfKlywY9jKrAW6uBQbEA5nxFQ+kex6vrwASdYEH+xfk6ppD0gXrQczDYQkcG6YTaK406UZ9v+5P93qTcNyWmMI0CA4wVTN8JKP2My7kbZZe9FO7YiYh4Hb4QYFMenntNz9OSMyBhd8WeHvW24/XX4sgs7k3gHg28BalR4zppM+698B3Je2NZgGeqAhuhH7PWcyvXEy9ufv/LrdIW5LvcFi+ShNPnanMv4N20f+w7i5Z/kMYy7p891otsof9yPYADU9vHWu5NRBX1ULdbJQGHrPGj/cE7vPNnGdBoEX6OlvNXwbg4aU98xPAdhRFa8iDPapxcRCjhSgnj76qOmQddqdptSRyFWVVKY5IX3gSVvNzjE+RoN+pGqxGFi/aHjq0e1uSzIiZxgMH5UcFa6W5T1dPNMLYvgyf7cnRQ8IHy/M4yR3mr312DFb18zP3f0CyULfLcTkTgaRDmw/HY0scOSYNV4wlIDT/1oSByZ1vOixyJM+96OfjcaAq5AXDV93LP15Gans7gcToHvGsasRAYBQOG4rbGLiADUXUIFepA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR01MB8101.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(366004)(346002)(39850400004)(136003)(451199024)(1800799009)(186009)(316002)(6916009)(41300700001)(66946007)(66476007)(66556008)(478600001)(6666004)(38100700002)(2906002)(31696002)(86362001)(4326008)(8676002)(8936002)(5660300002)(107886003)(2616005)(31686004)(26005)(83380400001)(53546011)(6486002)(6506007)(6512007)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eGtaOTNMQk1hbHZySDAyc3NTQjFDbEs1YWVvMC9xRW02Y1k2VmVHVnk0dk9r?= =?utf-8?B?MS8wZVhaY0QxYms2cXlWUHFGSG8rVkswOWV5QlB4RGVyUDUvQ3RYNHNQVVhM?= =?utf-8?B?aE9rcWE0ZUl0TWRlZ3ViWDBwc2dxaTFOWkJoL1FmRGhDQzVTQzhaVnlSWFJp?= =?utf-8?B?d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djdNOGZwamV4LzFyeVVkMzZtTEpK?= =?utf-8?B?dXc2YXVXT24vTmJOZUF4eG9KUjVMVTYveit2YUlzSERQeGlCcmgxM05wUkUr?= =?utf-8?B?TmR6cTNncjY4V3pKaWh0RnIvNXFTRzJ0MzJuWkR3aU5MWVB4anp3TkFKZVFI?= =?utf-8?B?Mk5MeFRVYlIvVHEzam5EUU12TUc2bzR0Z0JvWVFMdWFOMnltdGlxeEN1NWtm?= =?utf-8?Q?thxQ4Z02p7z3o1mXJI07mZU=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: c385e5b4-3116-4cc3-a38b-08dbb8d7e151 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR01MB8101.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 06:15:54.4732 (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: ERqoKR8TRaZYhNMgvLmWYruBaDUsHYUsumGgEfvYD7z7GiyvCbL0MWjH8SzN0ZJCRsC6YGb6jb3hLNptobF66leUMs417aeVCntsTX0ucXeSE9CbW6Z3/mMMp4dvOTjh X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR01MB6253 X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 18 Sep 2023 23:16:21 -0700 (PDT) On 18-09-2023 04:59 pm, Marc Zyngier wrote: > On Fri, 15 Sep 2023 10:57:46 +0100, > Ganapatrao Kulkarni wrote: >> >> This patch did not work. >> After adding changes as in below diff, it is started working. > > Thanks for looking into this. > >> >> diff --git a/arch/arm64/kvm/hyp/vhe/switch.c >> b/arch/arm64/kvm/hyp/vhe/switch.c >> index b0b07658f77d..91d2cfb03e26 100644 >> --- a/arch/arm64/kvm/hyp/vhe/switch.c >> +++ b/arch/arm64/kvm/hyp/vhe/switch.c >> @@ -117,7 +117,7 @@ static void __activate_traps(struct kvm_vcpu *vcpu) >> val = __vcpu_sys_reg(vcpu, CNTHP_CVAL_EL2); >> >> if (map.direct_ptimer) { >> - write_sysreg_s(val, SYS_CNTP_CVAL_EL0); >> + write_sysreg_el0(val, SYS_CNTP_CVAL); > > Duh, of course. Silly me. > >> isb(); >> } >> } >> @@ -161,8 +161,6 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) >> >> ___deactivate_traps(vcpu); >> >> - write_sysreg(HCR_HOST_VHE_FLAGS, hcr_el2); >> - >> if (has_cntpoff()) { >> struct timer_map map; >> u64 val, offset; >> @@ -173,7 +171,7 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) >> * We're exiting the guest. Save the latest CVAL value >> * to memory and apply the offset now that TGE is set. >> */ >> - val = read_sysreg_s(SYS_CNTP_CVAL_EL0); >> + val = read_sysreg_el0(SYS_CNTP_CVAL); >> if (map.direct_ptimer == vcpu_ptimer(vcpu)) >> __vcpu_sys_reg(vcpu, CNTP_CVAL_EL0) = val; >> if (map.direct_ptimer == vcpu_hptimer(vcpu)) >> @@ -182,12 +180,13 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) >> offset = read_sysreg_s(SYS_CNTPOFF_EL2); >> >> if (map.direct_ptimer && offset) { >> - offset = read_sysreg_s(SYS_CNTPOFF_EL2); >> - write_sysreg_s(val + offset, SYS_CNTP_CVAL_EL0); >> + write_sysreg_el0(val + offset, SYS_CNTP_CVAL); >> isb(); >> } >> } >> >> + write_sysreg(HCR_HOST_VHE_FLAGS, hcr_el2); > > Why moving the HCR_EL2 update? I don't grok what it changes. Or is it This the line of code which flips the TGE and making timer cval ready to handle the TGE flip is more safe way(avoids even corner case of false interrupt triggers) than changing after the flipping? > that you end-up with spurious interrupts because your GIC is slow to > retire interrupts that are transiently pending? IIUC, If there are any transient interrupts or asserted already, anyway they will be handled when irq is unmasked. > > Thanks, > > M. > Thanks, Ganapat