Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-29 Thread Martin K. Petersen


Arnd,

> I think Martin is still waiting for a fixed version of the patch, as
> the proposed patch from March 12 only solves the immediate symptom,
> but not the underlying problem of the CommandList structure being
> marked as unaligned. If it gets fixed, the new version should work on
> all architectures.

Yep.

I unfortunately don't have any hpsa adapters to test with. Was hoping
somebody with hardware would attempt to fix up the struct properly.

Given -rc5 we're running out of time so for 5.12 it's probably best if
we queue up the workaround. I would prefer an amalgamation of Don's and
Sergei's patches, though. I do like the assert so we can catch problems
early.

But really, somebody should fix this. While hpsa may be out of
commercial support, Linux will support the driver it until there are no
more users. And the current structure packing is just wrong.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-29 Thread Arnd Bergmann
On Mon, Mar 29, 2021 at 1:28 PM John Paul Adrian Glaubitz
 wrote:
> On 3/24/21 7:37 PM, don.br...@microchip.com wrote:
> >
> > Acked-by: Don Brace 
> >
> > Thanks for your patch and extra effort.
>
> Apologies for being so persistent, but has this patch been queued anywhere?
>
> This should be included for 5.12 if possible as it unbreaks the kernel on alot
> of Itanium servers (and potentially other machines with the HPSA controller).
>
> If no one wants to pick the patch up, it could go through Andrew Morton's 
> tree (-mm).
>

I think Martin is still waiting for a fixed version of the patch, as
the proposed patch from
March 12 only solves the immediate symptom, but not the underlying problem
of the CommandList structure being marked as unaligned. If it gets fixed, the
new version should work on all architectures.

 Arnd


Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-29 Thread John Paul Adrian Glaubitz
Hi!

On 3/24/21 7:37 PM, don.br...@microchip.com wrote:
> -Original Message-
> From: Sergei Trofimovich [mailto:sly...@gentoo.org] 
> Subject: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)
> 
> The failure initially observed as boot failure on rx3600 ia64 machine with 
> RAID bus controller: Hewlett-Packard Company Smart Array P600:
> 
> kernel unaligned access to 0xe00105dd8b95, ip=0xa00100b87551
> kernel unaligned access to 0xe00105dd8e95, ip=0xa00100b87551
> hpsa :14:01.0: Controller reports max supported commands of 0 Using 
> 16 instead. Ensure that firmware is up to date.
> swapper/0[1]: error during unaligned kernel access
> 
> Here unaligned access comes from 'struct CommandList' that happens to be 
> packed. The change f749d8b7a ("scsi: hpsa: Correct dev cmds outstanding for 
> retried cmds") introduced unexpected padding and un-aligned atomic_t from 
> natural alignment to something else.
> 
> This change does not remove packing annotation from struct but only restores 
> alignment of atomic variable.
> 
> The change is tested on the same rx3600 machine.
> 
> CC: linux-i...@vger.kernel.org
> CC: storage...@microchip.com
> CC: linux-s...@vger.kernel.org
> CC: Joe Szczypek 
> CC: Scott Benesh 
> CC: Scott Teel 
> CC: Tomas Henzl 
> CC: "Martin K. Petersen" 
> CC: Don Brace 
> Reported-by: John Paul Adrian Glaubitz 
> Suggested-by: Don Brace 
> Fixes: f749d8b7a "scsi: hpsa: Correct dev cmds outstanding for retried cmds"
> Signed-off-by: Sergei Trofimovich 
> ---
>  drivers/scsi/hpsa_cmd.h | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 
> d126bb877250..617bdae9a7de 100644
> --- a/drivers/scsi/hpsa_cmd.h
> +++ b/drivers/scsi/hpsa_cmd.h
> @@ -20,6 +20,9 @@
>  #ifndef HPSA_CMD_H
>  #define HPSA_CMD_H
> 
> +#include  /* static_assert */ #include 
> + /* offsetof */
> +
>  /* general boundary defintions */
>  #define SENSEINFOBYTES  32 /* may vary between hbas */
>  #define SG_ENTRIES_IN_CMD  32 /* Max SG entries excluding chain blocks */
> @@ -448,11 +451,20 @@ struct CommandList {
>  */
> struct hpsa_scsi_dev_t *phys_disk;
> 
> -   bool retry_pending;
> +   int retry_pending;
> struct hpsa_scsi_dev_t *device;
> atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() 
> */  } __aligned(COMMANDLIST_ALIGNMENT);
> 
> +/*
> + * Make sure our embedded atomic variable is aligned. Otherwise we 
> +break atomic
> + * operations on architectures that don't support unaligned atomics like 
> IA64.
> + *
> + * Ideally this header should be cleaned up to only mark individual 
> +structs as
> + * packed.
> + */
> +static_assert(offsetof(struct CommandList, refcount) % 
> +__alignof__(atomic_t) == 0);
> +
>  /* Max S/G elements in I/O accelerator command */
>  #define IOACCEL1_MAXSGENTRIES   24
>  #define IOACCEL2_MAXSGENTRIES  28
> --
> 2.30.2
> 
> 
> Acked-by: Don Brace 
> 
> Thanks for your patch and extra effort.

Apologies for being so persistent, but has this patch been queued anywhere?

This should be included for 5.12 if possible as it unbreaks the kernel on alot
of Itanium servers (and potentially other machines with the HPSA controller).

If no one wants to pick the patch up, it could go through Andrew Morton's tree 
(-mm).

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-27 Thread Sergei Trofimovich
On Wed, 17 Mar 2021 18:28:31 +0100
John Paul Adrian Glaubitz  wrote:

> Hi Sergei!
> 
> On 3/12/21 11:27 PM, Sergei Trofimovich wrote:
> > The failure initially observed as boot failure on rx3600 ia64 machine
> > with RAID bus controller: Hewlett-Packard Company Smart Array P600:
> > 
> > kernel unaligned access to 0xe00105dd8b95, ip=0xa00100b87551
> > kernel unaligned access to 0xe00105dd8e95, ip=0xa00100b87551
> > hpsa :14:01.0: Controller reports max supported commands of 0 Using 
> > 16 instead. Ensure that firmware is up to date.
> > swapper/0[1]: error during unaligned kernel access
> > 
> > Here unaligned access comes from 'struct CommandList' that happens
> > to be packed. The change f749d8b7a ("scsi: hpsa: Correct dev cmds
> > outstanding for retried cmds") introduced unexpected padding and
> > un-aligned atomic_t from natural alignment to something else.
> > 
> > This change does not remove packing annotation from struct but only
> > restores alignment of atomic variable.
> > 
> > The change is tested on the same rx3600 machine.  
> 
> I just gave it a try on my RX2660 and for me, the hpsa driver won't load even
> with your patch.
> 
> Can you share your kernel configuration so I can give it a try?

Sure! Here is a config from a few days ago:

https://dev.gentoo.org/~slyfox/configs/guppy-config-5.12.0-rc4-00016-g427684abc9fd-dirty

-- 

  Sergei


RE: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-24 Thread Don.Brace
-Original Message-
From: Sergei Trofimovich [mailto:sly...@gentoo.org] 
Subject: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

The failure initially observed as boot failure on rx3600 ia64 machine with RAID 
bus controller: Hewlett-Packard Company Smart Array P600:

kernel unaligned access to 0xe00105dd8b95, ip=0xa00100b87551
kernel unaligned access to 0xe00105dd8e95, ip=0xa00100b87551
hpsa :14:01.0: Controller reports max supported commands of 0 Using 16 
instead. Ensure that firmware is up to date.
swapper/0[1]: error during unaligned kernel access

Here unaligned access comes from 'struct CommandList' that happens to be 
packed. The change f749d8b7a ("scsi: hpsa: Correct dev cmds outstanding for 
retried cmds") introduced unexpected padding and un-aligned atomic_t from 
natural alignment to something else.

This change does not remove packing annotation from struct but only restores 
alignment of atomic variable.

The change is tested on the same rx3600 machine.

CC: linux-i...@vger.kernel.org
CC: storage...@microchip.com
CC: linux-s...@vger.kernel.org
CC: Joe Szczypek 
CC: Scott Benesh 
CC: Scott Teel 
CC: Tomas Henzl 
CC: "Martin K. Petersen" 
CC: Don Brace 
Reported-by: John Paul Adrian Glaubitz 
Suggested-by: Don Brace 
Fixes: f749d8b7a "scsi: hpsa: Correct dev cmds outstanding for retried cmds"
Signed-off-by: Sergei Trofimovich 
---
 drivers/scsi/hpsa_cmd.h | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 
d126bb877250..617bdae9a7de 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -20,6 +20,9 @@
 #ifndef HPSA_CMD_H
 #define HPSA_CMD_H

+#include  /* static_assert */ #include 
+ /* offsetof */
+
 /* general boundary defintions */
 #define SENSEINFOBYTES  32 /* may vary between hbas */
 #define SG_ENTRIES_IN_CMD  32 /* Max SG entries excluding chain blocks */
@@ -448,11 +451,20 @@ struct CommandList {
 */
struct hpsa_scsi_dev_t *phys_disk;

-   bool retry_pending;
+   int retry_pending;
struct hpsa_scsi_dev_t *device;
atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() 
*/  } __aligned(COMMANDLIST_ALIGNMENT);

+/*
+ * Make sure our embedded atomic variable is aligned. Otherwise we 
+break atomic
+ * operations on architectures that don't support unaligned atomics like IA64.
+ *
+ * Ideally this header should be cleaned up to only mark individual 
+structs as
+ * packed.
+ */
+static_assert(offsetof(struct CommandList, refcount) % 
+__alignof__(atomic_t) == 0);
+
 /* Max S/G elements in I/O accelerator command */
 #define IOACCEL1_MAXSGENTRIES   24
 #define IOACCEL2_MAXSGENTRIES  28
--
2.30.2


Acked-by: Don Brace 

Thanks for your patch and extra effort.




Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-24 Thread John Paul Adrian Glaubitz
Hello!

On 3/12/21 11:27 PM, Sergei Trofimovich wrote:
> The failure initially observed as boot failure on rx3600 ia64 machine
> with RAID bus controller: Hewlett-Packard Company Smart Array P600:
> 
> kernel unaligned access to 0xe00105dd8b95, ip=0xa00100b87551
> kernel unaligned access to 0xe00105dd8e95, ip=0xa00100b87551
> hpsa :14:01.0: Controller reports max supported commands of 0 Using 
> 16 instead. Ensure that firmware is up to date.
> swapper/0[1]: error during unaligned kernel access
> 
> Here unaligned access comes from 'struct CommandList' that happens
> to be packed. The change f749d8b7a ("scsi: hpsa: Correct dev cmds
> outstanding for retried cmds") introduced unexpected padding and
> un-aligned atomic_t from natural alignment to something else.
> 
> This change does not remove packing annotation from struct but only
> restores alignment of atomic variable.
> 
> The change is tested on the same rx3600 machine.
> 
> CC: linux-i...@vger.kernel.org
> CC: storage...@microchip.com
> CC: linux-s...@vger.kernel.org
> CC: Joe Szczypek 
> CC: Scott Benesh 
> CC: Scott Teel 
> CC: Tomas Henzl 
> CC: "Martin K. Petersen" 
> CC: Don Brace 
> Reported-by: John Paul Adrian Glaubitz 
> Suggested-by: Don Brace 
> Fixes: f749d8b7a "scsi: hpsa: Correct dev cmds outstanding for retried cmds"
> Signed-off-by: Sergei Trofimovich 
> ---
>  drivers/scsi/hpsa_cmd.h | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
> index d126bb877250..617bdae9a7de 100644
> --- a/drivers/scsi/hpsa_cmd.h
> +++ b/drivers/scsi/hpsa_cmd.h
> @@ -20,6 +20,9 @@
>  #ifndef HPSA_CMD_H
>  #define HPSA_CMD_H
>  
> +#include  /* static_assert */
> +#include  /* offsetof */
> +
>  /* general boundary defintions */
>  #define SENSEINFOBYTES  32 /* may vary between hbas */
>  #define SG_ENTRIES_IN_CMD32 /* Max SG entries excluding chain blocks */
> @@ -448,11 +451,20 @@ struct CommandList {
>*/
>   struct hpsa_scsi_dev_t *phys_disk;
>  
> - bool retry_pending;
> + int retry_pending;
>   struct hpsa_scsi_dev_t *device;
>   atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */
>  } __aligned(COMMANDLIST_ALIGNMENT);
>  
> +/*
> + * Make sure our embedded atomic variable is aligned. Otherwise we break 
> atomic
> + * operations on architectures that don't support unaligned atomics like 
> IA64.
> + *
> + * Ideally this header should be cleaned up to only mark individual structs 
> as
> + * packed.
> + */
> +static_assert(offsetof(struct CommandList, refcount) % __alignof__(atomic_t) 
> == 0);
> +
>  /* Max S/G elements in I/O accelerator command */
>  #define IOACCEL1_MAXSGENTRIES   24
>  #define IOACCEL2_MAXSGENTRIES28

I'm seeing this issue as well and without the patch, the kernel won't boot on 
multiple
ia64 servers. Is there anything that speaks against fixing this?

Thanks,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



RE: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-17 Thread Don.Brace
-Original Message-
From: David Laight [mailto:david.lai...@aculab.com] 
Subject: RE: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

From: Martin K. Petersen
> Sent: 17 March 2021 02:26
>
> Arnd,
>
> > Actually that still feels wrong: the annotation of the struct is to 
> > pack every member, which causes the access to be done in byte units 
> > on architectures that do not have hardware unaligned load/store 
> > instructions, at least for things like atomic_read() that does not 
> > go through a cmpxchg() or ll/sc cycle.
>
> > This change may fix itanium, but it's still not correct. Other 
> > architectures would have already been broken before the recent 
> > change, but that's not a reason against fixing them now.
>
> I agree. I understand why there are restrictions on fields consumed by 
> the hardware. But for fields internal to the driver the packing 
> doesn't make sense to me.

Jeepers -- that global #pragma pack(1) is bollocks.

I think there are a couple of __u64 that are 32bit aligned.
Just marking those field __packed __aligned(4) should have the desired effect.
Or use a typedef for '__u64 with 32bit alignment'.
(There probably ought to be one in types.h)

Then add compile-time asserts that any non-trivial structures the hardware 
accesses are the right size.

David

Don: My dilemma is that hpsa is now a maintenance driver and making more 
packing/alignment changes would trigger a lot of regression testing. My last 
patch aligns the structure with what has been in place for a long time now. All 
I did was rename an unused variable. So making any more changes is not high on 
my todo list...




Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-17 Thread John Paul Adrian Glaubitz
Hi Sergei!

On 3/12/21 11:27 PM, Sergei Trofimovich wrote:
> The failure initially observed as boot failure on rx3600 ia64 machine
> with RAID bus controller: Hewlett-Packard Company Smart Array P600:
> 
> kernel unaligned access to 0xe00105dd8b95, ip=0xa00100b87551
> kernel unaligned access to 0xe00105dd8e95, ip=0xa00100b87551
> hpsa :14:01.0: Controller reports max supported commands of 0 Using 
> 16 instead. Ensure that firmware is up to date.
> swapper/0[1]: error during unaligned kernel access
> 
> Here unaligned access comes from 'struct CommandList' that happens
> to be packed. The change f749d8b7a ("scsi: hpsa: Correct dev cmds
> outstanding for retried cmds") introduced unexpected padding and
> un-aligned atomic_t from natural alignment to something else.
> 
> This change does not remove packing annotation from struct but only
> restores alignment of atomic variable.
> 
> The change is tested on the same rx3600 machine.

I just gave it a try on my RX2660 and for me, the hpsa driver won't load even
with your patch.

Can you share your kernel configuration so I can give it a try?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



RE: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-17 Thread David Laight
From: Martin K. Petersen 
> Sent: 17 March 2021 02:26
> 
> Arnd,
> 
> > Actually that still feels wrong: the annotation of the struct is to
> > pack every member, which causes the access to be done in byte units on
> > architectures that do not have hardware unaligned load/store
> > instructions, at least for things like atomic_read() that does not go
> > through a cmpxchg() or ll/sc cycle.
> 
> > This change may fix itanium, but it's still not correct. Other
> > architectures would have already been broken before the recent change,
> > but that's not a reason against fixing them now.
> 
> I agree. I understand why there are restrictions on fields consumed by
> the hardware. But for fields internal to the driver the packing doesn't
> make sense to me.

Jeepers -- that global #pragma pack(1) is bollocks.

I think there are a couple of __u64 that are 32bit aligned.
Just marking those field __packed __aligned(4) should have
the desired effect.
Or use a typedef for '__u64 with 32bit alignment'.
(There probably ought to be one in types.h)

Then add compile-time asserts that any non-trivial structures
the hardware accesses are the right size.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)



Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-16 Thread Martin K. Petersen


Arnd,

> Actually that still feels wrong: the annotation of the struct is to
> pack every member, which causes the access to be done in byte units on
> architectures that do not have hardware unaligned load/store
> instructions, at least for things like atomic_read() that does not go
> through a cmpxchg() or ll/sc cycle.

> This change may fix itanium, but it's still not correct. Other
> architectures would have already been broken before the recent change,
> but that's not a reason against fixing them now.

I agree. I understand why there are restrictions on fields consumed by
the hardware. But for fields internal to the driver the packing doesn't
make sense to me.

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-16 Thread Arnd Bergmann
On Tue, Mar 16, 2021 at 6:12 PM  wrote:

>  drivers/scsi/hpsa_cmd.h | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 
> d126bb877250..617bdae9a7de 100644
> --- a/drivers/scsi/hpsa_cmd.h
> +++ b/drivers/scsi/hpsa_cmd.h
> @@ -20,6 +20,9 @@
>  #ifndef HPSA_CMD_H
>  #define HPSA_CMD_H
>
> +#include  /* static_assert */ #include
> + /* offsetof */
> +
>  /* general boundary defintions */
>  #define SENSEINFOBYTES  32 /* may vary between hbas */
>  #define SG_ENTRIES_IN_CMD  32 /* Max SG entries excluding chain blocks */
> @@ -448,11 +451,20 @@ struct CommandList {
>  */
> struct hpsa_scsi_dev_t *phys_disk;
>
> -   bool retry_pending;
> +   int retry_pending;
> struct hpsa_scsi_dev_t *device;
> atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() 
> */  } __aligned(COMMANDLIST_ALIGNMENT);
>
> +/*
> + * Make sure our embedded atomic variable is aligned. Otherwise we
> +break atomic
> + * operations on architectures that don't support unaligned atomics like 
> IA64.
> + *
> + * Ideally this header should be cleaned up to only mark individual
> +structs as
> + * packed.
> + */
> +static_assert(offsetof(struct CommandList, refcount) %
> +__alignof__(atomic_t) == 0);
> +

Actually that still feels wrong: the annotation of the struct is to pack
every member, which causes the access to be done in byte units
on architectures that do not have hardware unaligned load/store
instructions, at least for things like atomic_read() that does not
go through a cmpxchg() or ll/sc cycle.

This change may fix itanium, but it's still not correct. Other
architectures would have already been broken before the recent
change, but that's not a reason against fixing them now.

I'd recommend marking the entire structure as having default
alignment, by adding the appropriate pragmas before and after it.

 Arnd


RE: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

2021-03-16 Thread Don.Brace
-Original Message-
From: Sergei Trofimovich [mailto:sly...@gentoo.org] 
Subject: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment)

The failure initially observed as boot failure on rx3600 ia64 machine with RAID 
bus controller: Hewlett-Packard Company Smart Array P600:

kernel unaligned access to 0xe00105dd8b95, ip=0xa00100b87551
kernel unaligned access to 0xe00105dd8e95, ip=0xa00100b87551
hpsa :14:01.0: Controller reports max supported commands of 0 Using 16 
instead. Ensure that firmware is up to date.
swapper/0[1]: error during unaligned kernel access

Here unaligned access comes from 'struct CommandList' that happens to be 
packed. The change f749d8b7a ("scsi: hpsa: Correct dev cmds outstanding for 
retried cmds") introduced unexpected padding and un-aligned atomic_t from 
natural alignment to something else.

This change does not remove packing annotation from struct but only restores 
alignment of atomic variable.

The change is tested on the same rx3600 machine.

CC: linux-i...@vger.kernel.org
CC: storage...@microchip.com
CC: linux-s...@vger.kernel.org
CC: Joe Szczypek 
CC: Scott Benesh 
CC: Scott Teel 
CC: Tomas Henzl 
CC: "Martin K. Petersen" 
CC: Don Brace 
Reported-by: John Paul Adrian Glaubitz 
Suggested-by: Don Brace 
Fixes: f749d8b7a "scsi: hpsa: Correct dev cmds outstanding for retried cmds"
Signed-off-by: Sergei Trofimovich 
---
 drivers/scsi/hpsa_cmd.h | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 
d126bb877250..617bdae9a7de 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -20,6 +20,9 @@
 #ifndef HPSA_CMD_H
 #define HPSA_CMD_H

+#include  /* static_assert */ #include 
+ /* offsetof */
+
 /* general boundary defintions */
 #define SENSEINFOBYTES  32 /* may vary between hbas */
 #define SG_ENTRIES_IN_CMD  32 /* Max SG entries excluding chain blocks */
@@ -448,11 +451,20 @@ struct CommandList {
 */
struct hpsa_scsi_dev_t *phys_disk;

-   bool retry_pending;
+   int retry_pending;
struct hpsa_scsi_dev_t *device;
atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() 
*/  } __aligned(COMMANDLIST_ALIGNMENT);

+/*
+ * Make sure our embedded atomic variable is aligned. Otherwise we 
+break atomic
+ * operations on architectures that don't support unaligned atomics like IA64.
+ *
+ * Ideally this header should be cleaned up to only mark individual 
+structs as
+ * packed.
+ */
+static_assert(offsetof(struct CommandList, refcount) % 
+__alignof__(atomic_t) == 0);
+
 /* Max S/G elements in I/O accelerator command */
 #define IOACCEL1_MAXSGENTRIES   24
 #define IOACCEL2_MAXSGENTRIES  28
--
2.30.2

Thank-you for your testing.
I would rather you add the atomic_t alignment check only. The current patch 
under review has other changes...
https://patchwork.kernel.org/project/linux-scsi/patch/161540317205.18786.5821926127237311408.stgit@brunhilda/