public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Guo <ggang@tilera.com>
To: Xiangliang Yu <yuxiangl@marvell.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"JBottomley@parallels.com" <JBottomley@parallels.com>
Subject: Re: [PATCH] [SCSI] mvsas: Fix the kernel panic due to unaligned data access
Date: Mon, 10 Jun 2013 00:31:54 +0800	[thread overview]
Message-ID: <51B4ADFA.5@tilera.com> (raw)
In-Reply-To: <F766E4F80769BD478052FB6533FA745D3ED4419C13@SC-VEXCH4.marvell.com>

Xiangliang,

I do not have a chance to test on x86 now. Not sure whether
I can find an available environment for x86 testing.
But this change is so simple and in theory it is harmless
to x86. For architectures which do need aligned data access,
they should have the same symptom as arch/tile.

Thanks,
Paul


> Hi, Paul
> Do you have tested it on X86 or arm? If work fine, I agree with it.
> 
> 
>> -----Original Message-----
>> From: Paul Guo [mailto:ggang@tilera.com]
>> Sent: 2013年6月9日 15:13
>> To: Xiangliang Yu; linux-scsi@vger.kernel.org
>> Cc: JBottomley@Parallels.com
>> Subject: Re: [PATCH] [SCSI] mvsas: Fix the kernel panic due to unaligned data
>> access
>>
>> Ping. Anyone who knows the driver please speak up, either yes or no
>> or need more info. This is a really small fix.
>>
>> Thanks,
>> Paul
>>
>>> It's easy to find the address and symbol that causes the unalignd data
>>> access according to the stack dump information. The following small
>>> patch will fix it.
>>>
>>> This change is harmless for platforms (like x86/x64) which support
>>> unaligned data access but is critical for platforms those do not support
>>> unaligned data access (like our platform: arch/tile).
>>>
>>> I sent the patch but did not ping the status. I sync-up the workspace
>>> and re-generate the patch again. Feel free to give me any feedback. It's
>>> really annoying to maintain the change internally.
>>>
>>> Thanks,
>>> Paul
>>>
>>>
>>> Signed-off-by: Paul Guo <ggang@tilera.com>
>>> ---
>>>  drivers/scsi/mvsas/mv_sas.c |    5 +++--
>>>  drivers/scsi/mvsas/mv_sas.h |    1 +
>>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
>>> index fd3b283..18e133e 100644
>>> --- a/drivers/scsi/mvsas/mv_sas.c
>>> +++ b/drivers/scsi/mvsas/mv_sas.c
>>> @@ -1852,10 +1852,11 @@ int mvs_slot_complete(struct mvs_info *mvi, u32
>> rx_desc, u32 flags)
>>>     }
>>>
>>>     /* error info record present */
>>> -   if (unlikely((rx_desc & RXQ_ERR) && (*(u64 *) slot->response))) {
>>> +   if (unlikely((rx_desc & RXQ_ERR) &&
>>> +                 get_unaligned_le64((u64 *) slot->response))) {
>>>             mv_dprintk("port %d slot %d rx_desc %X has error info"
>>>                     "%016llX.\n", slot->port->sas_port.id, slot_idx,
>>> -                    rx_desc, (u64)(*(u64 *)slot->response));
>>> +                    rx_desc, get_unaligned_le64((u64 *) slot->response));
>>>             tstat->stat = mvs_slot_err(mvi, task, slot_idx);
>>>             tstat->resp = SAS_TASK_COMPLETE;
>>>             goto out;
>>> diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h
>>> index c04a4f5..c89c145 100644
>>> --- a/drivers/scsi/mvsas/mv_sas.h
>>> +++ b/drivers/scsi/mvsas/mv_sas.h
>>> @@ -39,6 +39,7 @@
>>>  #include <linux/irq.h>
>>>  #include <linux/slab.h>
>>>  #include <linux/vmalloc.h>
>>> +#include <linux/unaligned.h>
>>>  #include <scsi/libsas.h>
>>>  #include <scsi/scsi.h>
>>>  #include <scsi/scsi_tcq.h>
>>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-06-09 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08  7:01 [SCSI] mvsas: Fix the kernel panic due to unaligned data access Paul Guo
2013-06-09  7:12 ` [PATCH] " Paul Guo
     [not found]   ` <F766E4F80769BD478052FB6533FA745D3ED4419C13@SC-VEXCH4.marvell.com>
2013-06-09 16:31     ` Paul Guo [this message]
2013-06-09 16:23 ` James Bottomley
2013-06-18  9:50   ` Paul Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B4ADFA.5@tilera.com \
    --to=ggang@tilera.com \
    --cc=JBottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=yuxiangl@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox