Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2838290pjo; Mon, 16 Mar 2020 05:39:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuUrGOhIehHUR+yDv/4tD62HiuEq232PSWjOOphpj8lXyNZI7FKKQF95BMNfc2xkl+ykjpB X-Received: by 2002:aca:ef82:: with SMTP id n124mr16591198oih.73.1584362389312; Mon, 16 Mar 2020 05:39:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362389; cv=none; d=google.com; s=arc-20160816; b=TE340gC5NX5aont8Q4BOAjiSfocVThpn4+gEofnBbdgauNx41D7O5bjF3yuMNWkjZs NOUWySZQJ/tD8rdt8ogoMIy0XonlZzwb0nUYSoGrkUHaJrM9P5qh/6osfYxLMku+wpw7 FnTfBU6kiTW4rjxkX/YQh6lRTtYWhbLZZgaN9pV+QEMrDH5mJbuCGoNkn7KT7vWLwuer SxEvqboO+ppBUAGbM8XuG9JPjl6JaJBgNkGxB1OB/xPDz1B13VHnKWxH7IUzuyUIfE6h zew3UFnY/JvlWGNh/YbAh1OwVFEcG2m/70t2UysmvPNT0O7yo3R8zaWyx3YpmZu4sfJB ockw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=WfAnIbFBYysFD5T9izR0IygSeR5KxbXa2lrlK9UuZ6s=; b=AmgRGi73EqB1eY6Gq6+aCQ8lijYVI/eRbhuwYEKvtPEA7rKu/jrtk1E2pBwHDJENnW 6/wRrVyYlsQBnDtWsLZfy8gvs+LW0SAHULqSyhfjFPKngCA4szdGFAThmOR7i0j8iXwj 49JXB1s5CUKHnBixWfaWAhouyfCoRhwtxD/2D06njTivfOq22o57IAwqmq9OVF6S6yEJ 11Gqz/1A6jEdbNBhPuOdrfbPe620iSYXxLKquFAWab1p0kVGgbT15eqzRbQ+3yHAiUCY KRRYsW0nNfzy3WQ2dANNfTGfkDXRoGP3h+K9OvYlpvc3n3SgUvDt3JPkYvcBhybYcFuM DTSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si9777621oth.182.2020.03.16.05.39.36; Mon, 16 Mar 2020 05:39:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731083AbgCPMi6 (ORCPT + 99 others); Mon, 16 Mar 2020 08:38:58 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:33290 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731027AbgCPMi5 (ORCPT ); Mon, 16 Mar 2020 08:38:57 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 7A402E500B6ABF9507E3; Mon, 16 Mar 2020 20:38:48 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Mon, 16 Mar 2020 20:38:38 +0800 Subject: Re: [PATCH] KVM: arm64: Use the correct timer for accessing CNT To: Marc Zyngier CC: KarimAllah Ahmed , , , References: <1584351546-5018-1-git-send-email-karahmed@amazon.de> <7ed91b9b-e968-770c-28f9-0ca479359657@huawei.com> From: Zenghui Yu Message-ID: Date: Mon, 16 Mar 2020 20:38:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 2020/3/16 19:09, Marc Zyngier wrote: > Hi Zenghui, > > On 2020-03-16 10:49, Zenghui Yu wrote: >> Hi, >> >> On 2020/3/16 17:39, KarimAllah Ahmed wrote: >>> Use the physical timer object when reading the physical timer counter >>> instead of using the virtual timer object. This is only visible when >>> reading it from user-space as kvm_arm_timer_get_reg() is only >>> executed on >>> the get register patch from user-space. >> >> s/patch/path/ >> >> I think the physical counter hasn't yet been accessed by the current >> userspace, wrong? > > I don't think userspace can access it, as the ONE_REG API only exposes > the virtual > timer so far, and userspace is much better off just reading the counter > directly > (it has access to the virtual counter, and the guarantee that cntvoff is > 0 in this > context). Yeah, I see. The physical timer registers are all ignored in walk_one_sys_reg() and won't be exposed. > > But as we move towards a situation where we can save/restore the > physical timer > just like the virtual one, we're going to use this path and hit this bug. Thanks for the explanation. Zenghui