From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758089AbcEFKQR (ORCPT ); Fri, 6 May 2016 06:16:17 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:36338 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbcEFKQQ (ORCPT ); Fri, 6 May 2016 06:16:16 -0400 Date: Fri, 6 May 2016 13:16:04 +0300 From: Pekka Paalanen To: Bjorn Helgaas Cc: Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Yinghai Lu , karolherbst@gmail.com, Ben Skeggs , koriakin@0x04.net Subject: Re: ftrace use of pci_resource_to_user() Message-ID: <20160506131604.0067718f@eldfell> In-Reply-To: <20160504191713.GA3117@localhost> References: <20160504191713.GA3117@localhost> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/+V.bfQf81U9zm8JITPga_k."; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/+V.bfQf81U9zm8JITPga_k. Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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(): >=20 > +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 bas= ed on > + * these printed values? > + */ > + for (i =3D 0; i < 7; i++) { > + pci_resource_to_user(dev, i, &dev->resource[i], &start,= &end); > + ret +=3D trace_seq_printf(s, " %llx", > + (unsigned long long)(start | > + (dev->resource[i].flags & PCI_REGION_FLAG_MASK)= )); > + } >=20 > I think it was a mistake to use pci_resource_to_user() here because it > adds unnecessary arch dependencies in whatever consumes this output. >=20 > 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. >=20 > 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/.... >=20 > 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. >=20 > 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 --Sig_/+V.bfQf81U9zm8JITPga_k. Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUBVyxu6yNf5bQRqqqnAQiZkxAAq0YEAZSI+n9/ppw+ZvYHCwKYv/imZVbB Y5IWCh2v96TVqeOZNX78bNU5wAB5AVBYTPaQsd5/pWjFSB75JCoOGiPufBc5jFIB WdCKdTOyKomC3xmv7dzoljeDaEgK0IMcF3mJKS+BvrkTyjmP/myHVk9YwAz8hGZ6 HHC0NftQFG0i6fL2SN79J5M2ZJ5ecRVAMbkVyfkW1p2ry1yKiqdgNOARDAeBtWmk XEVjoNxEh9TUghvpOSnB1gO7FkfHCHab+QFI434m/oF4mKh5AMOho8UjglgAmK6a LnhnFKyekGzHTIUVW0HfqCFBVl7FmiEfamMaXQsBsGXfzBSpeAlllnqh8zBSsNt2 d5MGgV8i/68hTlcRivJD/usOv7DYSz3nGZmSriIXEBLkFX6EQqXzB1kF0vSGSSND +gOo0X4EksYhzQCcTQO0gTqMdSzjLio9ugz8eB2jhbmkQGL8a3qO4ZMmSLqxsVO4 QkV/Vw4gci4E0y4FnPA8lA0pmfsDALic7zec3sy4THB3FUJ81LpY9KrpeQtVyM5j XCFtLPM2eE6UpOdX5/yQStPOPmwpXWVSPLEQuXyJXAgmzARGez1b5e2G/wrRHc4p sRoE55FhcSEbH2KOirtp6vaCPk0HyUNb6JvfCkARZVjMfx7Clt7emSJ8qCBbJZYH e9CBVupkAWM= =SeFh -----END PGP SIGNATURE----- --Sig_/+V.bfQf81U9zm8JITPga_k.--