Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp630513pxj; Fri, 28 May 2021 11:35:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJkQt0HBFnyxA6ltUtZ9HXCy6m/v1shGH8dcm+kwhAk89/AAmFzqJ4AEBihuqWNcT84Rc9 X-Received: by 2002:a02:7110:: with SMTP id n16mr9773638jac.69.1622226906911; Fri, 28 May 2021 11:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622226906; cv=none; d=google.com; s=arc-20160816; b=OwxIg5uYcGmIMpBsS3bMzYK6wNfVCkN9+lGpKMO6HdJGx7zMWb9+zPgvuOMtdJ7vt+ lkXoI89YgcD4XGGcZXrLUtAdf67BanIqCXMrHGAO0mX+5iXuCCj4GyN5LqHppHtvAcEt kukwU5A9VsAbVSw+SXauEr02qSrNBiH/gPdhJUYuzk6ANJR/BoFsymVwDVvDJJBORldx eWlwM3HePFUkN9TPerHOBSCRdwT/56nPOf97o9lXFcb39+Rj8TEUR7G6zqmeNX/UOr5d Af0De+I7iF8IQ6Zi5zZgdsn9HDX0UiF33uudrNa/s/jI8fr1PVX+Bzpk2bQtEF1l6vL5 6t8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AXu/cY1gGv2Wn1ajEnYj9SqMQ0t/TGuBi8LefYvM9Os=; b=tT4l35ym3dJfa1DF/gEgf+gy4m5lAB2Kfy3lvk1UoYbvBBaj+WQYWxxUqzXAsGDqB3 ZF7e0uUepxjZUkuDFsYwqCnxf8pRAswTyntgNtTs6RWrZw2zWFxGuDq6BSeu1NSYxbeR v173iUPHcjcxoLOQvJ5E9LgJxEZrve4UJaDc3ujDOUJU2eWCZ2axTirvEuN10fSagjPO QsTzwkeHRbZT3Mo20uFNy7uYRcWhmyuZ07gY/zZgrtzFgd+AmrIBt0MKCzX7fF4YTgkN nM0MPHz4E465ueJ5KUzP+whXHn9ZJC0xMqYxbmneo4jX1R3QRrJ9jViC8ZEpqeeyUd2W x4Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="TFy/0qHR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si7595681jac.31.2021.05.28.11.34.52; Fri, 28 May 2021 11:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="TFy/0qHR"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229493AbhE1SfO (ORCPT + 99 others); Fri, 28 May 2021 14:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbhE1SfN (ORCPT ); Fri, 28 May 2021 14:35:13 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D693C061574 for ; Fri, 28 May 2021 11:33:37 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id n2so4262878wrm.0 for ; Fri, 28 May 2021 11:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AXu/cY1gGv2Wn1ajEnYj9SqMQ0t/TGuBi8LefYvM9Os=; b=TFy/0qHR56Mqoi4QCYcIUqRrFcC4OfaZIl8pJnIaQ1D9n86aOiHpWvVa9tlcY5DQo4 OyGAd/aL9E+w8rc6+xUlr2zej0kzx7Ih3/DQKBZ2BAf6VsMjIluRkrCpPPoCMJJy4HZE rBRlPNzyyHWLPDMEsHiYLNJm4OmW4+wUbtfRC6DGRBuw/FDJAaC+QL77kHI9QnH7TCBZ zXTHoT9Kg1QHjRvQMc/SHsb6HW1JhyYA+0c7tAUWmvdFDqG9aatruxmhKvauyCRG+ljc wBd9yWR+Xn5tv5Mv/XSD+qZtaEi/oN2MafMWBFBA8bh9Atb8e6pvtAy6Vte6/oobQp37 i9uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AXu/cY1gGv2Wn1ajEnYj9SqMQ0t/TGuBi8LefYvM9Os=; b=lLQlVaecl/PwmPDeNehYKMiVGBrUf2Peuy0iyhulBxYFfXUuEW3gJbI0VSHDwN/tV8 W3vktRbHy1+6saIJu1ewL2LysiNSpuPiI9CE7Z0KIoUDsST2VF7Uhxo8JeQ10nlDLzpX flTWQKJggRBYSPck0wUUYrUsVXYSpj5lDtJydzWDvNK73MQozjhmQf67lCTvIv/BnvE4 beYytcyMxTkTuSLDRTjx126FUfOwwnMP6BGdnHmlysT43OYSmZoGSHwnScPGDoeiKYqF VdUK5XuO74ewF+D1QxwOB1mEUVcMApN3uLAVMp6bAbmrduSfCwTfj+3m34sZV3w/ev8P bxEw== X-Gm-Message-State: AOAM530WkG+TGsA6mdxx5CawBY+pW8Cbu6e9EBW7h2L/RPIZr1v681qP RVfPEaSUC7clEaUU2DuUrBgUjPcXR4W1J1RBMKOUew== X-Received: by 2002:a05:6000:1b8f:: with SMTP id r15mr9837463wru.119.1622226816011; Fri, 28 May 2021 11:33:36 -0700 (PDT) MIME-Version: 1.0 References: <20210528091050.245838-1-tmricht@linux.ibm.com> In-Reply-To: <20210528091050.245838-1-tmricht@linux.ibm.com> From: Ian Rogers Date: Fri, 28 May 2021 11:33:23 -0700 Message-ID: Subject: Re: [PATCH V2][Ping] perf test: Test 17 fails with make LIBPFM4=1 on s390 z/VM To: Thomas Richter Cc: LKML , linux-perf-users , Arnaldo Carvalho de Melo , Arnaldo Carvalho de Melo , svens@linux.ibm.com, Vasily Gorbik , sumanth Korikkar , Heiko Carstens Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 28, 2021 at 2:11 AM Thomas Richter wrote: > > Version 2: > As suggested by Ian Rogers make perf_event_attribute member > exclude_hv more robust and accept value 0 or 1 to handle more > test cases which might fail on s390 virtual machine z/VM. > > This test case fails on s390 virtual machine z/VM which has no PMU support > when the perf tool is built with LIBPFM4=1. > > Using make LIBPFM4=1 builds the perf tool with support for libpfm > event notation. The command line flag --pfm-events is valid: > # ./perf record --pfm-events cycles -- true > [ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 0.001 MB perf.data (2 samples) ] > # > > However the command 'perf test -Fv 17' fails on s390 z/VM virtual machine > with LIBPFM4=1: > # perf test -Fv 17 > 17: Setup struct perf_event_attr : > --- start --- > ..... > running './tests/attr/test-record-group2' > unsupp './tests/attr/test-record-group2' > running './tests/attr/test-record-pfm-period' > expected exclude_hv=0, got 1 > FAILED './tests/attr/test-record-pfm-period' - match failure > ---- end ---- > Setup struct perf_event_attr: FAILED! > > When --pfm-event system is not supported, the test returns unsupported > and continues. Here is an example using a virtual machine on x86 and > Fedora 34: > [root@f33 perf]# perf test -Fv 17 > 17: Setup struct perf_event_attr : > --- start --- > ..... > running './tests/attr/test-record-group2' > unsupp './tests/attr/test-record-group2' > running './tests/attr/test-record-pfm-period' > unsupp './tests/attr/test-record-pfm-period' > .... > > The issue is file ./tests/attr/test-record-pfm-period > which requires perf event attribute member exclude_hv to be zero. > This is not the case on s390 where the value of exclude_hv is one when > executing on a z/VM virtual machine without PMU hardware support. > > Fix this by allowing value exlucde_hv to be zero or one. > > Output before: > # /usr/bin/python ./tests/attr.py -d ./tests/attr/ -t \ > test-record-pfm-period -p ./perf -vvv 2>&1| fgrep match > matching [event:base-record] > match: [event:base-record] matches [] > FAILED './tests/attr//test-record-pfm-period' - match failure > # > > Output after: > # /usr/bin/python ./tests/attr.py -d ./tests/attr/ -t \ > test-record-pfm-period -p ./perf -vvv 2>&1| fgrep match > matching [event:base-record] > match: [event:base-record] matches ['event-1-0-6', 'event-1-0-5'] > matched > > Background: > Using libpfm library ends up in this function call sequence > > pfm_get_perf_event_encoding() > +-- pfm_get_os_event_encoding() > +-- pfmlib_perf_event_encode() > > is called when no hardware specific PMU unit can be detected > as in the s390 z/VM virtual machine case. This uses the > "perf_events generic PMU" data structure which sets exclude_hv > to 1 per default. Using this PMU that test case always fails. > > That is the reason why exclude_hv attribute setting varies. > > Signed-off-by: Thomas Richter > Suggested-by: Ian Rogers Reviewed-by: Ian Rogers Tested on x86 with and without hypervisor and test still passes. This would be expected as the change is making a flag more permissive. As we don't care about this flag in existing tests I believe there's no impact to this change other than fixing the tests on s390. Thanks, Ian > --- > tools/perf/tests/attr/base-record | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record > index 4a7b8deef3fd..8c10955eff93 100644 > --- a/tools/perf/tests/attr/base-record > +++ b/tools/perf/tests/attr/base-record > @@ -16,7 +16,7 @@ pinned=0 > exclusive=0 > exclude_user=0 > exclude_kernel=0|1 > -exclude_hv=0 > +exclude_hv=0|1 > exclude_idle=0 > mmap=1 > comm=1 > -- > 2.31.1 >