Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3828436ybl; Mon, 13 Jan 2020 03:23:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwkWgwfuS0yGDfVf+zVFwqMFS+/KJaF15pXn6dAomitewRtF/8z56wRDHO9CN7jSew4i9Vf X-Received: by 2002:a05:6808:8d0:: with SMTP id k16mr12157821oij.68.1578914605903; Mon, 13 Jan 2020 03:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578914605; cv=none; d=google.com; s=arc-20160816; b=EB37QDTf51BRjGzui/saWFXtsG9j5iN5i0pKePg5+60Rjv/opJGM0WQgtw0nT+ruD/ Br0I2c9mejwyaMKrpNzsIUjzC9zEFxdk+fapODgds2xFGa13BbGvkCoYX2OjGWjOsOci M/7Pbq7xyBZvFrnLBmLW06ZybQxy0+aCTH9T/H6wxnyQgI3vN0PzrdEo3ZSU2GQwGgvd TXjSIAS05C6eaoleyj/ut1zxqAPgbDF8CGSy7+q9gG+TCbYSTBumWeaKuoh8SDppXM1H +3lmFAry3/xZaAPBA/rghGJmKCq6ZhyZd0FTs9OSTebpAP1RiOycsApnDUz34ZccB2Xk 4vfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=YG4J3u08C1YW+jWBSqioJFTYiBfu1QSDAk5RNoBP2+w=; b=CViEEpNf+3YKlbgMZw3NdenLgqPi2GqItgM9sLWtzQ2iXG02PMQiFtVfZt2gqiz/W3 wWTZhA9BPVvWakF4umEBUrbRBi5SSW2lYcgvWLQQMAfs3Grl1Z16kWvdHvw2iVC4Bj4d yvBHDz/HdNkJmb4dRNAlKgBF8X+l+b4Jaw7ObL8aGiMVKl1yKCzYHPybZ48txdCtoPqR tBXYbEzgA4J+z8WPhyWx8u0aH+CKMeY6qRWD+IM/nUwTLyCW+LKMJNG0JNuztWp4aj20 K7YCh9lt0R1vQcavLqayf0EsgHfEs0MV4Gjc1K2INyIU3lRrAcOUvSk6A87UZbWrAtxI Kvig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="arrIa/WE"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2si5968313oig.255.2020.01.13.03.23.14; Mon, 13 Jan 2020 03:23:25 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b="arrIa/WE"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728774AbgAMLVP (ORCPT + 99 others); Mon, 13 Jan 2020 06:21:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:51056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726163AbgAMLVO (ORCPT ); Mon, 13 Jan 2020 06:21:14 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A9C962081E; Mon, 13 Jan 2020 11:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578914472; bh=MacVSu0STCJHhHc0ljONo5y6xoV7nal96sORZMm0SSc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=arrIa/WEpFeLMrHb//HLi36Tu08TB6YjYA8H+g4g+xc4jaJ8j4yheAtFN9FfH3HTH Xtvpvb7DQQV57PNFlCG/Dy2IywB5ZQPZ1qsVvoik8KhBkjLGzzONiHH9bZTNOkALRE lobe4VzuZIKnbUV0n1Xb0KTEfKzVSFsEccDNleEA= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iqxmR-000307-1i; Mon, 13 Jan 2020 11:21:11 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 13 Jan 2020 11:21:11 +0000 From: Marc Zyngier To: Jianyong Wu Cc: netdev@vger.kernel.org, yangbo.lu@nxp.com, john.stultz@linaro.org, tglx@linutronix.de, pbonzini@redhat.com, sean.j.christopherson@intel.com, richardcochran@gmail.com, Mark Rutland , will@kernel.org, Suzuki Poulose , Steven Price , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Steve Capper , Kaly Xin , Justin He , nd Subject: Re: [RFC PATCH v9 7/8] ptp: arm64: Enable ptp_kvm for arm64 In-Reply-To: References: <20191210034026.45229-1-jianyong.wu@arm.com> <20191210034026.45229-8-jianyong.wu@arm.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.8 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: Jianyong.Wu@arm.com, netdev@vger.kernel.org, yangbo.lu@nxp.com, john.stultz@linaro.org, tglx@linutronix.de, pbonzini@redhat.com, sean.j.christopherson@intel.com, richardcochran@gmail.com, Mark.Rutland@arm.com, will@kernel.org, Suzuki.Poulose@arm.com, Steven.Price@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Steve.Capper@arm.com, Kaly.Xin@arm.com, Justin.He@arm.com, nd@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-01-13 10:37, Jianyong Wu wrote: > Hi Marc, > >> -----Original Message----- >> From: Marc Zyngier >> Sent: Friday, January 10, 2020 6:35 PM >> To: Jianyong Wu >> Cc: netdev@vger.kernel.org; yangbo.lu@nxp.com; john.stultz@linaro.org; >> tglx@linutronix.de; pbonzini@redhat.com; >> sean.j.christopherson@intel.com; >> richardcochran@gmail.com; Mark Rutland ; >> will@kernel.org; Suzuki Poulose ; Steven Price >> ; linux-kernel@vger.kernel.org; linux-arm- >> kernel@lists.infradead.org; kvmarm@lists.cs.columbia.edu; >> kvm@vger.kernel.org; Steve Capper ; Kaly Xin >> ; Justin He ; nd >> Subject: Re: [RFC PATCH v9 7/8] ptp: arm64: Enable ptp_kvm for arm64 >> >> Hi Jianyong, >> >> On 2020-01-10 10:15, Jianyong Wu wrote: >> > Hi Marc, >> >> [...] >> >> >> >> > + ktime_overall = hvc_res.a0 << 32 | hvc_res.a1; >> >> >> > + *ts = ktime_to_timespec64(ktime_overall); >> >> >> > + *cycle = hvc_res.a2 << 32 | hvc_res.a3; >> >> >> >> >> >> So why isn't that just a read of the virtual counter, given that >> >> >> what you do in the hypervisor seems to be "cntpct - cntvoff"? >> >> >> >> >> >> What am I missing here? >> >> >> >> >> > We need get clock time and counter cycle at the same time, so we >> >> > can't just read virtual counter at guest and must get it from host. >> >> >> >> See my comment in my reply to patch #6: *Must* seems like a very >> >> strong word, and you don't explain *why* that's better than just >> >> computing the total hypercall cost. Hint: given the frequency of the >> >> counter (in the few MHz >> >> range) vs the frequency of a CPU (in the multiple GHz range, and with >> >> an IPC close enough to 1), I doubt that you'll see the counter making >> >> much progress across a hypercall. >> >> >> > Sorry, I will avoid to use those strong words. >> > >> > It's really the case that the hypercall won't across cycle in general. >> > But sometimes, kernel preempt >> > may happen in the middle of the hypercall which we can't assume how >> > long before schedule back. so it's better capture them together at the >> > same time. >> >> Fair enough. Please document the rational, as I guess others will ask >> the >> same questions. >> > Ok > >> Then the problem to solve is that of the reference counter, as you so >> far >> assume the virtual counter. I guess you need to be able to let the >> guest >> select the reference counter when calling the PTP service. >> > I could not come up with an idea about the point where the guest give > this info of counter value. > Where we give that interface to ptp service, as it's not a user space > application. Again: why don't you let the guest ask for the counter it wants as part of the SMC call? What is preventing this? M. -- Jazz is not dead. It just smells funny...