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=-8.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 31180C43461 for ; Thu, 17 Sep 2020 10:10:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC5C92083B for ; Thu, 17 Sep 2020 10:10:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CMFWaNdx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726433AbgIQKKH (ORCPT ); Thu, 17 Sep 2020 06:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726180AbgIQKJ6 (ORCPT ); Thu, 17 Sep 2020 06:09:58 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CB2CC06174A for ; Thu, 17 Sep 2020 03:09:58 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id k15so893360pfc.12 for ; Thu, 17 Sep 2020 03:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F8QBNk7jtOrsUWbDdv+lNZw0GVbMmzNIo7UoVlpNTYQ=; b=CMFWaNdxsj6ae/xoCBeTz6XAGngTrAmDcJF6Nff/KRHsbP/5H8jJqq61eiZEYRB8hN EsVN6ltWGziYwfkGx5BirQulEjHlb1gJGzttetabrsiPE6sLkr3j4/ejY89YM3UEOb2v 9ZISYJyCf+RzOEAtOwBuDsiQ0CF9LkpN0S93iP6kcLMsPQQkBjDVIU0qNtYq4JT0v43a vnJ4ESpemzf3cj5IV2IAHvnrF/oQTKyazZL2jEAG6Nk8LV/dqsSK7qIdN/xb71UTJvGN P5t3BB1V9B5+kRigV7bxSMA/MLJWNcFGRGtUbYPn0FI1q2wG6pw8L2MUXhxSVzmcnOBX No/w== 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=F8QBNk7jtOrsUWbDdv+lNZw0GVbMmzNIo7UoVlpNTYQ=; b=bQUxdnw+7xqwDfsXta38But4gWyDQ6tVjk/6YvhILaKWq9jA3tVjFNuRNvXGlW0Na9 c7bP+k06C7lsDkFv+Q+T44m6Nk+v7OV9BaQ35bX16VNW3pmX7in+Gtu4jd7aRPbWkN8C Ck8y8Rt38+7bAtfHlVKWFU1YqD+u0Kjkbpoi75nzJIZ47rGVUyIYQTFWLOLJUg+9RsPl f22asaBQDX6AqEIoc6EMgJPF7r0+700H959A+ZsWkiJXc28K4Glqha5XMWvwVQk+/j97 78zaHbVyUw9r62RNY3cX+jSzKhGt3/SEHYbPXugy6fAs1C5x2MmLZOr2N0b00VqtBkU6 N9Yw== X-Gm-Message-State: AOAM531QuoC1d8YsFY9BAI8mDpEZMvTc+iX62zhVHmLRFFjn3MGEJ/CU sP9YJG5wBqT/DA00xmgrlC8IlQ== X-Google-Smtp-Source: ABdhPJy5LpIsXaVb4XJKNIGClo+wrTgEj/6PZDB6lJsJ/2rYsDFr1/Bgb9kKhf/A3N4i0MayrkvUNQ== X-Received: by 2002:a63:7841:: with SMTP id t62mr21433065pgc.183.1600337398053; Thu, 17 Sep 2020 03:09:58 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id x5sm17064456pgf.65.2020.09.17.03.09.54 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Sep 2020 03:09:57 -0700 (PDT) Date: Thu, 17 Sep 2020 18:09:50 +0800 From: Leo Yan To: Sergey Senozhatsky Cc: Arnaldo Carvalho de Melo , Mark Rutland , Peter Zijlstra , Will Deacon , John Garry , Mathieu Poirier , Namhyung Kim , Suleiman Souhlal , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCHv3] perf kvm: add kvm-stat for arm64 Message-ID: <20200917100950.GC12548@leoy-ThinkPad-X240s> References: <20200917003645.689665-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917003645.689665-1-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ + Marc ] On Thu, Sep 17, 2020 at 09:36:45AM +0900, Sergey Senozhatsky wrote: [...] > diff --git a/tools/perf/arch/arm64/util/kvm-stat.c b/tools/perf/arch/arm64/util/kvm-stat.c > new file mode 100644 > index 000000000000..32e58576f186 > --- /dev/null > +++ b/tools/perf/arch/arm64/util/kvm-stat.c > @@ -0,0 +1,86 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#include > +#include > +#include "../../util/evsel.h" > +#include "../../util/kvm-stat.h" > +#include "arm64_exception_types.h" > +#include "debug.h" > + > +define_exit_reasons_table(arm64_exit_reasons, kvm_arm_exception_type); > +define_exit_reasons_table(arm64_trap_exit_reasons, kvm_arm_exception_class); > + > +const char *kvm_trap_exit_reason = "esr_ec"; > +const char *vcpu_id_str = "id"; On Arm64, ftrace tracepoint "kvm_entry" doesn't contain the field "id" or field "vcpu_id", thus it always reads out the "id" is 0 and it is recorded into Perf's structure vcpu_event_record::vcpu_id and assigned to perf thread's private data "thread::private". With current code, it will not mess up different vcpus' samples because now the samples are analyzed based on thread context, but since all threads' "vcpu_id" is zero, thus all samples are accounted for "vcpu_id=0" and cannot print out correct result with option "--vcpu": $ perf kvm stat report --vcpu 4 Analyze events for all VMs, VCPU 4: VM-EXIT Samples Samples% Time% Min Time Max Time Avg time Total Samples:0, Total events handled time:0.00us. This is an issue I observed, if we want to support option "--vcpu", seems we need to change ftrace event for "kvm_entry", but this will break ABI. Essentially, this issue is caused by different archs using different format for ftrace event "kvm_entry", on x86 it contains feild "vcpu_id" but arm64 only just records "vcpu_pc". @Marc, @Will, do you have any suggestion for this? Do you think it's feasible to add a new field "vcpu_id" into the tracepoint "kvm_entry" for Arm64's version? Thanks, Leo 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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 2CF5EC43461 for ; Thu, 17 Sep 2020 10:12:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 BA34A2083B for ; Thu, 17 Sep 2020 10:12:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kiytf0H8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CMFWaNdx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA34A2083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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=klSBiioXGV3Q9iHboB8rfV0APGp7ADTL2VFD3bAgY6U=; b=kiytf0H8EmsAsSthW3cOtKeKT DqsjaqbUHNmsrSPlxFwiPPTLfJxGGHxN6BiuX8+zRSC68MzXGiqnT8LecKr+uQ4xEPjcCDo2LYPZG ingzL2sc07St2JcJgzpazXFJRXFllNtzTFv8Oe+pcS6pYFR+xbZlRePqSfiqBWsYUqBIfVW0WIYtN RyqALhjtawAnKstRod0cuYwVkOvgWODgussizZrWO67qnghJeYHk55qz4Vt7FDwdHwgMPbo/MK3aP 11AILnK9oU+nSX8qJ5yPAszivW2Fc0wbwQAWbDE+9OekUSGOK82cJiaKsmvrBQjJNqT+pBudXcXfD 88cJvJK+A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIqsL-0001Bt-WD; Thu, 17 Sep 2020 10:10:50 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIqrY-0000hy-An for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 10:10:02 +0000 Received: by mail-pg1-x542.google.com with SMTP id u13so1096038pgh.1 for ; Thu, 17 Sep 2020 03:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=F8QBNk7jtOrsUWbDdv+lNZw0GVbMmzNIo7UoVlpNTYQ=; b=CMFWaNdxsj6ae/xoCBeTz6XAGngTrAmDcJF6Nff/KRHsbP/5H8jJqq61eiZEYRB8hN EsVN6ltWGziYwfkGx5BirQulEjHlb1gJGzttetabrsiPE6sLkr3j4/ejY89YM3UEOb2v 9ZISYJyCf+RzOEAtOwBuDsiQ0CF9LkpN0S93iP6kcLMsPQQkBjDVIU0qNtYq4JT0v43a vnJ4ESpemzf3cj5IV2IAHvnrF/oQTKyazZL2jEAG6Nk8LV/dqsSK7qIdN/xb71UTJvGN P5t3BB1V9B5+kRigV7bxSMA/MLJWNcFGRGtUbYPn0FI1q2wG6pw8L2MUXhxSVzmcnOBX No/w== 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=F8QBNk7jtOrsUWbDdv+lNZw0GVbMmzNIo7UoVlpNTYQ=; b=qRwd6tllSCzUlYVAZ/0Dwv3xfiIggNaeHYHkGZpyOZ33cB1rldA1AA0+yx1eHnfrfg A2OWvWXEbtWWwFMUULbxL/lguJflzO+9wuymvRCwP4W/saBYQqFdoJBtIrjtAkeLTbWI +YqB89WDqoVYUUg2qJsyi9/u1emI/wo8GEW4ikollLSeTUK8nlibg+Ts+XktzvJSt//p nns0OkYJbM1HIrwkhg0lV1ne/0Y+P7bXsAdcPkyumlD5abE6lPy4aV0mz+Z5boWFGSgW 4EybeVfPFAUD6bPlFeTzMcParYwl58c4cWwCJ7lGVOvaUD4hRE+xLS0bdMu8pCYnRk0w mioA== X-Gm-Message-State: AOAM533XPJT+4k/QceSTStf94Ee0vERcWJ2+4XqCgavSgmQaEIRd9yF1 jMhMs3DTTL/10XRT5aEQd+GKpQ== X-Google-Smtp-Source: ABdhPJy5LpIsXaVb4XJKNIGClo+wrTgEj/6PZDB6lJsJ/2rYsDFr1/Bgb9kKhf/A3N4i0MayrkvUNQ== X-Received: by 2002:a63:7841:: with SMTP id t62mr21433065pgc.183.1600337398053; Thu, 17 Sep 2020 03:09:58 -0700 (PDT) Received: from leoy-ThinkPad-X240s ([2600:3c01::f03c:91ff:fe8a:bb03]) by smtp.gmail.com with ESMTPSA id x5sm17064456pgf.65.2020.09.17.03.09.54 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Sep 2020 03:09:57 -0700 (PDT) Date: Thu, 17 Sep 2020 18:09:50 +0800 From: Leo Yan To: Sergey Senozhatsky Subject: Re: [PATCHv3] perf kvm: add kvm-stat for arm64 Message-ID: <20200917100950.GC12548@leoy-ThinkPad-X240s> References: <20200917003645.689665-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200917003645.689665-1-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_061000_739430_D11B92B6 X-CRM114-Status: GOOD ( 16.66 ) 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 , Mathieu Poirier , Peter Zijlstra , John Garry , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Suleiman Souhlal , Namhyung Kim , Will Deacon , 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+linux-arm-kernel=archiver.kernel.org@lists.infradead.org [ + Marc ] On Thu, Sep 17, 2020 at 09:36:45AM +0900, Sergey Senozhatsky wrote: [...] > diff --git a/tools/perf/arch/arm64/util/kvm-stat.c b/tools/perf/arch/arm64/util/kvm-stat.c > new file mode 100644 > index 000000000000..32e58576f186 > --- /dev/null > +++ b/tools/perf/arch/arm64/util/kvm-stat.c > @@ -0,0 +1,86 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#include > +#include > +#include "../../util/evsel.h" > +#include "../../util/kvm-stat.h" > +#include "arm64_exception_types.h" > +#include "debug.h" > + > +define_exit_reasons_table(arm64_exit_reasons, kvm_arm_exception_type); > +define_exit_reasons_table(arm64_trap_exit_reasons, kvm_arm_exception_class); > + > +const char *kvm_trap_exit_reason = "esr_ec"; > +const char *vcpu_id_str = "id"; On Arm64, ftrace tracepoint "kvm_entry" doesn't contain the field "id" or field "vcpu_id", thus it always reads out the "id" is 0 and it is recorded into Perf's structure vcpu_event_record::vcpu_id and assigned to perf thread's private data "thread::private". With current code, it will not mess up different vcpus' samples because now the samples are analyzed based on thread context, but since all threads' "vcpu_id" is zero, thus all samples are accounted for "vcpu_id=0" and cannot print out correct result with option "--vcpu": $ perf kvm stat report --vcpu 4 Analyze events for all VMs, VCPU 4: VM-EXIT Samples Samples% Time% Min Time Max Time Avg time Total Samples:0, Total events handled time:0.00us. This is an issue I observed, if we want to support option "--vcpu", seems we need to change ftrace event for "kvm_entry", but this will break ABI. Essentially, this issue is caused by different archs using different format for ftrace event "kvm_entry", on x86 it contains feild "vcpu_id" but arm64 only just records "vcpu_pc". @Marc, @Will, do you have any suggestion for this? Do you think it's feasible to add a new field "vcpu_id" into the tracepoint "kvm_entry" for Arm64's version? Thanks, Leo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel