Re: [PATCH] parse the power budgeting table

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

 



Le 06/08/2011 12:55, Matthew Wilcox a écrit :
On Sat, Aug 06, 2011 at 10:27:02AM +0200, martin.peres@xxxxxxxxxxxxxxx wrote:
+  i = 0;
+  do {
+    pci_write_byte(d->dev, where + PCI_PWR_DSR, i);
+
+    w = pci_read_word(d->dev, where + PCI_PWR_DATA);

The problem with this is that it's racy.  If a device driver is accessing
the power budget capability at the same time lspci accesses it, the
driver could get the wrong numbers.  (lspci could too, but that's way
less important).
Right, this is racy.

Now, we don't have any device drivers accessing this capability
yet.  If we can persuade the first one who tries it to use some
centralised API to access it, we can throw in the necessary calls to
pci_block_user_cfg_access().
That's a good proposition. Another one, quite simple, is to read this table before the device's driver is loaded. Then, we would need to give this information back to the userspace and kernel.

What do you think about it?


It'd be great if we can get started on that ... does anyone have
a device driver in mind that could benefit from reading the power
budgeting capability?

I'm working on Nouveau, on power management. I was reading some docs on power budgetting and decided to have a look at what my cards would advertise. This is why I wrote this patch for lspci.

I still need to make more sense of the values read by my card but this is another matter.

Anyway, I don't see any reason to read the PB table from the nouveau device driver. IMHO, I think this information is for end-users. This doesn't mean we shouldn't fix this issue.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux