From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752622AbcEDTeW (ORCPT ); Wed, 4 May 2016 15:34:22 -0400 Received: from smtprelay0093.hostedemail.com ([216.40.44.93]:56344 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751088AbcEDTeV (ORCPT ); Wed, 4 May 2016 15:34:21 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1801:1963:2393:2553:2559:2562:2895:3138:3139:3140:3141:3142:3308:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4605:5007:6261:7875:10004:10400:10848:10967:11026:11232:11473:11658:11914:12114:12296:12438:12517:12519:12555:12740:13069:13311:13357:13439:14093:14097:14181:14659:14721:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: song29_42d8d441ac313 X-Filterd-Recvd-Size: 2781 Date: Wed, 4 May 2016 15:34:17 -0400 From: Steven Rostedt To: Bjorn Helgaas Cc: Ingo Molnar , Pekka Paalanen , linux-kernel@vger.kernel.org, Yinghai Lu Subject: Re: ftrace use of pci_resource_to_user() Message-ID: <20160504153417.62d657c6@gandalf.local.home> In-Reply-To: <20160504191713.GA3117@localhost> References: <20160504191713.GA3117@localhost> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 May 2016 14:17:13 -0500 Bjorn Helgaas wrote: > 138295373ccf ("ftrace: mmiotrace update, #2") added this use of > pci_resource_to_user(): > > +static int mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev) > +{ > ... > + /* > + * XXX: is pci_resource_to_user() appropriate, since we are > + * supposed to interpret the __ioremap() phys_addr argument based on > + * these printed values? > + */ > + for (i = 0; i < 7; i++) { > + pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); > + ret += trace_seq_printf(s, " %llx", > + (unsigned long long)(start | > + (dev->resource[i].flags & PCI_REGION_FLAG_MASK))); > + } > > I think it was a mistake to use pci_resource_to_user() here because it > adds unnecessary arch dependencies in whatever consumes this output. > > On most arches, pci_resource_to_user() is a no-op and the result is > normal resource addresses, i.e., CPU physical addresses that match > things in /proc/iomem and /sys/devices/pci.../resource. > > On microblaze, mips, powerpc, and sparc, the result of > pci_resource_to_user() is something else, usually a PCI bus address (a > raw BAR value). These values are only useful for using mmap on > files like /proc/bus/pci/.... > > I don't know what, if anything, consumes this output. If things parse > it, we shouldn't break them. But those things likely would need > special cases for microblaze, mips, powerpc, and sparc. > > If it's only for human consumption, I think we should consider > removing the use of pci_resource_to_user() and printing > dev->resource[i].start instead. Currently this code requires the arch to define HAVE_MMIOTRACE_SUPPORT, and so far as I can tell, only x86 does this. -- Steve