* [PATCH] tracing: Expose CPU physical addresses (resource values) for PCI devices
@ 2016-05-11 19:06 Bjorn Helgaas
2016-06-17 21:59 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2016-05-11 19:06 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-pci, karol herbst, linux-kernel, Pekka Paalanen,
Ingo Molnar, Ben Skeggs, Yinghai Lu, koriakin
Previously, mmio_print_pcidev() put "user" addresses in the trace buffer.
On most architectures, these are the same as CPU physical addresses, but on
microblaze, mips, powerpc, and sparc, they may be something else, typically
a raw BAR value (a bus address as opposed to a CPU address).
Always expose the CPU physical address to avoid this arch-dependent
behavior.
This change should have no user-visible effect because this file currently
depends on CONFIG_HAVE_MMIOTRACE_SUPPORT, which is only defined for x86,
and pci_resource_to_user() is a no-op on x86.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
kernel/trace/trace_mmiotrace.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index 68f376c..cd7480d 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -68,19 +68,15 @@ static void mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
trace_seq_printf(s, "PCIDEV %02x%02x %04x%04x %x",
dev->bus->number, dev->devfn,
dev->vendor, dev->device, dev->irq);
- /*
- * 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);
+ start = dev->resource[i].start;
trace_seq_printf(s, " %llx",
(unsigned long long)(start |
(dev->resource[i].flags & PCI_REGION_FLAG_MASK)));
}
for (i = 0; i < 7; i++) {
- pci_resource_to_user(dev, i, &dev->resource[i], &start, &end);
+ start = dev->resource[i].start;
+ end = dev->resource[i].end;
trace_seq_printf(s, " %llx",
dev->resource[i].start < dev->resource[i].end ?
(unsigned long long)(end - start) + 1 : 0);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing: Expose CPU physical addresses (resource values) for PCI devices
2016-05-11 19:06 [PATCH] tracing: Expose CPU physical addresses (resource values) for PCI devices Bjorn Helgaas
@ 2016-06-17 21:59 ` Steven Rostedt
2016-06-17 22:23 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2016-06-17 21:59 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, karol herbst, linux-kernel, Pekka Paalanen,
Ingo Molnar, Ben Skeggs, Yinghai Lu, koriakin, linuxppc-dev
Sorry for the late reply, this patch got pushed down in my INBOX.
Could I get someone from PPC to review this patch, just to be safe?
Thanks!
-- Steve
On Wed, 11 May 2016 14:06:57 -0500
Bjorn Helgaas <bhelgaas@google.com> wrote:
> Previously, mmio_print_pcidev() put "user" addresses in the trace buffer.
> On most architectures, these are the same as CPU physical addresses, but on
> microblaze, mips, powerpc, and sparc, they may be something else, typically
> a raw BAR value (a bus address as opposed to a CPU address).
>
> Always expose the CPU physical address to avoid this arch-dependent
> behavior.
>
> This change should have no user-visible effect because this file currently
> depends on CONFIG_HAVE_MMIOTRACE_SUPPORT, which is only defined for x86,
> and pci_resource_to_user() is a no-op on x86.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> kernel/trace/trace_mmiotrace.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
> index 68f376c..cd7480d 100644
> --- a/kernel/trace/trace_mmiotrace.c
> +++ b/kernel/trace/trace_mmiotrace.c
> @@ -68,19 +68,15 @@ static void mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
> trace_seq_printf(s, "PCIDEV %02x%02x %04x%04x %x",
> dev->bus->number, dev->devfn,
> dev->vendor, dev->device, dev->irq);
> - /*
> - * 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);
> + start = dev->resource[i].start;
> trace_seq_printf(s, " %llx",
> (unsigned long long)(start |
> (dev->resource[i].flags & PCI_REGION_FLAG_MASK)));
> }
> for (i = 0; i < 7; i++) {
> - pci_resource_to_user(dev, i, &dev->resource[i], &start, &end);
> + start = dev->resource[i].start;
> + end = dev->resource[i].end;
> trace_seq_printf(s, " %llx",
> dev->resource[i].start < dev->resource[i].end ?
> (unsigned long long)(end - start) + 1 : 0);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing: Expose CPU physical addresses (resource values) for PCI devices
2016-06-17 21:59 ` Steven Rostedt
@ 2016-06-17 22:23 ` Benjamin Herrenschmidt
2016-06-20 13:56 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2016-06-17 22:23 UTC (permalink / raw)
To: Steven Rostedt, Bjorn Helgaas
Cc: linux-pci, karol herbst, linux-kernel, linuxppc-dev,
Pekka Paalanen, Ingo Molnar, Ben Skeggs, Yinghai Lu, koriakin
On Fri, 2016-06-17 at 17:59 -0400, Steven Rostedt wrote:
> Sorry for the late reply, this patch got pushed down in my INBOX.
>
> Could I get someone from PPC to review this patch, just to be safe?
The patch makes sense, I can try getting somebody onto porting
mmiotrace one of these days.
Cheers,
Ben.
> Thanks!
>
> -- Steve
>
>
>
> On Wed, 11 May 2016 14:06:57 -0500
> Bjorn Helgaas <bhelgaas@google.com> wrote:
>
> > Previously, mmio_print_pcidev() put "user" addresses in the trace
> > buffer.
> > On most architectures, these are the same as CPU physical
> > addresses, but on
> > microblaze, mips, powerpc, and sparc, they may be something else,
> > typically
> > a raw BAR value (a bus address as opposed to a CPU address).
> >
> > Always expose the CPU physical address to avoid this arch-dependent
> > behavior.
> >
> > This change should have no user-visible effect because this file
> > currently
> > depends on CONFIG_HAVE_MMIOTRACE_SUPPORT, which is only defined for
> > x86,
> > and pci_resource_to_user() is a no-op on x86.
> >
> > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> > ---
> > kernel/trace/trace_mmiotrace.c | 10 +++-------
> > 1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/kernel/trace/trace_mmiotrace.c
> > b/kernel/trace/trace_mmiotrace.c
> > index 68f376c..cd7480d 100644
> > --- a/kernel/trace/trace_mmiotrace.c
> > +++ b/kernel/trace/trace_mmiotrace.c
> > @@ -68,19 +68,15 @@ static void mmio_print_pcidev(struct trace_seq
> > *s, const struct pci_dev *dev)
> > trace_seq_printf(s, "PCIDEV %02x%02x %04x%04x %x",
> > dev->bus->number, dev->devfn,
> > dev->vendor, dev->device, dev->irq);
> > - /*
> > - * 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);
> > + start = dev->resource[i].start;
> > trace_seq_printf(s, " %llx",
> > (unsigned long long)(start |
> > (dev->resource[i].flags &
> > PCI_REGION_FLAG_MASK)));
> > }
> > for (i = 0; i < 7; i++) {
> > - pci_resource_to_user(dev, i, &dev->resource[i],
> > &start, &end);
> > + start = dev->resource[i].start;
> > + end = dev->resource[i].end;
> > trace_seq_printf(s, " %llx",
> > dev->resource[i].start < dev-
> > >resource[i].end ?
> > (unsigned long long)(end - start) + 1 :
> > 0);
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tracing: Expose CPU physical addresses (resource values) for PCI devices
2016-06-17 22:23 ` Benjamin Herrenschmidt
@ 2016-06-20 13:56 ` Steven Rostedt
0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2016-06-20 13:56 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Bjorn Helgaas, linux-pci, karol herbst, linux-kernel,
linuxppc-dev, Pekka Paalanen, Ingo Molnar, Ben Skeggs,
Yinghai Lu, koriakin
On Sat, 18 Jun 2016 08:23:23 +1000
Benjamin Herrenschmidt <benh@au1.ibm.com> wrote:
> On Fri, 2016-06-17 at 17:59 -0400, Steven Rostedt wrote:
> > Sorry for the late reply, this patch got pushed down in my INBOX.
> >
> > Could I get someone from PPC to review this patch, just to be safe?
>
> The patch makes sense, I can try getting somebody onto porting
> mmiotrace one of these days.
>
OK, thanks!
I'll pull this into my for-next repo then.
-- Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-20 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 19:06 [PATCH] tracing: Expose CPU physical addresses (resource values) for PCI devices Bjorn Helgaas
2016-06-17 21:59 ` Steven Rostedt
2016-06-17 22:23 ` Benjamin Herrenschmidt
2016-06-20 13:56 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®