Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3969337ybi; Mon, 29 Jul 2019 16:30:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzr7O0zkB3Q3NU9AY4wol6QF0B/KJXbn2tJzYqLOm6qh/XprsCTiSp9c6SWJtOnD8B+vFBb X-Received: by 2002:a17:902:4b:: with SMTP id 69mr111774545pla.89.1564443059387; Mon, 29 Jul 2019 16:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564443059; cv=none; d=google.com; s=arc-20160816; b=Rl7LBjdmJPDoC5vlVac9FZnwf6pMcF4x4mVPC9HILoUUl7W04R0fy7IxwJUFCGFnyv 5Ydrmp67yjwf6L8JXRU3AEKtTOVPUkfK0Zu5VdDbQ7ML6fkrLKoWTe/c30gbzLIWUkha IDK80PZ1Fk1eFda5ytYJO0e8txWvx2ijHoTlrBSnHDA4J30/hnqgyLcsTAMD5+jkSXQi pqxOeLKamdHC7dFQp5z2BwtuNXVGdcN3MTUSfQvc9NEO4+nMiuIQVcCcGsxkS3ywRfi5 Jba5H/NWFrmFXTgeJjAG1y1sgfgZ/JXVnJOre1FoV+B1Lvmb/MnwXt9+3wMawWd8jbtg YStA== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NKjXC71E1TsXxP5ZA34L9QthRInu0cyHyzBJJKoDMuo=; b=TOv3vZleUwJeWHhohaGWFJDK+JFaJ+i+I3CuFBzreSmQmsNTUR1GSiN5/kZDxmpfzn 7TktRwy1lXObhw2BTAaj8ybDeXX60/E6FEtLWS3zLxz8OzV3ND+7nL5ZUyjTPOU2sVZX sFkEqA83VQzQnQvmiRaTVrGjluEgnvUdLUCmwfYgL+GfjYLnsES7zImij8j0vUREt/zS j5oid3L86Pah/Gui7+Fj1K9q5TdXSWEErNRUka6imS/4jvaJ0ZCgH0LL5BcrOUzCWulP eZd4nHre+K3Ec5k+7hA0JjaE/JasgGG97QCCS3eZOhIFgVriYZAj+m2fo6H48aa/ZnQu 7fjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0Trs2QKH; 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 c7si27474964pfj.79.2019.07.29.16.30.32; Mon, 29 Jul 2019 16:30:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0Trs2QKH; 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 S1729663AbfG2TZg (ORCPT + 99 others); Mon, 29 Jul 2019 15:25:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:37872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728910AbfG2TZe (ORCPT ); Mon, 29 Jul 2019 15:25:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 82B1A21655; Mon, 29 Jul 2019 19:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428333; bh=blHjgIZHXCdXeJcyEHyC4xgbYKAKEIj5JANjXEsjWs0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Trs2QKHPVGQrfLI/XU8rVBW4Ly+s1ba9NnLBRxKWKzapPq1SnbfKreFbOa4v9Y85 tXTB6YUVdUgGvD4LKB4MxDhkZhnfAJZX7SJr0rJdrIbFfSw+E03gxgjcYBmJdvtwCd BFcQNnrYwcyuG+BsBIlrE38jWCvBUEQ1Ko7q8Hdg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Richter , Christian Borntraeger , Heiko Carstens , Hendrik Brueckner , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.14 042/293] perf test 6: Fix missing kvm module load for s390 Date: Mon, 29 Jul 2019 21:18:53 +0200 Message-Id: <20190729190825.902254287@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 53fe307dfd309e425b171f6272d64296a54f4dff ] Command # perf test -Fv 6 fails with error running test 100 'kvm-s390:kvm_s390_create_vm' failed to parse event 'kvm-s390:kvm_s390_create_vm', err -1, str 'unknown tracepoint' event syntax error: 'kvm-s390:kvm_s390_create_vm' \___ unknown tracepoint when the kvm module is not loaded or not built in. Fix this by adding a valid function which tests if the module is loaded. Loaded modules (or builtin KVM support) have a directory named /sys/kernel/debug/tracing/events/kvm-s390 for this tracepoint. Check for existence of this directory. Signed-off-by: Thomas Richter Reviewed-by: Christian Borntraeger Cc: Heiko Carstens Cc: Hendrik Brueckner Link: http://lkml.kernel.org/r/20190604053504.43073-1-tmricht@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/tests/parse-events.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index f0679613bd18..424b82a7d078 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -19,6 +19,32 @@ #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \ PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD) +#if defined(__s390x__) +/* Return true if kvm module is available and loaded. Test this + * and retun success when trace point kvm_s390_create_vm + * exists. Otherwise this test always fails. + */ +static bool kvm_s390_create_vm_valid(void) +{ + char *eventfile; + bool rc = false; + + eventfile = get_events_file("kvm-s390"); + + if (eventfile) { + DIR *mydir = opendir(eventfile); + + if (mydir) { + rc = true; + closedir(mydir); + } + put_events_file(eventfile); + } + + return rc; +} +#endif + static int test__checkevent_tracepoint(struct perf_evlist *evlist) { struct perf_evsel *evsel = perf_evlist__first(evlist); @@ -1600,6 +1626,7 @@ static struct evlist_test test__events[] = { { .name = "kvm-s390:kvm_s390_create_vm", .check = test__checkevent_tracepoint, + .valid = kvm_s390_create_vm_valid, .id = 100, }, #endif -- 2.20.1