FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 10-03-2011, 02:11 PM
Martin Sivak
 
Default Wait after udev settles in DD code as usb has hardcoded timeout in kernel module

Related: rhbz#732496
---
loader/hardware.c | 12 ++++++++++--
loader/hardware.h | 7 +++++++
loader/loader.c | 11 ++++++-----
3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/loader/hardware.c b/loader/hardware.c
index 0b19986..0f402bc 100644
--- a/loader/hardware.c
+++ b/loader/hardware.c
@@ -45,7 +45,7 @@
/* boot flags */
extern uint64_t flags;

-static int detectHardware() {
+int detectHardware(int delay) {
int child, rc, status;
int timeout = 0; /* FIXME: commandline option for this */

@@ -100,6 +100,13 @@ static int detectHardware() {
if (rc) {
return LOADER_ERROR;
}
+
+ /*
+ * if delay was requested, give kernel time to process everything
+ * (as an example: usb-storage has an internal delay we need to wait for..)
+ */
+ sleep(delay);
+
return LOADER_OK;
}

@@ -139,6 +146,7 @@ int earlyModuleLoad(int justProbe) {
mlLoadModuleSet(argv[i] + 11);
}
}
+
return 0;
}

@@ -146,5 +154,5 @@ int busProbe(int justProbe) {
/* autodetect whatever we can */
if (justProbe)
return 0;
- return detectHardware();
+ return detectHardware(0);
}
diff --git a/loader/hardware.h b/loader/hardware.h
index 47c34d2..2158784 100644
--- a/loader/hardware.h
+++ b/loader/hardware.h
@@ -23,6 +23,13 @@
#include "modules.h"

int earlyModuleLoad(int justProbe);
+
+/* does explicit hardware detection with configurable delay after
+ udev finishes it's stuff */
+int detectHardware(int delay);
+
+/* legacy hardware detection, checks NO_PROBE flag and if not present
+ calls detectHardware(0); */
int busProbe(int justProbe);

#endif
diff --git a/loader/loader.c b/loader/loader.c
index 33f76ad..c217068 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -78,6 +78,7 @@
#include "modules.h"
#include "moduleinfo.h"

+#include "hardware.h"
#include "driverdisk.h"

/* hardware stuff */
@@ -2150,8 +2151,8 @@ int main(int argc, char ** argv) {
/* Save list of preloaded modules so we can restore the state */
moduleState = mlSaveModuleState();

- /* Load all known devices */
- busProbe(FL_NOPROBE(flags));
+ /* Load all known devices (allow 2s delay for kernel stuff) */
+ if (!FL_NOPROBE(flags)) detectHardware(2);

if (FL_AUTOMODDISK(flags)) {
/* Load all autodetected DDs */
@@ -2195,7 +2196,7 @@ int main(int argc, char ** argv) {

/* Unload all devices and load them again to use the updated modules */
mlRestoreModuleState(moduleState);
- busProbe(FL_NOPROBE(flags));
+ if (!FL_NOPROBE(flags)) detectHardware(2);
}

ddcontinue:
@@ -2224,9 +2225,9 @@ int main(int argc, char ** argv) {
getDDFromSource(&loaderData, "path:/dd.img", moduleState);
}

- /* Reset depmod & modprobe to normal mode and get the rest of drivers*/
+ /* Reset depmod & modprobe to normal mode and get the rest of drivers */
mlFreeModuleState(moduleState);
- busProbe(FL_NOPROBE(flags));
+ if (!FL_NOPROBE(flags)) detectHardware(2);

/* HAL daemon */
if (fork() == 0) {
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-05-2011, 10:15 AM
Ales Kozumplik
 
Default Wait after udev settles in DD code as usb has hardcoded timeout in kernel module

On 10/03/2011 04:11 PM, Martin Sivak wrote:

Related: rhbz#732496
---
loader/hardware.c | 12 ++++++++++--
loader/hardware.h | 7 +++++++
loader/loader.c | 11 ++++++-----
3 files changed, 23 insertions(+), 7 deletions(-)


It seems to me it would be better to split this patch into two parts:

1) the first one gets rid of busProbe. It doesn't do much and the only
remaining places with it after your patch are two calls in driverdisc.c


2) add the timeout magic and use the new parameter as appropriate.

Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-05-2011, 07:47 PM
Chris Lumens
 
Default Wait after udev settles in DD code as usb has hardcoded timeout in kernel module

> @@ -2150,8 +2151,8 @@ int main(int argc, char ** argv) {
> /* Save list of preloaded modules so we can restore the state */
> moduleState = mlSaveModuleState();
>
> - /* Load all known devices */
> - busProbe(FL_NOPROBE(flags));
> + /* Load all known devices (allow 2s delay for kernel stuff) */
> + if (!FL_NOPROBE(flags)) detectHardware(2);
>
> if (FL_AUTOMODDISK(flags)) {
> /* Load all autodetected DDs */

What assurance do we have that this delay will be long enough?

In general, I really dislike adding miscellaneous delays. It doesn't
really solve the underlying problems, just makes us take longer.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:16 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org