Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1960984ybv; Fri, 14 Feb 2020 08:57:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzARmlOurQWSf7g2AEuiScjCQYfuK/oz2euz2skO8hktCUZJWtqt/jxOnMdEIp0OB2cXJED X-Received: by 2002:a05:6830:1d93:: with SMTP id y19mr3114385oti.350.1581699454629; Fri, 14 Feb 2020 08:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581699454; cv=none; d=google.com; s=arc-20160816; b=crCs4J82NiK5ik5xchAoarF36kltDCW/UdFUx+sPlR/igu8F19eLGdE37mDe5lWZhb +IQ4LEp6HMdWGECKiWB+QjlbTSlt9wsL1Li73S8ZrDZMujoHAADJvxgSOxh7JP4P82iT +uXNZa1QwdBr7gDLv3hSDz/hY0Fg34mnamrKXYSFhC59nHhvDIA36Kl+0fBjKYzxsHKV D1bIuz3uO16kNRtwuqA00VDlApR8lAcSh51dASJy5VPqe4wMPa5m1NibXaqGmKuOnsKD MWfSJ/ZrUHup8ZLHak3HsjTMQlm2wdYNjCUqtRKlWxwnDfRxb4JvtE619399zYfxrUEM 9kvw== 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 :message-id:subject:cc:to:from:date; bh=ylQiwfij+7pdQQK9sbNXnf9DpDOp1jCzCaiRga6lwa4=; b=bKPmOoKAFxKMWqnAYzI44aSiUy/EMdy4J36Ba7lRLahPmO7Fdwi2QTXBgmh6KJ18b6 69sczLPeH8UBct5LFKuDVbGL+PPZf5L4BM7xLYi7wNJzRAMZkC99nverlUAo/bsEaVAV 7kgqOxYSWk/AvLOUhmEBEHZD9lbTkZTPPadPQEXw/HMBuDtLfHObm2dlU8m3Zfen6Bxc Pnm7Rmh0brbEgbS1Oo3bpuMOmq+zcsg+wPcrho6xJU7iPW15wYY/zaY3GgyFfEX884e/ VJR6a+A6zObRE5Nf9g5axc0XweQuuh7MFjVwnZS131B/gWnvN60kEI2uSYMTyyGaTG58 abjw== ARC-Authentication-Results: i=1; mx.google.com; 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 n1si3012873oic.225.2020.02.14.08.57.22; Fri, 14 Feb 2020 08:57:34 -0800 (PST) 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; 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 S2394314AbgBNQ4h (ORCPT + 99 others); Fri, 14 Feb 2020 11:56:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:39752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393951AbgBNQ4g (ORCPT ); Fri, 14 Feb 2020 11:56:36 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 741CB2067D; Fri, 14 Feb 2020 16:56:35 +0000 (UTC) Date: Fri, 14 Feb 2020 11:56:34 -0500 From: Steven Rostedt To: LKML Cc: Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Tzvetomir Stoyanov , Felipe Balbi Subject: [PATCH] xhci: Do not open code __print_symbolic() in xhci trace events Message-ID: <20200214115634.30e8ebf2@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Rostedt (VMware) libtraceevent (used by perf and trace-cmd) failed to parse the xhci_urb_dequeue trace event. This is because the user space trace event format parsing is not a full C compiler. It can handle some basic logic, but is not meant to be able to handle everything C can do. In cases where a trace event field needs to be converted from a number to a string, there's the __print_symbolic() macro that should be used: See samples/trace_events/trace-events-sample.h Some xhci trace events open coded the __print_symbolic() causing the user spaces tools to fail to parse it. This has to be replaced with __print_symbolic() instead. CC: stable@vger.kernel.org Reported-by: Tzvetomir Stoyanov Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206531 Fixes: 5abdc2e6e12ff ("usb: host: xhci: add urb_enqueue/dequeue/giveback tracers") Signed-off-by: Steven Rostedt (VMware) --- diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h index 56eb867803a6..b19582b2a72c 100644 --- a/drivers/usb/host/xhci-trace.h +++ b/drivers/usb/host/xhci-trace.h @@ -289,23 +289,12 @@ DECLARE_EVENT_CLASS(xhci_log_urb, ), TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x", __entry->epnum, __entry->dir_in ? "in" : "out", - ({ char *s; - switch (__entry->type) { - case USB_ENDPOINT_XFER_INT: - s = "intr"; - break; - case USB_ENDPOINT_XFER_CONTROL: - s = "control"; - break; - case USB_ENDPOINT_XFER_BULK: - s = "bulk"; - break; - case USB_ENDPOINT_XFER_ISOC: - s = "isoc"; - break; - default: - s = "UNKNOWN"; - } s; }), __entry->urb, __entry->pipe, __entry->slot_id, + __print_symbolic(__entry->type, + { USB_ENDPOINT_XFER_INT, "intr" }, + { USB_ENDPOINT_XFER_CONTROL, "control" }, + { USB_ENDPOINT_XFER_BULK, "bulk" }, + { USB_ENDPOINT_XFER_ISOC, "isoc" }), + __entry->urb, __entry->pipe, __entry->slot_id, __entry->actual, __entry->length, __entry->num_mapped_sgs, __entry->num_sgs, __entry->stream, __entry->flags )