Bug 8698 - fstat May Be Inappropriate For Reading The ROM
Summary: fstat May Be Inappropriate For Reading The ROM
Status: RESOLVED DUPLICATE of bug 13988
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/pciaccess (show other bugs)
Version: 7.1 (2006.05)
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-18 07:56 UTC by Alex Williamson
Modified: 2008-04-03 06:57 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Read the ROM in big chunks (508 bytes, patch)
2006-10-18 08:00 UTC, Alex Williamson
no flags Details | Splinter Review

Description Alex Williamson 2006-10-18 07:56:40 UTC
xf86ReadDomainMemory() currently reads the ROM from sysfs 1 byte at a time. 
I've measured this taking over 20 seconds to complete.  Is there any reason to
read the ROM in such small chunks?  I'll upload a patch that reads in larger
chunks, reducing the ROM read time to about a tenth of a second.
Comment 1 Alex Williamson 2006-10-18 08:00:29 UTC
Created attachment 7458 [details] [review]
Read the ROM in big chunks

This patch significantly reduces the number of reads to load the VGA ROM.  At
least one distribution (SLES10) already includes this patch.
Comment 2 Daniel Stone 2007-02-27 01:34:07 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 3 Adam Jackson 2008-02-24 21:49:24 UTC
Think this is resolved in pciaccess, but let's put it on the tracker to be sure it gets looked at.
Comment 4 David Nusinow 2008-02-27 19:27:00 UTC
This looks good in libpciaccess from what I can tell.

pci_device_linux_sysfs_read_rom reads the whole file in. It gets the size from fstat'ing the file. If it can't open the file via sysfs pci_device_linux_devmem_read_rom gets called to read the ROM, and it just reads the whole ROM in as well via slightly different means.

I'm going to mark this closed. Please reopen if you think I've missed something and this bug isn't really fixed.
Comment 5 Julien Cristau 2008-02-28 00:52:23 UTC
(In reply to comment #4)
> pci_device_linux_sysfs_read_rom reads the whole file in. It gets the size from
> fstat'ing the file. 

i'm not sure that's such a good plan.  at least on my machine, fstat() says the size is 0, while reading from the file works fine.
Comment 6 Alex Deucher 2008-02-28 09:56:42 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > pci_device_linux_sysfs_read_rom reads the whole file in. It gets the size from
> > fstat'ing the file. 
> 
> i'm not sure that's such a good plan.  at least on my machine, fstat() says the
> size is 0, while reading from the file works fine.
> 

I've seen the same behavior.  Seems to vary from card to card.
Comment 7 David Nusinow 2008-02-28 17:07:38 UTC
Ok, I'm reopening this and reassigning it to libpciaccess.
Comment 8 Adam Jackson 2008-02-29 13:49:29 UTC
The 'fstat returns 0 size' thing is a different bug.

*** This bug has been marked as a duplicate of bug 13988 ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.