public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.13-rc7 qla2xxx unaligned accesses
@ 2005-08-24  6:21 Keith Owens
  2005-08-24 18:22 ` Andrew Vasquez
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Owens @ 2005-08-24  6:21 UTC (permalink / raw)
  To: linux-kernel

2.6.13-rc7 + kdb on ia64.  The qla2xxx drivers are getting unaligned
accesses at startup.

qla2300 0000:01:02.0: Found an ISP2312, irq 66, iobase 0xc00000080f300000
qla2300 0000:01:02.0: Configuring PCI space...
PCI: slot 0000:01:02.0 has incorrect PCI cache line size of 0 bytes, correcting to 128
qla2300 0000:01:02.0: Configure NVRAM parameters...
qla2300 0000:01:02.0: Verifying loaded RISC code...
qla2300 0000:01:02.0: Waiting for LIP to complete...
qla2300 0000:01:02.0: Cable is unplugged...
scsi1 : qla2xxx
kernel unaligned access to 0xe00000300667800c, ip=0xa0000001005cd0b1
qla2300 0000:01:02.0:
 QLogic Fibre Channel HBA Driver: 8.01.00b5-k
  QLogic QLA2342 -
  ISP2312: PCI (66 MHz) @ 0000:01:02.0 hdma+, host#=1, fw=3.03.15 IPX
ACPI: PCI Interrupt 0000:01:02.1[B]: no GSI
qla2300 0000:01:02.1: Found an ISP2312, irq 67, iobase 0xc00000080f301000
qla2300 0000:01:02.1: Configuring PCI space...
PCI: slot 0000:01:02.1 has incorrect PCI cache line size of 0 bytes, correcting to 128
qla2300 0000:01:02.1: Configure NVRAM parameters...
qla2300 0000:01:02.1: Verifying loaded RISC code...
qla2300 0000:01:02.1: Waiting for LIP to complete...
qla2300 0000:01:02.1: Cable is unplugged...
scsi2 : qla2xxx
kernel unaligned access to 0xe0000030066a400c, ip=0xa0000001005cd0b1
qla2300 0000:01:02.1:
 QLogic Fibre Channel HBA Driver: 8.01.00b5-k
  QLogic QLA2342 -
  ISP2312: PCI (66 MHz) @ 0000:01:02.1 hdma+, host#=2, fw=3.03.15 IPX
ACPI: PCI Interrupt 0000:02:02.0[A]: no GSI
qla2300 0000:02:02.0: Found an ISP2312, irq 63, iobase 0xc00000080fa40000
qla2300 0000:02:02.0: Configuring PCI space...
qla2300 0000:02:02.0: Configure NVRAM parameters...
qla2300 0000:02:02.0: Verifying loaded RISC code...
qla2300 0000:02:02.0: Waiting for LIP to complete...
qla2300 0000:02:02.0: Cable is unplugged...
scsi3 : qla2xxx
kernel unaligned access to 0xe0000030066c000c, ip=0xa0000001005cd0b1
qla2300 0000:02:02.0:
 QLogic Fibre Channel HBA Driver: 8.01.00b5-k
  QLogic QLA2342 -
  ISP2312: PCI-X (133 MHz) @ 0000:02:02.0 hdma+, host#=3, fw=3.03.15 IPX
ACPI: PCI Interrupt 0000:02:02.1[B]: no GSI
qla2300 0000:02:02.1: Found an ISP2312, irq 64, iobase 0xc00000080fa41000
qla2300 0000:02:02.1: Configuring PCI space...
qla2300 0000:02:02.1: Configure NVRAM parameters...
qla2300 0000:02:02.1: Verifying loaded RISC code...
qla2300 0000:02:02.1: Waiting for LIP to complete...
qla2300 0000:02:02.1: Cable is unplugged...
scsi4 : qla2xxx
kernel unaligned access to 0xe0000030066d000c, ip=0xa0000001005cd0b1

0xa0000001005cd0b1 is qla2x00_init_host_attr+0x71.

void
qla2x00_init_host_attr(scsi_qla_host_t *ha)
{
        fc_host_node_name(ha->host) =
            be64_to_cpu(*(uint64_t *)ha->init_cb->node_name);
        fc_host_port_name(ha->host) =
            be64_to_cpu(*(uint64_t *)ha->init_cb->port_name);
}

It looks like ha->init_cb->port_name.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.13-rc7 qla2xxx unaligned accesses
  2005-08-24  6:21 2.6.13-rc7 qla2xxx unaligned accesses Keith Owens
@ 2005-08-24 18:22 ` Andrew Vasquez
  2005-08-24 20:05   ` Keith Owens
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Vasquez @ 2005-08-24 18:22 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Wed, 24 Aug 2005, Keith Owens wrote:

> 2.6.13-rc7 + kdb on ia64.  The qla2xxx drivers are getting unaligned
> accesses at startup.
> 
> qla2300 0000:01:02.0: Found an ISP2312, irq 66, iobase 0xc00000080f300000
> qla2300 0000:01:02.0: Configuring PCI space...
> PCI: slot 0000:01:02.0 has incorrect PCI cache line size of 0 bytes, correcting to 128
> qla2300 0000:01:02.0: Configure NVRAM parameters...
> qla2300 0000:01:02.0: Verifying loaded RISC code...
> qla2300 0000:01:02.0: Waiting for LIP to complete...
> qla2300 0000:01:02.0: Cable is unplugged...
> scsi1 : qla2xxx
> kernel unaligned access to 0xe00000300667800c, ip=0xa0000001005cd0b1

Yes, I have a fix for this in my patch-queue.  I'll attach it here for
reference.  I'll forward onto linux-scsi post 2.6.13.

--
av

---

On some platforms the hard-casting of the 8 byte node_name
and port_name arrays to an u64 would cause unaligned-access
warnings.  Generalize the conversions with consistent
shifting of WWN bytes.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
---

 drivers/scsi/qla2xxx/qla_attr.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

24e16c86578498fd71a3e33bebbd8be7323a03c6
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -345,6 +345,15 @@ struct class_device_attribute *qla2x00_h
 
 /* Host attributes. */
 
+static u64
+wwn_to_u64(uint8_t *wwn)
+{
+	return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
+	    (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
+	    (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
+	    (u64)wwn[6] <<  8 | (u64)wwn[7];
+}
+
 static void
 qla2x00_get_host_port_id(struct Scsi_Host *shost)
 {
@@ -360,16 +369,16 @@ qla2x00_get_starget_node_name(struct scs
 	struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
 	scsi_qla_host_t *ha = to_qla_host(host);
 	fc_port_t *fcport;
-	uint64_t node_name = 0;
+	u64 node_name = 0;
 
 	list_for_each_entry(fcport, &ha->fcports, list) {
 		if (starget->id == fcport->os_target_id) {
-			node_name = *(uint64_t *)fcport->node_name;
+			node_name = wwn_to_u64(fcport->node_name);
 			break;
 		}
 	}
 
-	fc_starget_node_name(starget) = be64_to_cpu(node_name);
+	fc_starget_node_name(starget) = node_name;
 }
 
 static void
@@ -378,16 +387,16 @@ qla2x00_get_starget_port_name(struct scs
 	struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
 	scsi_qla_host_t *ha = to_qla_host(host);
 	fc_port_t *fcport;
-	uint64_t port_name = 0;
+	u64 port_name = 0;
 
 	list_for_each_entry(fcport, &ha->fcports, list) {
 		if (starget->id == fcport->os_target_id) {
-			port_name = *(uint64_t *)fcport->port_name;
+			port_name = wwn_to_u64(fcport->port_name);
 			break;
 		}
 	}
 
-	fc_starget_port_name(starget) = be64_to_cpu(port_name);
+	fc_starget_port_name(starget) = port_name;
 }
 
 static void
@@ -460,9 +469,7 @@ struct fc_function_template qla2xxx_tran
 void
 qla2x00_init_host_attr(scsi_qla_host_t *ha)
 {
-	fc_host_node_name(ha->host) =
-	    be64_to_cpu(*(uint64_t *)ha->init_cb->node_name);
-	fc_host_port_name(ha->host) =
-	    be64_to_cpu(*(uint64_t *)ha->init_cb->port_name);
+	fc_host_node_name(ha->host) = wwn_to_u64(ha->init_cb->node_name);
+	fc_host_port_name(ha->host) = wwn_to_u64(ha->init_cb->port_name);
 	fc_host_supported_classes(ha->host) = FC_COS_CLASS3;
 }


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.13-rc7 qla2xxx unaligned accesses
  2005-08-24 18:22 ` Andrew Vasquez
@ 2005-08-24 20:05   ` Keith Owens
  2005-08-27  2:17     ` Andrew Vasquez
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Owens @ 2005-08-24 20:05 UTC (permalink / raw)
  To: Andrew Vasquez; +Cc: linux-kernel

On Wed, 24 Aug 2005 11:22:52 -0700, 
Andrew Vasquez <andrew.vasquez@qlogic.com> wrote:
>On Wed, 24 Aug 2005, Keith Owens wrote:
>
>> 2.6.13-rc7 + kdb on ia64.  The qla2xxx drivers are getting unaligned
>> accesses at startup.
>> 
>> qla2300 0000:01:02.0: Found an ISP2312, irq 66, iobase 0xc00000080f300000
>> qla2300 0000:01:02.0: Configuring PCI space...
>> PCI: slot 0000:01:02.0 has incorrect PCI cache line size of 0 bytes, correcting to 128
>> qla2300 0000:01:02.0: Configure NVRAM parameters...
>> qla2300 0000:01:02.0: Verifying loaded RISC code...
>> qla2300 0000:01:02.0: Waiting for LIP to complete...
>> qla2300 0000:01:02.0: Cable is unplugged...
>> scsi1 : qla2xxx
>> kernel unaligned access to 0xe00000300667800c, ip=0xa0000001005cd0b1
>
>Yes, I have a fix for this in my patch-queue.  I'll attach it here for
>reference.  I'll forward onto linux-scsi post 2.6.13.
>
>--
>av
>
>---
>
>On some platforms the hard-casting of the 8 byte node_name
>and port_name arrays to an u64 would cause unaligned-access
>warnings.  Generalize the conversions with consistent
>shifting of WWN bytes.
>
>Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
>---
>
> drivers/scsi/qla2xxx/qla_attr.c |   27 +++++++++++++++++----------
> 1 files changed, 17 insertions(+), 10 deletions(-)
>
>24e16c86578498fd71a3e33bebbd8be7323a03c6
>diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
>--- a/drivers/scsi/qla2xxx/qla_attr.c
>+++ b/drivers/scsi/qla2xxx/qla_attr.c
>@@ -345,6 +345,15 @@ struct class_device_attribute *qla2x00_h
> 
> /* Host attributes. */
> 
>+static u64
>+wwn_to_u64(uint8_t *wwn)
>+{
>+	return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
>+	    (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
>+	    (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
>+	    (u64)wwn[6] <<  8 | (u64)wwn[7];
>+}
>+

Any reason you defined your own function instead of using the standard
get_unaligned()?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 2.6.13-rc7 qla2xxx unaligned accesses
  2005-08-24 20:05   ` Keith Owens
@ 2005-08-27  2:17     ` Andrew Vasquez
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Vasquez @ 2005-08-27  2:17 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Thu, 25 Aug 2005, Keith Owens wrote:
> On Wed, 24 Aug 2005 11:22:52 -0700, 
> Andrew Vasquez <andrew.vasquez@qlogic.com> wrote:
> >On Wed, 24 Aug 2005, Keith Owens wrote:
> >
> >> 2.6.13-rc7 + kdb on ia64.  The qla2xxx drivers are getting unaligned
> >> accesses at startup.
> >> 
> >> qla2300 0000:01:02.0: Found an ISP2312, irq 66, iobase 0xc00000080f300000
> >> qla2300 0000:01:02.0: Configuring PCI space...
> >> PCI: slot 0000:01:02.0 has incorrect PCI cache line size of 0 bytes, correcting to 128
> >> qla2300 0000:01:02.0: Configure NVRAM parameters...
> >> qla2300 0000:01:02.0: Verifying loaded RISC code...
> >> qla2300 0000:01:02.0: Waiting for LIP to complete...
> >> qla2300 0000:01:02.0: Cable is unplugged...
> >> scsi1 : qla2xxx
> >> kernel unaligned access to 0xe00000300667800c, ip=0xa0000001005cd0b1
> >
> >Yes, I have a fix for this in my patch-queue.  I'll attach it here for
> >reference.  I'll forward onto linux-scsi post 2.6.13.
> >
> >--
> >av
> >
> >---
> >
> >On some platforms the hard-casting of the 8 byte node_name
> >and port_name arrays to an u64 would cause unaligned-access
> >warnings.  Generalize the conversions with consistent
> >shifting of WWN bytes.
> >
> >Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
> >---
> >
> > drivers/scsi/qla2xxx/qla_attr.c |   27 +++++++++++++++++----------
> > 1 files changed, 17 insertions(+), 10 deletions(-)
> >
> >24e16c86578498fd71a3e33bebbd8be7323a03c6
> >diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> >--- a/drivers/scsi/qla2xxx/qla_attr.c
> >+++ b/drivers/scsi/qla2xxx/qla_attr.c
> >@@ -345,6 +345,15 @@ struct class_device_attribute *qla2x00_h
> > 
> > /* Host attributes. */
> > 
> >+static u64
> >+wwn_to_u64(uint8_t *wwn)
> >+{
> >+	return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
> >+	    (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
> >+	    (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
> >+	    (u64)wwn[6] <<  8 | (u64)wwn[7];
> >+}
> >+
> 
> Any reason you defined your own function instead of using the standard
> get_unaligned()?

I was unaware there was even such a helper.  Anyway, the wwn_to_u64()
function adds another benefit -- clarity, were converting a 8 byte
WWN array to it's endian-agnosting 64bit value.  I suppose, we could
make it inline.

--
AV

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-08-27  2:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-24  6:21 2.6.13-rc7 qla2xxx unaligned accesses Keith Owens
2005-08-24 18:22 ` Andrew Vasquez
2005-08-24 20:05   ` Keith Owens
2005-08-27  2:17     ` Andrew Vasquez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox