qla4xxx: Capture minidump for ISP82XX on firmware failure
Looks like my earlier email fails to go on scsi-liist. Resending email.
From: Vikas <[email protected]> Date: Thu, 3 May 2012 04:30:11 -0700 To: Mike Christie <[email protected]>
Cc: "[email protected]" <[email protected]>, scsi <[email protected]>, Lalit Chandivade <[email protected]>, Ravi Anand <[email protected]>, Tej Parkash <[email protected]>, Shyam Sundar <[email protected]>
Subject: Re: [PATCH 5/6] qla4xxx: Capture minidump for ISP82XX on firmware failure
Quoted 108 lines
-----Original Message-----
From: Mike Christie <[email protected]>
Date: Fri, 27 Apr 2012 09:05:15 -0700
To: Vikas <[email protected]>
Cc: "[email protected]" <[email protected]>, scsi <[email protected]>, Lalit Chandivade <[email protected]>, Ravi Anand <[email protected]>, Tej Parkash <[email protected]>, Shyam Sundar <[email protected]>
Subject: Re: [PATCH 5/6] qla4xxx: Capture minidump for ISP82XX on firmware failureQuoted 15 lines · On 04/24/2012 12:32 AM, [email protected] wrote:
Quoted 14 lines
(quoted diff) +3
-0+ +static ssize_t +qla4_8xxx_sysfs_write_fw_dump(struct file *filep, struct kobject*kobj,
(quoted diff) +4
-0+ struct bin_attribute *ba, char *buf, loff_t off, + size_t count) +{ + struct scsi_qla_host *ha =to_qla_host(dev_to_shost(container_of(kobj,
(quoted diff) +5
-0+ struct device, kobj))); + uint32_t dev_state; + int reading; + + if (!is_qla8022(ha))Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ return -EINVAL; + + if (off != 0) + return 0; + + reading = simple_strtol(buf, NULL, 10);I think we are supposed to be using kstrtol now.
We tried using kstrtol but most of times we found kstrtol return error.
We added following patch to debug this issue:-
drivers/scsi/qla4xxx/ql4_attr.c +2
-1@@ -35,7 +35,8 @@ qla4_8xxx_sysfs_write_fw_dump(struct file *filep,struct kobject *kobj, struct scsi_qla_host *ha =to_qla_host (dev_to_shost (container_of (kobj, struct device, kobj)));uint32_t dev_state; -int reading; +long reading; +int read, ret;if (is_qla40XX(ha)) return -EINVAL;drivers/scsi/qla4xxx/ql4_attr.c +14
-1@@ -43,7 +44,20 @@ qla4_8xxx_sysfs_write_fw_dump(struct file *filep, struct kobject *kobj, if (off != 0) return 0; - reading =simple_strtol (buf,NULL ,10 ); +printk ("------------------------------------------\n" ); +ql4_printk (KERN_INFO , ha,"Buf = %s\n" , buf); +printk ("------------------------------------------\n" ); + read =simple_strtol (buf,NULL ,10 ); +ql4_printk (KERN_INFO , ha,"simple strtol val = %d\n" , read); + ret =kstrtol (buf,10 , &reading); +if (ret) { +ql4_printk (KERN_INFO , ha,"\nError %d\n" , ret); +ql4_printk (KERN_INFO , ha,"Error Converted Val %ld\n" , reading); +return ret; + } +ql4_printk (KERN_INFO , ha,"kstrtol val = %ld\n" , reading); +return count; +switch (reading) { case 0: /* clear dump collection flags */----
When we do:
# echo 6 > /sys/class/scsi_host/host7/device/fw_dump We get following result for this patch:- -------------------------------------------------------------------------- ---------------------------------------------------- May 3 16:45:59 magana kernel: ------------------------------------------ May 3 16:45:59 magana kernel: qla4xxx 0000:18:00.4: Buf = 6./../../host7 May 3 16:45:59 magana kernel: ------------------------------------------ May 3 16:45:59 magana kernel: qla4xxx 0000:18:00.4: simple strtol val = 6 May 3 16:45:59 magana kernel: qla4xxx 0000:18:00.4: May 3 16:45:59 magana kernel: Error -22 May 3 16:45:59 magana kernel: qla4xxx 0000:18:00.4: Error Converted Val -2129482613--------------------------------------------------------------------------
----------------------------------------------------From above logs looks like sysfs attribute reading some extra garbage characters because of which
'kstrtol()' fails but in same case 'simple_strtol()' works fine.Do you have any idea why we are getting some garbage characters from sysfs attribute?
Quoted 7 lines
Can you please accept this patch with '
simple_strtol()' till this issue get fixed.
Once it is fix we will update the patch.Thanks,
Vikas.
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.
Quoted 1 line · Vikas Chaudhary
Quoted 1 line
# echo 6 > /sys/class/scsi_host/host7/device/fw_dump
echo adds a newline by default. If you do echo -n it does not.
Does simple_strtol handle that but kstrol not handle it?
Quoted 4 lines
Quoted 4 lines
From above logs looks like sysfs attribute reading some extra garbage
Quoted 3 lines
characters because of which
'kstrtol()' fails but in same case 'simple_strtol()' works fine.
-----Original Message-----
From: Mike Christie <[email protected]>
Date: Fri, 4 May 2012 03:17:36 -0700
To: Admin <[email protected]>
Cc: "[email protected]" <[email protected]>, scsi <[email protected]>, Lalit Chandivade <[email protected]>, Ravi Anand <[email protected]>, Tej Parkash <[email protected]>, Shyam Sundar <[email protected]>
Subject: Re: [PATCH 5/6] qla4xxx: Capture minidump for ISP82XX on firmware failure
Quoted 4 lines · Vikas Chaudhary
Quoted 1 line
Quoted 1 line
# echo 6 > /sys/class/scsi_host/host7/device/fw_dumpecho adds a newline by default. If you do echo -n it does not.
I tried with 'echo -n' I am still getting garbage data from sysfs attribute.
Quoted 2 lines
Does
simple_strtolhandle that but kstrol not handle it?
Yes, simple_strtol handle this case.
Here are logs:
May 4 16:01:01 magana kernel: ------------------------------------------ May 4 16:01:01 magana kernel: qla4xxx 0000:18:00.5: Buf = 4./../../host12 <-- garbage data from sysfs attribute May 4 16:01:01 magana kernel: ------------------------------------------ May 4 16:01:01 magana kernel: qla4xxx 0000:18:00.5: simple strtol val = 4 <-- simple_strtol return correct value May 4 16:01:01 magana kernel: qla4xxx 0000:18:00.5: May 4 16:01:01 magana kernel: Error -22 <-- error from kstrol May 4 16:01:01 magana kernel: qla4xxx 0000:18:00.5: Error Converted Val
-2129482613
This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.