From: Pekka Paalanen <ppaalanen@gmail.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>,
karolherbst@gmail.com, Ben Skeggs <bskeggs@redhat.com>,
koriakin@0x04.net
Subject: Re: ftrace use of pci_resource_to_user()
Date: Fri, 6 May 2016 13:16:04 +0300 [thread overview]
Message-ID: <20160506131604.0067718f@eldfell> (raw)
In-Reply-To: <20160504191713.GA3117@localhost>
[-- Attachment #1: Type: text/plain, Size: 2411 bytes --]
On Wed, 4 May 2016 14:17:13 -0500
Bjorn Helgaas <helgaas@kernel.org> 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.
Hi,
the code in question prints the "PCIDEV" lines in the mmiotrace output.
IIRC, it was initially meant to replicate the contents
of /proc/bus/pci/devices. I do not know it any tools rely on it, I
suppose they might, for mapping MAPs to device and BAR.
I am adding to CC some people that actually work with mmiotrace for
Nouveau. It is used for seeing what the NVIDIA proprieratry driver
does, so if there is no NVIDIA driver for the arch, they probably don't
care. I am not sure if other driver projects use it too, IIRC I heard
something about some wireless drivers in the past.
Thanks,
pq
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
next prev parent reply other threads:[~2016-05-06 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 19:17 ftrace use of pci_resource_to_user() Bjorn Helgaas
2016-05-04 19:34 ` Steven Rostedt
2016-05-06 10:16 ` Pekka Paalanen [this message]
2016-05-06 10:33 ` karol herbst
2016-05-11 19:04 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160506131604.0067718f@eldfell \
--to=ppaalanen@gmail.com \
--cc=bskeggs@redhat.com \
--cc=helgaas@kernel.org \
--cc=karolherbst@gmail.com \
--cc=koriakin@0x04.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox