[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] printf formatter for pci_sbdf_t


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 17 Jul 2019 16:08:10 +0200
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@xxxxxxxxxx; spf=Pass smtp.mailfrom=roger.pau@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>
  • Delivery-date: Wed, 17 Jul 2019 14:08:29 +0000
  • Ironport-sdr: I6Peqi8BYKTdhrZcaZspr+gPZAC0p/WrekzqpqUwjfop9fZ6WZWjVJM4sdG64qiDDR5jyTK4cB DUbL91NGaQx89X/xT8Tr0Q8NtcP044swUEzYMMjm+A5qr7sueRikSIvasBCUlgeaJRB/OoAuvP mjQmj4stTWAw7wOgl21I0STKLm3BOyaYctl0lfi5KEYpPN3qNDiez5jibnHFaBJjVoIW/8olhB 44/SNKKKccBX3aFDmh3jyXNVMbc74JWdWdo3oBVzFrZdOAlPsWrdRzHuqjc0fsIneMBgydpvtA bZg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hello,

As part of some PCI related cleanup I'm doing, which includes
expanding the usage of pci_sbdf_t, I'm also planning to add a custom
printf formatter for pci_sbdf_t [0], so that a SBDF can be printed
without having to specify four formatters (and pass four parameters)
each time (%04x:%02x:%02x.%u).

There's been some debate on the previous version about whether the
formatter should be %pp or %op, and I would like to settle on one of
them before sending a new version:

Using %pp pros:
 - Xen already overloads p with other custom implementations.

Using %pp cons:
 - Passes a pointer (which is always 64b on x86) to store a
   32bit value (SBDF).
 - Requires a dereference to access the value.

Using %op pros:
 - Can pass a 32bit integer naturally.

Using %op cons:
 - No other overloads of the o specifier exists so far, either in Xen
   or in Linux AFAIK.

My first implementation used %pp because it's inline with the current
overloads already present, and printk not being performance critical I
don't see much problem in using 64bit to pass a 32bit value, or in
requiring a dereference to access it. We could keep using %pp and
casting the sbdf value to 'void *' to avoid the dereference, but I
don't think there's much value on doing that, the more that call sites
would need to use a macro to hide the casting away.

Anyway, I would like to get some consensus on which path to follow,
either %pp or %op before sending a new version of the series. I'm
Ccing both Andrew and Jan as they had strong opinions, and I would
personally vote for %pp as I've expressed above, but don't mind
implementing something else as long as there's consensus and it's not
going to get stuck on an endless argument.

Thanks, Roger.

[0] 
https://patchew.org/Xen/20190510161056.48648-1-roger.pau@xxxxxxxxxx/20190510161056.48648-5-roger.pau@xxxxxxxxxx/

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.