Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3512070pxf; Mon, 29 Mar 2021 04:27:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1tSpRQXCoBO5KUqsi5g93+WbS+1l6RablT/XjXFc6KTrKBjWKOQQwiVJJ/ik+RInMDiLc X-Received: by 2002:a50:ec81:: with SMTP id e1mr27810791edr.0.1617017272984; Mon, 29 Mar 2021 04:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617017272; cv=none; d=google.com; s=arc-20160816; b=HWj6JhozOaewfuTMIJkPmDGaXN23ZEhxL5H1oPYQFYASNpea5UJ9xCVASEVgsG4pVB /LFU4w6MP+Yc1aZNwro/98/c4A6at+bIeqo75gnOH6+PTc5JDs08Iq4Bp9y+Qi8sflNk RxTxeiz9ZwaUgeDPcex1y2SpUi85wOpHYq3AR5hK3K5lBwpfYG6YFFlaq8VEqTePVV0N M8VGpQ8i1vHzFfTOtHoIw60pGknd9zpHBTSnNsYPe/7ID8J8E1p7b1D2n6+yOidwUQSx H5+LQ7kf8gniMnC3Sn8HsksW18CXKo1R3xi0NEexyqwvHtV0FVgT7pdIf7zihgZPFXKY vnYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=3cK8imgPmToAtGRGWCUGFV/o1R2gOgdQaoTJAdQ/cGM=; b=YAY4b3HyKrF9q+i0/nAMC7fFiQBozv/u10ddO5TtD+hqpCxkdcSDZ1HE6fsxaGkjk7 ukm/w60EGmd08FcUznXnvZJYIhqsk/NJFxORE4/JdoB7k9wl+kNQgwKvA1g/E0HAYeqv WNOGCQF7Nn3/kuy5/AAHBkxKQaNyKjOyE+VitVE6Kfbg4fbyctUnRAQAknP/PPRK4XWX mCoWOBnoxaYqjYzTYAGq9hHb1gsfFa6wgty0xR7pK4to5Ni9kcL8A7EEVaiBKTw8Nj9D xJW9SwGpV8UET20KcQE+C7YMEILxtHxHDI9UpruAccRret68EMSXMWtSsVqhzJ4yabYG CTcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si12772891edy.61.2021.03.29.04.27.30; Mon, 29 Mar 2021 04:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232820AbhC2L0g (ORCPT + 99 others); Mon, 29 Mar 2021 07:26:36 -0400 Received: from outpost1.zedat.fu-berlin.de ([130.133.4.66]:55983 "EHLO outpost1.zedat.fu-berlin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbhC2L0H (ORCPT ); Mon, 29 Mar 2021 07:26:07 -0400 Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.94) with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (envelope-from ) id 1lQq1s-001yIV-6b; Mon, 29 Mar 2021 13:25:56 +0200 Received: from dynamic-077-013-191-101.77.13.pool.telefonica.de ([77.13.191.101] helo=[192.168.1.10]) by inpost2.zedat.fu-berlin.de (Exim 4.94) with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (envelope-from ) id 1lQq1r-003kLj-VV; Mon, 29 Mar 2021 13:25:56 +0200 Subject: Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment) To: Don.Brace@microchip.com, slyfox@gentoo.org, linux-kernel@vger.kernel.org Cc: linux-ia64@vger.kernel.org, storagedev@microchip.com, linux-scsi@vger.kernel.org, jszczype@redhat.com, Scott.Benesh@microchip.com, Scott.Teel@microchip.com, thenzl@redhat.com, martin.petersen@oracle.com References: <5532f9ab-7555-d51b-f4d5-f9b72a61f248@redhat.com> <20210312222718.4117508-1-slyfox@gentoo.org> From: John Paul Adrian Glaubitz Message-ID: Date: Mon, 29 Mar 2021 13:25:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Original-Sender: glaubitz@physik.fu-berlin.de X-Originating-IP: 77.13.191.101 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On 3/24/21 7:37 PM, Don.Brace@microchip.com wrote: > -----Original Message----- > From: Sergei Trofimovich [mailto:slyfox@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 0xe000000105dd8b95, ip=0xa000000100b87551 > kernel unaligned access to 0xe000000105dd8e95, ip=0xa000000100b87551 > hpsa 0000: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-ia64@vger.kernel.org > CC: storagedev@microchip.com > CC: linux-scsi@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 - glaubitz@debian.org `. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913