Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH 14/22] parisc: %pF is only for function pointers
       [not found] <1426130037-17956-1-git-send-email-scottwood@freescale.com>
@ 2015-03-12  3:13 ` Scott Wood
  2015-03-12 12:11   ` James Bottomley
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2015-03-12  3:13 UTC (permalink / raw)
  To: trivial, linux-kernel; +Cc: Scott Wood, linux-parisc

Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.  Even on
other architectures, refrain from setting a bad example that people
copy.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: linux-parisc@vger.kernel.org
---
 drivers/parisc/superio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c
index 8be2096..38c5440 100644
--- a/drivers/parisc/superio.c
+++ b/drivers/parisc/superio.c
@@ -348,7 +348,7 @@ int superio_fixup_irq(struct pci_dev *pcidev)
 		BUG();
 		return -1;
 	}
-	printk("superio_fixup_irq(%s) ven 0x%x dev 0x%x from %pf\n",
+	printk("superio_fixup_irq(%s) ven 0x%x dev 0x%x from %ps\n",
 		pci_name(pcidev),
 		pcidev->vendor, pcidev->device,
 		__builtin_return_address(0));
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 14/22] parisc: %pF is only for function pointers
  2015-03-12  3:13 ` [PATCH 14/22] parisc: %pF is only for function pointers Scott Wood
@ 2015-03-12 12:11   ` James Bottomley
  2015-03-12 14:43     ` John David Anglin
  2015-03-12 16:14     ` Scott Wood
  0 siblings, 2 replies; 6+ messages in thread
From: James Bottomley @ 2015-03-12 12:11 UTC (permalink / raw)
  To: Scott Wood; +Cc: trivial, linux-kernel, linux-parisc

On Wed, 2015-03-11 at 22:13 -0500, Scott Wood wrote:
> Use %pS for actual addresses, otherwise you'll get bad output
> on arches like ppc64 where %pF expects a function descriptor.  Even on
> other architectures, refrain from setting a bad example that people
> copy.

Are you sure about this?  Parisc64 is a function description
architecture.  There may be a misunderstanding about what
__builtin_return_address(0) is supposed to return, but I'm certain the
person who added the code thought it returned a function pointer, which
on parisc64 would be a descriptor.

James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 14/22] parisc: %pF is only for function pointers
  2015-03-12 12:11   ` James Bottomley
@ 2015-03-12 14:43     ` John David Anglin
  2015-03-12 16:14     ` Scott Wood
  1 sibling, 0 replies; 6+ messages in thread
From: John David Anglin @ 2015-03-12 14:43 UTC (permalink / raw)
  To: James Bottomley, Scott Wood; +Cc: trivial, linux-kernel, linux-parisc

On 2015-03-12 8:11 AM, James Bottomley wrote:
> On Wed, 2015-03-11 at 22:13 -0500, Scott Wood wrote:
>> Use %pS for actual addresses, otherwise you'll get bad output
>> on arches like ppc64 where %pF expects a function descriptor.  Even on
>> other architectures, refrain from setting a bad example that people
>> copy.
> Are you sure about this?  Parisc64 is a function description
> architecture.  There may be a misunderstanding about what
> __builtin_return_address(0) is supposed to return, but I'm certain the
> person who added the code thought it returned a function pointer, which
> on parisc64 would be a descriptor.

__builtin_return_address(0) returns the return address in the calling procedure
ignoring import/export stubs.  There are no function descriptors for return addresses.
Thus, it can't return a function pointer.

There are no function descriptors in 32-bit parisc when the -mfast-indirect-calls
compiler option is used.

This option used to be used for 64-bit kernel builds but this broke when the
-mfast-indirect-calls was fixed for user space (gcl uses it).  I worked a bit
on trying to eliminate function descriptors from the 64-bit kernel for performance
but I don't have a working change.

Dave

-- 
John David Anglin  dave.anglin@bell.net


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 14/22] parisc: %pF is only for function pointers
  2015-03-12 12:11   ` James Bottomley
  2015-03-12 14:43     ` John David Anglin
@ 2015-03-12 16:14     ` Scott Wood
  2015-03-12 18:04       ` James Bottomley
  1 sibling, 1 reply; 6+ messages in thread
From: Scott Wood @ 2015-03-12 16:14 UTC (permalink / raw)
  To: James Bottomley; +Cc: trivial, linux-kernel, linux-parisc

On Thu, 2015-03-12 at 08:11 -0400, James Bottomley wrote:
> On Wed, 2015-03-11 at 22:13 -0500, Scott Wood wrote:
> > Use %pS for actual addresses, otherwise you'll get bad output
> > on arches like ppc64 where %pF expects a function descriptor.  Even on
> > other architectures, refrain from setting a bad example that people
> > copy.
> 
> Are you sure about this?  Parisc64 is a function description
> architecture.  There may be a misunderstanding about what
> __builtin_return_address(0) is supposed to return, but I'm certain the
> person who added the code thought it returned a function pointer, which
> on parisc64 would be a descriptor.

I wasn't aware that parisc64 used descriptors, but I don't see how you'd
get one out of __builtin_return_address(0) since it's not usually a
function entry point (plus, GCC documents it as returning void *).

-Scott

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 14/22] parisc: %pF is only for function pointers
  2015-03-12 16:14     ` Scott Wood
@ 2015-03-12 18:04       ` James Bottomley
  2015-03-12 19:48         ` Aaro Koskinen
  0 siblings, 1 reply; 6+ messages in thread
From: James Bottomley @ 2015-03-12 18:04 UTC (permalink / raw)
  To: Scott Wood; +Cc: trivial, linux-kernel, linux-parisc

On Thu, 2015-03-12 at 11:14 -0500, Scott Wood wrote:
> On Thu, 2015-03-12 at 08:11 -0400, James Bottomley wrote:
> > On Wed, 2015-03-11 at 22:13 -0500, Scott Wood wrote:
> > > Use %pS for actual addresses, otherwise you'll get bad output
> > > on arches like ppc64 where %pF expects a function descriptor.  Even on
> > > other architectures, refrain from setting a bad example that people
> > > copy.
> > 
> > Are you sure about this?  Parisc64 is a function description
> > architecture.  There may be a misunderstanding about what
> > __builtin_return_address(0) is supposed to return, but I'm certain the
> > person who added the code thought it returned a function pointer, which
> > on parisc64 would be a descriptor.
> 
> I wasn't aware that parisc64 used descriptors, but I don't see how you'd
> get one out of __builtin_return_address(0) since it's not usually a
> function entry point (plus, GCC documents it as returning void *).

I was more thinking that this message is printed for every boot with a
superio chip (which is a lot of our boxes).  How come no-one has
complained on parisc64 if it's doing the wrong thing.

James



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 14/22] parisc: %pF is only for function pointers
  2015-03-12 18:04       ` James Bottomley
@ 2015-03-12 19:48         ` Aaro Koskinen
  0 siblings, 0 replies; 6+ messages in thread
From: Aaro Koskinen @ 2015-03-12 19:48 UTC (permalink / raw)
  To: James Bottomley; +Cc: Scott Wood, trivial, linux-kernel, linux-parisc

Hi,

On Thu, Mar 12, 2015 at 02:04:41PM -0400, James Bottomley wrote:
> On Thu, 2015-03-12 at 11:14 -0500, Scott Wood wrote:
> > On Thu, 2015-03-12 at 08:11 -0400, James Bottomley wrote:
> > > On Wed, 2015-03-11 at 22:13 -0500, Scott Wood wrote:
> > > > Use %pS for actual addresses, otherwise you'll get bad output
> > > > on arches like ppc64 where %pF expects a function descriptor.  Even on
> > > > other architectures, refrain from setting a bad example that people
> > > > copy.
> > > 
> > > Are you sure about this?  Parisc64 is a function description
> > > architecture.  There may be a misunderstanding about what
> > > __builtin_return_address(0) is supposed to return, but I'm certain the
> > > person who added the code thought it returned a function pointer, which
> > > on parisc64 would be a descriptor.
> > 
> > I wasn't aware that parisc64 used descriptors, but I don't see how you'd
> > get one out of __builtin_return_address(0) since it's not usually a
> > function entry point (plus, GCC documents it as returning void *).
> 
> I was more thinking that this message is printed for every boot with a
> superio chip (which is a lot of our boxes).  How come no-one has
> complained on parisc64 if it's doing the wrong thing.

It's dead code behind #ifdef DEBUG_SUPERIO_INIT.

A.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-12 19:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1426130037-17956-1-git-send-email-scottwood@freescale.com>
2015-03-12  3:13 ` [PATCH 14/22] parisc: %pF is only for function pointers Scott Wood
2015-03-12 12:11   ` James Bottomley
2015-03-12 14:43     ` John David Anglin
2015-03-12 16:14     ` Scott Wood
2015-03-12 18:04       ` James Bottomley
2015-03-12 19:48         ` Aaro Koskinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox