Re: [PATCH] pm8001: enhance firmware event log retrieval

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

 



No testing, I agreed on the appearance, make excellent sense and can see no problem with it. I have NOT tested it (Xyratex has no interest in 32-bit systems, this turns into a one-of with no Q/A backing). I will put it in my own queue for testing and submit a fix if I feel it is necessary (my WAG on risk of that is 0.000234% ;-/ )

Sincerely -- Mark Salyzyn

On Feb 20, 2012, at 11:04 AM, Mark Salyzyn wrote:

> Thanks James!
> 
> Sincerely -- Mark Salyzyn
> 
> On Feb 19, 2012, at 1:55 AM, jack_wang wrote:
> 
>> James,
>> 
>> Thanks for fix, looks OK for me.
>> 
>> 
>> 
>> --------------
>> jack_wang
>>> On Wed, 2012-01-18 at 10:48 -0500, Mark Salyzyn wrote:
>>>> -static ssize_t pm8001_ctl_aap_log_show(struct device *cdev,
>>>> -	struct device_attribute *attr, char *buf)
>>>> +static ssize_t pm8001_ctl_log_show(struct device *cdev, char *buf, int ind)
>>>> {
>>>> 	struct Scsi_Host *shost = class_to_shost(cdev);
>>>> 	struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
>>>> 	struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
>>>> +	struct eventlog_entry entry;
>>>> +	char *str = buf;
>>>> 	int i;
>>>> -#define AAP1_MEMMAP(r, c) \
>>>> -	(*(u32 *)((u8*)pm8001_ha->memoryMap.region[AAP1].virt_ptr + (r) * 32 \
>>>> -	+ (c)))
>>>> 
>>>> -	char *str = buf;
>>>> -	int max = 2;
>>>> -	for (i = 0; i < max; i++) {
>>>> -		str += sprintf(str, "0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x"
>>>> -			       "0x%08x 0x%08x\n",
>>>> -			       AAP1_MEMMAP(i, 0),
>>>> -			       AAP1_MEMMAP(i, 4),
>>>> -			       AAP1_MEMMAP(i, 8),
>>>> -			       AAP1_MEMMAP(i, 12),
>>>> -			       AAP1_MEMMAP(i, 16),
>>>> -			       AAP1_MEMMAP(i, 20),
>>>> -			       AAP1_MEMMAP(i, 24),
>>>> -			       AAP1_MEMMAP(i, 28));
>>>> +	memset(&entry, 0, sizeof(entry));
>>>> +	do {
>>>> +		i = pm8001_readlog(
>>>> +			(struct eventlog_header *)(
>>>> +				pm8001_ha->memoryMap.region[ind].virt_ptr),
>>>> +			&entry,
>>>> +			(ind == AAP1) ?
>>>> +				&pm8001_ha->aap1_consumer :
>>>> +				&pm8001_ha->iop_consumer);
>>>> +	} while ((i == 0) && !pm8001_validlog(&entry));
>>>> +	if ((i >= 0) && pm8001_validlog(&entry)) {
>>>> +		u32 *lp;
>>>> +		unsigned long long timestamp =
>>>> +			(((unsigned long long)entry.timestamp_upper) << 32) |
>>>> +			entry.timestamp_lower;
>>>> +		str += snprintf(str, PAGE_SIZE - (str - buf),
>>>> +			"%u %llu.%09llu %u",
>>>> +			entry.severity,
>>>> +			timestamp / (1000000000 / 8),
>>>> +			(timestamp % (1000000000 / 8)) * 8,
>>>> +			entry.sequence);
>>> 
>>> You can't do this.  It produces this error on a 32 bit compile:
>>> 
>>> MODPOST 1540 modules
>>> ERROR: "__udivdi3" [drivers/scsi/pm8001/pm8001.ko] undefined!
>>> ERROR: "__umoddi3" [drivers/scsi/pm8001/pm8001.ko] undefined!
>>> make[1]: *** [__modpost] Error 1
>>> make: *** [drivers/scsi/pm8001/pm8001.ko] Error 2
>>> 
>>> because the compiler can't natively do 64 bit division.
>>> 
>>> The fix is something like this (compile tested only)
>>> 
>>> James
>>> 
>>> ---
>>> 
>>> diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
>>> index 3fe3d93..0edfe86 100644
>>> --- a/drivers/scsi/pm8001/pm8001_ctl.c
>>> +++ b/drivers/scsi/pm8001/pm8001_ctl.c
>>> @@ -335,12 +335,13 @@ static ssize_t pm8001_ctl_log_show(struct device *cdev, char *buf, int ind)
>>> 		u32 *lp;
>>> 		unsigned long long timestamp =
>>> 			(((unsigned long long)entry.timestamp_upper) << 32) |
>>> -			entry.timestamp_lower;
>>> +			entry.timestamp_lower, remainder;
>>> +		remainder = do_div(timestamp, 1000000000 / 8) * 8;
>>> 		str += snprintf(str, PAGE_SIZE - (str - buf),
>>> 			"%u %llu.%09llu %u",
>>> 			entry.severity,
>>> -			timestamp / (1000000000 / 8),
>>> -			(timestamp % (1000000000 / 8)) * 8,
>>> +			timestamp,
>>> +			remainder,
>>> 			entry.sequence);
>>> 		for (lp = entry.log, i = entry.size; i > 0; --i)
>>> 			str += snprintf(str, PAGE_SIZE - (str - buf),
>>> 
>>> 
>>> __________ Information from ESET NOD32 Antivirus, version of virus signature database 5659 (20101129) __________
>>> 
>>> The message was checked by ESET NOD32 Antivirus.
>>> 
>>> http://www.eset.com
>>> 
>>> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux