Re: Fwd: Re: Kernel panic with 4.16-rc1 (and 4.16-rc2) running selftest

2018-02-26 Thread Khalid Aziz

On 02/23/2018 06:15 PM, Matthew Wilcox wrote:

On Fri, Feb 23, 2018 Randy Dunlap wrote:

[add Matthew Wilcox; hopefully he can look/see]


Thanks, Randy.  I don't understand why nobody else thought to cc the
author of the patch that it was bisected to ...


Sorry, Willy. That was my fault. I should have cc'd you to begin with.



Please try this patch.  It fixes ffe0, but there may be more things
tested that it may not work for.



This patch fixes the problem. I do not see kernel panics with this patch 
any more.


--
Khalid


Chris Mi, what happened to that set of testcases you promised to write
for me?

diff --git a/lib/idr.c b/lib/idr.c
index c98d77fcf393..10d9b8d47c33 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -36,8 +36,8 @@ int idr_alloc_u32(struct idr *idr, void *ptr, u32 *nextid,
  {
struct radix_tree_iter iter;
void __rcu **slot;
-   int base = idr->idr_base;
-   int id = *nextid;
+   unsigned int base = idr->idr_base;
+   unsigned int id = *nextid;
  
  	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))

return -EINVAL;





Re: [Fastboot] Re: [linux-pm] Re: tg3: issue for reboot/kexec

2005-08-18 Thread Khalid Aziz
On Thu, 2005-06-30 at 17:52 -0600, Eric W. Biederman wrote:
 Greg KH [EMAIL PROTECTED] writes:
 
  On Thu, Jun 30, 2005 at 05:21:45PM -0600, Eric W. Biederman wrote:
  However I have gotten feedback a couple of times that
  driver writers tend to prefer using reboot notifiers.  In part
  because shutdown functions don't exist for non-pci devices.
 
  That's a very lame excuse.  All busses should have shutdown functions.
  And any device that is just bypassing all of the existing bus logic is
  still tying into the driver core directly (which is a bad thing by
  itself, but that's a different matter.)  And there's a shutdown method
  there too.
 
  So there is no excuse to not use it.  Please, if they complain, point
  them to me :)
 
 Ok.
 
 Then there is still my complaint and device_shutdown doesn't get called
 on module removal which means it really doesn't get implemented.  Perhaps
 with kexec now being in the mainline kernel this will get better.
 
 Currently I have the following patch outstanding against the e1000
 driver because on reboot on some boxes it card revisions
 it places the card into a sleep state the driver initialization 
 routing cannot get the card out of.
 
 And yes the e1000 is bad and is using a reboot_notifier.
 
 Eric
 
  e1000_main.c |2 +-
  1 files changed, 1 insertion(+), 1 deletion(-)
 
 diff -uNr 
 linux-2.4.29-kexec-apic-virtwire-on-shutdownx86_64/drivers/net/e1000/e1000_main.c
  linux-2.4.29-e1000-no-poweroff-on-reboot/drivers/net/e1000/e1000_main.c
 --- 
 linux-2.4.29-kexec-apic-virtwire-on-shutdownx86_64/drivers/net/e1000/e1000_main.c
Tue Feb 15 14:17:09 2005
 +++ linux-2.4.29-e1000-no-poweroff-on-reboot/drivers/net/e1000/e1000_main.c   
   Wed Feb 16 05:49:00 2005
 @@ -2777,7 +2777,7 @@
 case SYS_POWER_OFF:
 while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) 
 {
 if(pci_dev_driver(pdev) == e1000_driver)
 -   e1000_suspend(pdev, 3);
 +   e1000_suspend(pdev, (event == SYS_DOWN)?0:3);
 }
 }
return NOTIFY_DONE;

I have found that I can not walk reboot_notifier list in all cases
before kexec'ing a new kernel. For instance, when handling INIT on ia64,
we are running in interrupt context and atleast some of the reboot
notifier callbacks call schedule(). Calling schedule() is not gonna work
when we are running in interrupt context. I have the same concern for
when panic gets called in interrupt context. So I added a shutdown
function to e1000 driver instead. Patch is attached. This patch has
worked for me.

As soon as I have all the issues sorted out with kexec'ing on INIT on
ia64, I will post a fully updated kexec patch for ia64. I now have kexec
working solid on INIT with e1000 driver and it can handle multiple back
to back INITs and come up in kexec'd kernel every time. I am now trying
to sort some issues out with tg3 driver (another driver with no shutdown
routine :(

-- 
Khalid


Khalid Aziz   Open Source and Linux Organization
(970)898-9214Hewlett-Packard
[EMAIL PROTECTED]  Fort Collins, CO

The Linux kernel is subject to relentless development 
- Alessandro Rubini
diff -urNp hpte-2.6/drivers/net/e1000/e1000_main.c hpte-2.6.init/drivers/net/e1000/e1000_main.c
--- hpte-2.6/drivers/net/e1000/e1000_main.c	2005-07-08 13:57:55.0 -0600
+++ hpte-2.6.init/drivers/net/e1000/e1000_main.c	2005-07-21 09:42:17.0 -0600
@@ -211,6 +211,7 @@ static void e1000_restore_vlan(struct e1
 
 static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
 static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
+static void e1000_shutdown(struct device *dev);
 #ifdef CONFIG_PM
 static int e1000_resume(struct pci_dev *pdev);
 #endif
@@ -257,6 +258,8 @@ MODULE_PARM_DESC(debug, Debug level (0=
  * loaded. All it does is register with the PCI subsystem.
  **/
 
+#define REBOOT_NOTIFIER	0
+
 static int __init
 e1000_init_module(void)
 {
@@ -266,10 +269,15 @@ e1000_init_module(void)
 
 	printk(KERN_INFO %s\n, e1000_copyright);
 
+#if (!REBOOT_NOTIFIER)
+	e1000_driver.driver.shutdown = e1000_shutdown;
+#endif
 	ret = pci_module_init(e1000_driver);
+#if REBOOT_NOTIFIER
 	if(ret = 0) {
 		register_reboot_notifier(e1000_notifier_reboot);
 	}
+#endif
 	return ret;
 }
 
@@ -285,7 +293,9 @@ module_init(e1000_init_module);
 static void __exit
 e1000_exit_module(void)
 {
+#if REBOOT_NOTIFIER
 	unregister_reboot_notifier(e1000_notifier_reboot);
+#endif
 	pci_unregister_driver(e1000_driver);
 }
 
@@ -3197,6 +3207,71 @@ e1000_suspend(struct pci_dev *pdev, uint
 	return 0;
 }
 
+static void
+e1000_shutdown(struct device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct net_device *netdev = pci_get_drvdata(pdev

Re: [Fastboot] Re: [linux-pm] Re: tg3: issue for reboot/kexec

2005-08-18 Thread Khalid Aziz
On Thu, 2005-08-18 at 12:30 -0600, Khalid Aziz wrote:
 On Thu, 2005-06-30 at 17:52 -0600, Eric W. Biederman wrote:
  Greg KH [EMAIL PROTECTED] writes:
  
   On Thu, Jun 30, 2005 at 05:21:45PM -0600, Eric W. Biederman wrote:
   However I have gotten feedback a couple of times that
   driver writers tend to prefer using reboot notifiers.  In part
   because shutdown functions don't exist for non-pci devices.
  
   That's a very lame excuse.  All busses should have shutdown functions.
   And any device that is just bypassing all of the existing bus logic is
   still tying into the driver core directly (which is a bad thing by
   itself, but that's a different matter.)  And there's a shutdown method
   there too.
  
   So there is no excuse to not use it.  Please, if they complain, point
   them to me :)
  
  Ok.
  
  Then there is still my complaint and device_shutdown doesn't get called
  on module removal which means it really doesn't get implemented.  Perhaps
  with kexec now being in the mainline kernel this will get better.
  
  Currently I have the following patch outstanding against the e1000
  driver because on reboot on some boxes it card revisions
  it places the card into a sleep state the driver initialization 
  routing cannot get the card out of.
  
  And yes the e1000 is bad and is using a reboot_notifier.
  
  Eric
  
   e1000_main.c |2 +-
   1 files changed, 1 insertion(+), 1 deletion(-)
  
  diff -uNr 
  linux-2.4.29-kexec-apic-virtwire-on-shutdownx86_64/drivers/net/e1000/e1000_main.c
   linux-2.4.29-e1000-no-poweroff-on-reboot/drivers/net/e1000/e1000_main.c
  --- 
  linux-2.4.29-kexec-apic-virtwire-on-shutdownx86_64/drivers/net/e1000/e1000_main.c
 Tue Feb 15 14:17:09 2005
  +++ linux-2.4.29-e1000-no-poweroff-on-reboot/drivers/net/e1000/e1000_main.c 
  Wed Feb 16 05:49:00 2005
  @@ -2777,7 +2777,7 @@
  case SYS_POWER_OFF:
  while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, 
  pdev))) {
  if(pci_dev_driver(pdev) == e1000_driver)
  -   e1000_suspend(pdev, 3);
  +   e1000_suspend(pdev, (event == 
  SYS_DOWN)?0:3);
  }
  }
 return NOTIFY_DONE;
 
 I have found that I can not walk reboot_notifier list in all cases
 before kexec'ing a new kernel. For instance, when handling INIT on ia64,
 we are running in interrupt context and atleast some of the reboot
 notifier callbacks call schedule(). Calling schedule() is not gonna work
 when we are running in interrupt context. I have the same concern for
 when panic gets called in interrupt context. So I added a shutdown
 function to e1000 driver instead. Patch is attached. This patch has
 worked for me.
 
 As soon as I have all the issues sorted out with kexec'ing on INIT on
 ia64, I will post a fully updated kexec patch for ia64. I now have kexec
 working solid on INIT with e1000 driver and it can handle multiple back
 to back INITs and come up in kexec'd kernel every time. I am now trying
 to sort some issues out with tg3 driver (another driver with no shutdown
 routine :(
 

Sorry, forgot to remove the last hunk that is already in 2.6.12. Updated
patch attached.

--
Khalid 


Khalid Aziz   Open Source and Linux Organization
(970)898-9214Hewlett-Packard
[EMAIL PROTECTED]  Fort Collins, CO

The Linux kernel is subject to relentless development 
- Alessandro Rubini
diff -urNp hpte-2.6/drivers/net/e1000/e1000_main.c hpte-2.6.init/drivers/net/e1000/e1000_main.c
--- hpte-2.6/drivers/net/e1000/e1000_main.c	2005-07-08 13:57:55.0 -0600
+++ hpte-2.6.init/drivers/net/e1000/e1000_main.c	2005-07-21 09:42:17.0 -0600
@@ -211,6 +211,7 @@ static void e1000_restore_vlan(struct e1
 
 static int e1000_notify_reboot(struct notifier_block *, unsigned long event, void *ptr);
 static int e1000_suspend(struct pci_dev *pdev, uint32_t state);
+static void e1000_shutdown(struct device *dev);
 #ifdef CONFIG_PM
 static int e1000_resume(struct pci_dev *pdev);
 #endif
@@ -257,6 +258,8 @@ MODULE_PARM_DESC(debug, Debug level (0=
  * loaded. All it does is register with the PCI subsystem.
  **/
 
+#define REBOOT_NOTIFIER	0
+
 static int __init
 e1000_init_module(void)
 {
@@ -266,10 +269,15 @@ e1000_init_module(void)
 
 	printk(KERN_INFO %s\n, e1000_copyright);
 
+#if (!REBOOT_NOTIFIER)
+	e1000_driver.driver.shutdown = e1000_shutdown;
+#endif
 	ret = pci_module_init(e1000_driver);
+#if REBOOT_NOTIFIER
 	if(ret = 0) {
 		register_reboot_notifier(e1000_notifier_reboot);
 	}
+#endif
 	return ret;
 }
 
@@ -285,7 +293,9 @@ module_init(e1000_init_module);
 static void __exit
 e1000_exit_module(void)
 {
+#if REBOOT_NOTIFIER
 	unregister_reboot_notifier(e1000_notifier_reboot);
+#endif
 	pci_unregister_driver(e1000_driver);
 }
 
@@ -3197,6

Re: [Fastboot] Re: [linux-pm] Re: tg3: issue for reboot/kexec

2005-08-18 Thread Khalid Aziz
On Thu, 2005-08-18 at 12:42 -0600, Eric W. Biederman wrote:
 Khalid Aziz [EMAIL PROTECTED] writes:
  As soon as I have all the issues sorted out with kexec'ing on INIT on
  ia64, I will post a fully updated kexec patch for ia64. I now have kexec
  working solid on INIT with e1000 driver and it can handle multiple back
  to back INITs and come up in kexec'd kernel every time. I am now trying
  to sort some issues out with tg3 driver (another driver with no shutdown
  routine :(
 
 In the normal case (not kexec on panic) user space should down the interfaces
 before calling kexec.  Is your user space doing that?

Yes, I am down'ing the interface from userspace in normal kexec case,
but that does not happen on INIT on ia64. 

-- 
Khalid


Khalid Aziz   Open Source and Linux Organization
(970)898-9214Hewlett-Packard
[EMAIL PROTECTED]  Fort Collins, CO

The Linux kernel is subject to relentless development 
- Alessandro Rubini

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html