Received: by 10.192.165.148 with SMTP id m20csp4283123imm; Tue, 8 May 2018 06:08:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpQ8lEChmRCN9a67V2HtIidPtCsfamgbElgsUidL/RgM15q8RgBlrnjM+Im+WoshYkXoBCP X-Received: by 2002:a65:654a:: with SMTP id a10-v6mr27903856pgw.107.1525784915020; Tue, 08 May 2018 06:08:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525784914; cv=none; d=google.com; s=arc-20160816; b=KdAqv7peSrL8u+/TVpfBmFc/ojA7Xguc27Izr9W3ur6Nb6jdYMoZVks3GF6lyex3Gd RnIUQzfRyttr01VBRw2W003qUc8Lv4nrsu87GCvTS8sCEzhZ9bVPia+dxNMBKFPD23vx IsEobzOYj5sXP7FpMqENFXv6n/Pk72FkdVuzmefHe/Wze5r8hAkpiyekqOjTb5yBTlj0 2PO7D2vqgqECTENwKTZqrRy1c4HNtyTquM0GX+gGWWikm+le7cdV8s/8VlS/xqbbA81X w7bsipWvTRmdMg66vA1+8K5wsdlKHII7FwF8nfcL1kOhNAp05mEscXz00+nb81/oImwH zWyA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=EmlvJb6QBs2z7S+CiOvzLABfKj0iuB5gC26aNlNFOQg=; b=N4qOJKnK9LzHahKPSExiqC2/rDnxmdZ858lpl+Ft4CvcmFRzo3hwYk1DOpEfcXfNaC cqbO1K4C5i/Dnlb8rMer+sfezgGuHiFTNtVtDdSNv0PnyMm+XZZ1HGwc/0anp6WnSMT1 b5n3YwZRJ6FfJ01WKMIjcJ3/qHAIXRZMIqDVp+WTsmvpsEWfth+LVCk+Torc5od5ZZM7 IubbBGXu6mIPeE3OGQNAC4lRq2a4w06pbqk1PV7L/QHEQ+ioCj7tCrhVL34emjLOmPuh kX//FfsH4SiRbUCt05BQbWnMfH2qczPQv9cbBcHEkJgBY4AzoWut0VR6QEZujV528Yzy 2nZw== 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 n3-v6si19975793pld.116.2018.05.08.06.08.19; Tue, 08 May 2018 06:08:34 -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; 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 S1754690AbeEHNIA (ORCPT + 99 others); Tue, 8 May 2018 09:08:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:47862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751952AbeEHNH7 (ORCPT ); Tue, 8 May 2018 09:07:59 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (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 93458214D5; Tue, 8 May 2018 13:07:58 +0000 (UTC) Date: Tue, 8 May 2018 09:07:56 -0400 From: Steven Rostedt To: Bjorn Helgaas Cc: Thomas Tai , bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandru Gagniuc Subject: Re: [PATCH] PCI/AER: add pcie TLP header information in the tracepoint Message-ID: <20180508090756.57f38d17@gandalf.local.home> In-Reply-To: <20180507222136.GD161390@bhelgaas-glaptop.roam.corp.google.com> References: <20180402154708.5032-1-thomas.tai@oracle.com> <20180507222136.GD161390@bhelgaas-glaptop.roam.corp.google.com> X-Mailer: Claws Mail 3.16.0 (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 On Mon, 7 May 2018 17:21:37 -0500 Bjorn Helgaas wrote: > [+cc Steve, Alex] > > On Mon, Apr 02, 2018 at 11:47:08AM -0400, Thomas Tai wrote: > > When a PCIe AER occurs, the TLP header information is > > printed in the kernel message but it is missing from > > the tracepoint. A userspace program can use this information > > in the tracepoint to better analyze problems. > > > > Example tracepoint output: > > aer_event: 0000:01:00.0 > > PCIe Bus Error: severity=Uncorrected, non-fatal, Completer Abort > > TLP Header={0x0,0x1,0x2,0x3} > > > > Signed-off-by: Thomas Tai > > I tentatively applied this to pci/aer for v4.18, thanks! > > Steve, let me know if you have any comments. > > Alex, I just copied you because you've been unifying the AER native and > CPER paths, and this is another case of code that appears in both paths. > FYI only, no action required :) > > > --- > > drivers/pci/pcie/aer/aerdrv_errprint.c | 4 ++-- > > include/ras/ras_event.h | 20 ++++++++++++++++---- > > 2 files changed, 18 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c > > index 6a352e638699..0a78a773bd25 100644 > > --- a/drivers/pci/pcie/aer/aerdrv_errprint.c > > +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c > > @@ -192,7 +192,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) > > pci_err(dev, " Error of this Agent(%04x) is reported first\n", id); > > > > trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), > > - info->severity); > > + info->severity, info->tlp_header_valid, &info->tlp); > > } > > > > void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) > > @@ -252,6 +252,6 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, > > __print_tlp_header(dev, &aer->header_log); > > > > trace_aer_event(dev_name(&dev->dev), (status & ~mask), > > - aer_severity); > > + aer_severity, tlp_header_valid, &aer->header_log); > > } > > #endif > > diff --git a/include/ras/ras_event.h b/include/ras/ras_event.h > > index 9c689868eb4d..90f59556f595 100644 > > --- a/include/ras/ras_event.h > > +++ b/include/ras/ras_event.h > > @@ -298,30 +298,42 @@ TRACE_EVENT(non_standard_event, > > TRACE_EVENT(aer_event, > > TP_PROTO(const char *dev_name, > > const u32 status, > > - const u8 severity), > > + const u8 severity, > > + const u32 tlp_header_valid, > > + struct aer_header_log_regs *tlp), > > > > - TP_ARGS(dev_name, status, severity), > > + TP_ARGS(dev_name, status, severity, tlp_header_valid, tlp), > > > > TP_STRUCT__entry( > > __string( dev_name, dev_name ) > > __field( u32, status ) > > __field( u8, severity ) > > + __field( u32, tlp_header_valid) I'm guessing tlp_header_valid is just a boolean. It's after severity which is just one byte long. Why not make this one byte as well, otherwise you are wasting 3 bytes. > > + __array( u32, buf, 4 ) > > ), > > > > TP_fast_assign( > > __assign_str(dev_name, dev_name); > > __entry->status = status; > > __entry->severity = severity; > > + __entry->tlp_header_valid = tlp_header_valid; > > + __entry->buf[0] = tlp->dw0; > > + __entry->buf[1] = tlp->dw1; > > + __entry->buf[2] = tlp->dw2; > > + __entry->buf[3] = tlp->dw3; Should this assignment be dependent on whether or not tlp_header_valid is true? Could tlp be pointing to some random memory if it isn't? What about: if ((__entry->tlp_header_valid = tlp_header_valid)) { __entry->buf[0] = tlp->dw0; __entry->buf[1] = tlp->dw1; __entry->buf[2] = tlp->dw2; __entry->buf[3] = tlp->dw3; } > > ), > > > > - TP_printk("%s PCIe Bus Error: severity=%s, %s\n", > > + TP_printk("%s PCIe Bus Error: severity=%s, %s, TLP Header=%s\n", > > __get_str(dev_name), > > __entry->severity == AER_CORRECTABLE ? "Corrected" : > > __entry->severity == AER_FATAL ? > > "Fatal" : "Uncorrected, non-fatal", > > __entry->severity == AER_CORRECTABLE ? > > __print_flags(__entry->status, "|", aer_correctable_errors) : > > - __print_flags(__entry->status, "|", aer_uncorrectable_errors)) > > + __print_flags(__entry->status, "|", aer_uncorrectable_errors), > > + __entry->tlp_header_valid ? > > + __print_array(__entry->buf, 4, sizeof(unsigned int)) : Note, "sizeof" will be shown in the format file that perf and trace-cmd read to parse this event. They currently do not know how to parse that (although I could add that in the future). Since sizeof(unsigned int) is always 4 in Linux, just use 4. __print_array(__entry->buf, 4, 4) -- Steve > > + "Not available") > > ); > > > > /* > > -- > > 2.14.1 > >