Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1973540ybh; Tue, 14 Jul 2020 12:02:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2reXqBE9F72SOqIlMonW76lMmMCSVoho2+HulD4PHEuZO3BgkWqf8ZxA6JM1q+BAIbjqa X-Received: by 2002:a17:907:7283:: with SMTP id dt3mr6050694ejc.195.1594753337504; Tue, 14 Jul 2020 12:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594753337; cv=none; d=google.com; s=arc-20160816; b=YCEi1gPPUK/gTmtcUqWE9xQ4JHIfGsAke7y5w0nDsefn7CTK10w6uqF7pOnDLA9MNk MY6VTj1zhJJGK1oaXubTSLnMI6jD6UctVwYpUC+pe6IMO4kXrFFlQZ9V2eePWUHUFKPJ mN9xYP3cwWYzKDD5fteKxUvOlB8+UGQrS8l/pXCzudmPwXEdIQnxNppKKuX5RwCVF9XH O1R0MUW1ErTpyNN2iJ3K0GK1pZz6YWY3yASkDsTDTsvDSN82lyFLFcKfxSeN/xgEwSF7 T2u+YAwqBlv2eLTaKTt3LOGfifEv3jAuYDGgeyj1DZRtdlBEzIelqH8M141zEoj415Of gseg== 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=eMmM3oHlI9wIj51anjelcB1Ku1d1sbGyqiuU+ZyyDCE=; b=VtePjrQSXvyNUBIBifjYEeGF0iOF5HscadpD9EoB0OJ8dDDkpr1UUGNP53DQU/bvkQ IGeanr9dF5sV3kNru6MCQPNlivbgMtJy2mRi2eu5AYUBOg1NcVS6JDjVrgBWwbal2YMP Y2NHWGvFeTN5DtlT8Huf+FHebQjRWUZ9rHLXNlpYguJltkJJvwOGvqtxZZW5h/dr+0VD Qb06fbllr6Bf7x3VsP3MJqZSlAXoyaH+RLW9jZ6n4buF3AKaJfudChXA/eUTA2b4gF+c RKVLuNSyXez2lv8dhmPPJ026Y8VT7a3tScBtpt9hcKGuUl6UgDCwHgmXccivDSO5QJSz tWfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DDoV+DPm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si3450236edy.565.2020.07.14.12.01.54; Tue, 14 Jul 2020 12:02:17 -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=@kernel.org header.s=default header.b=DDoV+DPm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731385AbgGNTAn (ORCPT + 99 others); Tue, 14 Jul 2020 15:00:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:59592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729996AbgGNTAf (ORCPT ); Tue, 14 Jul 2020 15:00:35 -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 D362B22AAF; Tue, 14 Jul 2020 19:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594753234; bh=/6OqGyB6j1Y5RgqtxHPkVz0xAsQg57VglVJYD2HVQ2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDoV+DPmxCUK4BJCDz2+oU55rBclPLMVyJx41/iXkdXEbWpqmVLgT4Ff4q7rRl/2n haFY/nUiQMix+LEX6ddtdCyDalDqK9Dg7+4egtFUbszeMR8NfwYEJsLGX5d2F7zYn3 FmViwGaJe/AKtmvcapd8R8vC+sRxQ4KBfE4cLRzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 5.7 162/166] perf scripts python: export-to-postgresql.py: Fix struct.pack() int argument Date: Tue, 14 Jul 2020 20:45:27 +0200 Message-Id: <20200714184123.578904010@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714184115.844176932@linuxfoundation.org> References: <20200714184115.844176932@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 From: Adrian Hunter commit 640432e6bed08e9d5d2ba26856ba3f55008b07e3 upstream. Python 3.8 is requiring that arguments being packed as integers are also integers. Add int() accordingly. Before: $ perf record -e intel_pt//u uname $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py perf_data_db branches calls 2020-06-25 16:09:10.547256 Creating database... 2020-06-25 16:09:10.733185 Writing to intermediate files... Traceback (most recent call last): File "/home/ahunter/libexec/perf-core/scripts/python/export-to-postgresql.py", line 1106, in synth_data cbr(id, raw_buf) File "/home/ahunter/libexec/perf-core/scripts/python/export-to-postgresql.py", line 1058, in cbr value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, MHz, 4, percent) struct.error: required argument is not an integer Fatal Python error: problem in Python trace event handler Python runtime state: initialized Current thread 0x00007f35d3695780 (most recent call first): Aborted (core dumped) After: $ dropdb perf_data_db $ rm -rf perf_data_db-perf-data $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py perf_data_db branches calls 2020-06-25 16:09:40.990267 Creating database... 2020-06-25 16:09:41.207009 Writing to intermediate files... 2020-06-25 16:09:41.270915 Copying to database... 2020-06-25 16:09:41.382030 Removing intermediate files... 2020-06-25 16:09:41.384630 Adding primary keys 2020-06-25 16:09:41.541894 Adding foreign keys 2020-06-25 16:09:41.677044 Dropping unused tables 2020-06-25 16:09:41.703761 Done Fixes: aba44287a224 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events") Signed-off-by: Adrian Hunter Cc: Jiri Olsa Cc: stable@vger.kernel.org Link: http://lore.kernel.org/lkml/20200629091955.17090-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/scripts/python/export-to-postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/scripts/python/export-to-postgresql.py +++ b/tools/perf/scripts/python/export-to-postgresql.py @@ -1055,7 +1055,7 @@ def cbr(id, raw_buf): cbr = data[0] MHz = (data[4] + 500) / 1000 percent = ((cbr * 1000 / data[2]) + 5) / 10 - value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, MHz, 4, percent) + value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, int(MHz), 4, int(percent)) cbr_file.write(value) def mwait(id, raw_buf):