From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27C21C433DF for ; Sun, 24 May 2020 02:11:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00B5B207F7 for ; Sun, 24 May 2020 02:11:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J786UewE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388306AbgEXCLM (ORCPT ); Sat, 23 May 2020 22:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388225AbgEXCLL (ORCPT ); Sat, 23 May 2020 22:11:11 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40444C061A0E; Sat, 23 May 2020 19:11:11 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id x10so6006247plr.4; Sat, 23 May 2020 19:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1NYHauUBWTQgbc43oFTAJCreNKv+baIo/68K96Zs4rc=; b=J786UewExllUKHofcVvgLTI358KCYatvgJpAOm0F2OufvL+pVNAtJGo1pj6JUBbbpC 3NF7ePvGe1k+NcGAVJWA2jqXhGQgat6fKQL9C+cfS+HDIRW3Ap1PV2RjfeIRroac1Ezk KhFr6z8QBUa1W8cUNJnD/40ivm8kFHrTlkiHK7cocLe4YIU63lxvhlKVJLa1uVkKSRXG K5T/3uWMrNaxJoDU2eQqFcsAoD5BLt9X90hzco/4eRKjYTM1gkTYB1q7X53w991RSW2v 1MVV+EKruZWQnr+ZrRghABtNQQDfIE7Sfy1pYYOvIS3EeWc8l92vFliiDW9EjpixaL1h Qflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1NYHauUBWTQgbc43oFTAJCreNKv+baIo/68K96Zs4rc=; b=Qb9sNV064AArRV05HIGQ6y9u5uXrTjVSEBDbki/iMQ+pi6j7p0mSaz7zYpV8sJK7F1 SnAKETVrr1kiqND/xtpj4rTmJ9vDJM+gDlH52p7fXgi4gG8VYHHviqdgh/Q4pxlqmAE+ 2Ggp+8zUpP/PC7mDAtUyCoKozvF6tWfXW9FGgI9Ladfgltn3de2A83j8bmyweAdp4IFd 5IJA7kOiPgVGF/fMG9bwkVtorZ6tqIR6U+ZV0GYyMR10vbPUM0ylo0BttwhPdmmdw2Vs BxwwMcRtOUFn79f+TZkIWI9NrvKLHRHNyWiPEiQcaMQ5OPE4RrqRbsoBPLixUJVgMUsV DrtQ== X-Gm-Message-State: AOAM533jwINdWIdx6a8eKtZ9wcS5OrU277jRE5R+DietqyoGPCTLCQ8w YqCuEBXqLwmNMfVyen4AWDM= X-Google-Smtp-Source: ABdhPJzjaswgBjGeZOebznwn3ru9lufOX3WhHax+o+4Bd9NRfLzG3TqcRXoKe1CoWCEUQMaErKCTqQ== X-Received: by 2002:a17:90a:10c1:: with SMTP id b1mr7863131pje.232.1590286270773; Sat, 23 May 2020 19:11:10 -0700 (PDT) Received: from localhost (c-73-241-114-122.hsd1.ca.comcast.net. [73.241.114.122]) by smtp.gmail.com with ESMTPSA id p1sm1961780pjz.36.2020.05.23.19.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 19:11:10 -0700 (PDT) Date: Sat, 23 May 2020 19:11:06 -0700 From: Richard Cochran 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, maz@kernel.org, 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, Wei.Chen@arm.com, nd@arm.com Subject: Re: [RFC PATCH v12 10/11] arm64: add mechanism to let user choose which counter to return Message-ID: <20200524021106.GC335@localhost> References: <20200522083724.38182-1-jianyong.wu@arm.com> <20200522083724.38182-11-jianyong.wu@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522083724.38182-11-jianyong.wu@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 04:37:23PM +0800, Jianyong Wu wrote: > In general, vm inside will use virtual counter compered with host use > phyical counter. But in some special scenarios, like nested > virtualization, phyical counter maybe used by vm. A interface added in > ptp_kvm driver to offer a mechanism to let user choose which counter > should be return from host. Sounds like you have two time sources, one for normal guest, and one for nested. Why not simply offer the correct one to user space automatically? If that cannot be done, then just offer two PHC devices with descriptive names. > diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c > index fef72f29f3c8..8b0a7b328bcd 100644 > --- a/drivers/ptp/ptp_chardev.c > +++ b/drivers/ptp/ptp_chardev.c > @@ -123,6 +123,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) > struct timespec64 ts; > int enable, err = 0; > > +#ifdef CONFIG_ARM64 > + static long flag; static? This is not going to fly. > + * In most cases, we just need virtual counter from host and > + * there is limited scenario using this to get physical counter > + * in guest. > + * Be careful to use this as there is no way to set it back > + * unless you reinstall the module. How on earth is the user supposed to know this? >From your description, this "flag" really should be a module parameter. Thanks, Richard From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23F6BC433E0 for ; Sun, 24 May 2020 02:11:17 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id A4A5E20759 for ; Sun, 24 May 2020 02:11:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J786UewE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4A5E20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 26F544B2C6; Sat, 23 May 2020 22:11:16 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@gmail.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RK-SYPzMxD5h; Sat, 23 May 2020 22:11:14 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 55AAD4B287; Sat, 23 May 2020 22:11:14 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 017624B287 for ; Sat, 23 May 2020 22:11:13 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZnhaOJP-mYgz for ; Sat, 23 May 2020 22:11:12 -0400 (EDT) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id D9CF74B274 for ; Sat, 23 May 2020 22:11:11 -0400 (EDT) Received: by mail-pl1-f195.google.com with SMTP id x11so5014073plv.9 for ; Sat, 23 May 2020 19:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1NYHauUBWTQgbc43oFTAJCreNKv+baIo/68K96Zs4rc=; b=J786UewExllUKHofcVvgLTI358KCYatvgJpAOm0F2OufvL+pVNAtJGo1pj6JUBbbpC 3NF7ePvGe1k+NcGAVJWA2jqXhGQgat6fKQL9C+cfS+HDIRW3Ap1PV2RjfeIRroac1Ezk KhFr6z8QBUa1W8cUNJnD/40ivm8kFHrTlkiHK7cocLe4YIU63lxvhlKVJLa1uVkKSRXG K5T/3uWMrNaxJoDU2eQqFcsAoD5BLt9X90hzco/4eRKjYTM1gkTYB1q7X53w991RSW2v 1MVV+EKruZWQnr+ZrRghABtNQQDfIE7Sfy1pYYOvIS3EeWc8l92vFliiDW9EjpixaL1h Qflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1NYHauUBWTQgbc43oFTAJCreNKv+baIo/68K96Zs4rc=; b=D+PLD+rfupTz0tJe1nJktPguGs3uH4lKz36ou+J2EYQH9Vdn9pcMvP1dj9rUn1CFSq ZvaKy556LlI7VCpqpLBRnO1VKwqrKP03HY954XS8y1CS7rd5rXvt/nCCEzWM2Dp5D+qx g77AUHgdPuST31kq0qm21iEipyQBhzhnIu7Rd3ZvQ/0D6W0cxgROcyrIxaZ5k8Olw0CG Cff+s3MNMhLdhycD4boIebF+dicK4JDpu6Sp5a6eTZ8bJAo5scV0TkeSim7vlpzyXIfw ryIi6ssAGx9+i+tEiTNFXKUGcskaD6IXRuXFCUcTBWyvjZM9UWvdJE1pdX/conDACq5r 2Aug== X-Gm-Message-State: AOAM530c5j9noLs0pDpkfzAHM+JS+in93wnscc1I2Le3UzJt+VzqqWCI wKKwql0zlBt5WI8O9EqUuSA= X-Google-Smtp-Source: ABdhPJzjaswgBjGeZOebznwn3ru9lufOX3WhHax+o+4Bd9NRfLzG3TqcRXoKe1CoWCEUQMaErKCTqQ== X-Received: by 2002:a17:90a:10c1:: with SMTP id b1mr7863131pje.232.1590286270773; Sat, 23 May 2020 19:11:10 -0700 (PDT) Received: from localhost (c-73-241-114-122.hsd1.ca.comcast.net. [73.241.114.122]) by smtp.gmail.com with ESMTPSA id p1sm1961780pjz.36.2020.05.23.19.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 19:11:10 -0700 (PDT) Date: Sat, 23 May 2020 19:11:06 -0700 From: Richard Cochran To: Jianyong Wu Subject: Re: [RFC PATCH v12 10/11] arm64: add mechanism to let user choose which counter to return Message-ID: <20200524021106.GC335@localhost> References: <20200522083724.38182-1-jianyong.wu@arm.com> <20200522083724.38182-11-jianyong.wu@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200522083724.38182-11-jianyong.wu@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Cc: maz@kernel.org, justin.he@arm.com, Wei.Chen@arm.com, kvm@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, sean.j.christopherson@intel.com, steven.price@arm.com, john.stultz@linaro.org, yangbo.lu@nxp.com, pbonzini@redhat.com, tglx@linutronix.de, nd@arm.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Fri, May 22, 2020 at 04:37:23PM +0800, Jianyong Wu wrote: > In general, vm inside will use virtual counter compered with host use > phyical counter. But in some special scenarios, like nested > virtualization, phyical counter maybe used by vm. A interface added in > ptp_kvm driver to offer a mechanism to let user choose which counter > should be return from host. Sounds like you have two time sources, one for normal guest, and one for nested. Why not simply offer the correct one to user space automatically? If that cannot be done, then just offer two PHC devices with descriptive names. > diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c > index fef72f29f3c8..8b0a7b328bcd 100644 > --- a/drivers/ptp/ptp_chardev.c > +++ b/drivers/ptp/ptp_chardev.c > @@ -123,6 +123,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) > struct timespec64 ts; > int enable, err = 0; > > +#ifdef CONFIG_ARM64 > + static long flag; static? This is not going to fly. > + * In most cases, we just need virtual counter from host and > + * there is limited scenario using this to get physical counter > + * in guest. > + * Be careful to use this as there is no way to set it back > + * unless you reinstall the module. How on earth is the user supposed to know this? >From your description, this "flag" really should be a module parameter. Thanks, Richard _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A35C433E0 for ; Sun, 24 May 2020 02:11:18 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 86A0A20759 for ; Sun, 24 May 2020 02:11:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qK27E9xJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J786UewE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86A0A20759 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M2zsZL9rOSy9X3d5qby9QNwJZFUxgL1dbQ+wRYq4jq0=; b=qK27E9xJySNo0a CdxZjqXJzJh5sgeq3dldDRhMvE2ycDUUEnS2DGU5B3/LxHm+UioWfD1kU4fo1zSB2Lh0r04yNFsrV fmX9AECGHgJvAXD1M6BAPMU23YZCq3pCkqb5fygfSTTF82U5n4qpG+chg6ht+DqS/xm74nlHpl0q5 k4nXuE9ctTIv0qVoNC+MhnCDcz/IMWLbHXI+wGroByJaHeL0cKrPohMzxpLS0yVthCH2VNYkfZ0vy tfcJrj6zUo/qn0Fi9c1N3iuna37KrbTkgCEZeASLCKq11k3TOVNdNY2RV1XTnVJx/Z0/jUbhaeb2d 9xLFSkHZSlLh2W2isA6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcg6e-0005iI-OU; Sun, 24 May 2020 02:11:16 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jcg6b-0005gl-E2 for linux-arm-kernel@lists.infradead.org; Sun, 24 May 2020 02:11:14 +0000 Received: by mail-pl1-x643.google.com with SMTP id u22so5990025plq.12 for ; Sat, 23 May 2020 19:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1NYHauUBWTQgbc43oFTAJCreNKv+baIo/68K96Zs4rc=; b=J786UewExllUKHofcVvgLTI358KCYatvgJpAOm0F2OufvL+pVNAtJGo1pj6JUBbbpC 3NF7ePvGe1k+NcGAVJWA2jqXhGQgat6fKQL9C+cfS+HDIRW3Ap1PV2RjfeIRroac1Ezk KhFr6z8QBUa1W8cUNJnD/40ivm8kFHrTlkiHK7cocLe4YIU63lxvhlKVJLa1uVkKSRXG K5T/3uWMrNaxJoDU2eQqFcsAoD5BLt9X90hzco/4eRKjYTM1gkTYB1q7X53w991RSW2v 1MVV+EKruZWQnr+ZrRghABtNQQDfIE7Sfy1pYYOvIS3EeWc8l92vFliiDW9EjpixaL1h Qflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1NYHauUBWTQgbc43oFTAJCreNKv+baIo/68K96Zs4rc=; b=FeVxoKgSysl6A4nC73tU360fT51VwSAk/AzhkdZhAUEEoC8A2IXcVZhhWaVVFJM3VA yuahVo4QQzi+5U68x7FJhDpI1KAJQyYHvyY3OB7w5nOQAcy0fga3X/yjv2Gr0sufX1E7 FG9rlTq69T9oEyI4t8NylsYZsI20F+KUjp4Q1S2hHljYL+l41A3AvOfl2G2QFrmHhuNg jnziyspb7SlmWf+Rwnd6N7KbP30uaZJoqoIdHuc2aANepHT+zDAs5+mWfE6NsONX8oYM 2+LE2tLT3TZ+1e+2M8TQqe18/DwmgqCgTonD0NJU8CQhS7QUGFSsHa/1qFH6YkerxC6v ZLhQ== X-Gm-Message-State: AOAM533fQBgymwbI99cNw294Rqe/AcyM+SsGXc5YyGKKwHfVQxaTeIW3 hJiYBBkj3xcj/s/v7Jcl9js= X-Google-Smtp-Source: ABdhPJzjaswgBjGeZOebznwn3ru9lufOX3WhHax+o+4Bd9NRfLzG3TqcRXoKe1CoWCEUQMaErKCTqQ== X-Received: by 2002:a17:90a:10c1:: with SMTP id b1mr7863131pje.232.1590286270773; Sat, 23 May 2020 19:11:10 -0700 (PDT) Received: from localhost (c-73-241-114-122.hsd1.ca.comcast.net. [73.241.114.122]) by smtp.gmail.com with ESMTPSA id p1sm1961780pjz.36.2020.05.23.19.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 19:11:10 -0700 (PDT) Date: Sat, 23 May 2020 19:11:06 -0700 From: Richard Cochran To: Jianyong Wu Subject: Re: [RFC PATCH v12 10/11] arm64: add mechanism to let user choose which counter to return Message-ID: <20200524021106.GC335@localhost> References: <20200522083724.38182-1-jianyong.wu@arm.com> <20200522083724.38182-11-jianyong.wu@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200522083724.38182-11-jianyong.wu@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200523_191113_473506_F0B54B22 X-CRM114-Status: GOOD ( 15.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark.Rutland@arm.com, maz@kernel.org, justin.he@arm.com, Wei.Chen@arm.com, kvm@vger.kernel.org, suzuki.poulose@arm.com, netdev@vger.kernel.org, Steve.Capper@arm.com, linux-kernel@vger.kernel.org, sean.j.christopherson@intel.com, steven.price@arm.com, Kaly.Xin@arm.com, john.stultz@linaro.org, yangbo.lu@nxp.com, pbonzini@redhat.com, tglx@linutronix.de, nd@arm.com, will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 22, 2020 at 04:37:23PM +0800, Jianyong Wu wrote: > In general, vm inside will use virtual counter compered with host use > phyical counter. But in some special scenarios, like nested > virtualization, phyical counter maybe used by vm. A interface added in > ptp_kvm driver to offer a mechanism to let user choose which counter > should be return from host. Sounds like you have two time sources, one for normal guest, and one for nested. Why not simply offer the correct one to user space automatically? If that cannot be done, then just offer two PHC devices with descriptive names. > diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c > index fef72f29f3c8..8b0a7b328bcd 100644 > --- a/drivers/ptp/ptp_chardev.c > +++ b/drivers/ptp/ptp_chardev.c > @@ -123,6 +123,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) > struct timespec64 ts; > int enable, err = 0; > > +#ifdef CONFIG_ARM64 > + static long flag; static? This is not going to fly. > + * In most cases, we just need virtual counter from host and > + * there is limited scenario using this to get physical counter > + * in guest. > + * Be careful to use this as there is no way to set it back > + * unless you reinstall the module. How on earth is the user supposed to know this? >From your description, this "flag" really should be a module parameter. Thanks, Richard _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel