Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4465715pxf; Tue, 16 Mar 2021 14:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu1O5UhhykoWgcntuzchk+HZpu5F/tmplqbnoXgEccDQEMNUWIIgYwPFe56CeO6J3IMhTx X-Received: by 2002:a17:906:f9d8:: with SMTP id lj24mr32038134ejb.200.1615929745727; Tue, 16 Mar 2021 14:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615929745; cv=none; d=google.com; s=arc-20160816; b=lZYNo4TH39W7Csci8yRyzyqaeyjav78GcMGwLUo0zagTqrLfvNBXf9ep9s6eUViVRG gRCYiaVUQs8pGOTJwwNUTfI0mGV98HFVO1v4e2EQ5hAO8JcU+ORCEOMzgRdTHD00yb43 eeJQj4hU4QqqlMYVSXniY/SNsGJ15J+ciYEafmjmb8GOsnWjtBDN4kPS5r9lMHH9wJUS N3Q9qnJeKe7YiEeJrqGEOFPLUpI/ERWrjRLm1hnIUZNvnGACELX6F7lUJUjjZxso94fF g9XPQmX/E/IaMJ6Km9RXybFZ8TG62GqfIQRRDEnxOLqfA6u8f6pvfKHplIymd22XNa42 9YSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lKniugzgsfmNw2LeSkjVWvkyHywg7EDRrVUmsYdc0DI=; b=uDdrkzzBGzzUDt9JEZxbzOhfCuhjyWtb+bSVeokk1zOzCJLy1JmbFfHodsLKV61qVr DdyIns6rUoobMKClI+D/Qfh3tYUfZmMywAarNugQmGYlFDoPHmrZ01vRBr5BDWDw7T/h C00PNAaVB5PzH/OyQIizmf+ErZH+rNsa1HVt35MmtTOF6IWcqvQi0s/1xTxeSmcjMc0K pJuyuxk+fvCkoDNEUVjhNLTHMKIsNhub0YWBbKveq9+BIhuAtkMh0QaZ4Q4msDZjde+V zCJuCN/n7CbKJicBpTauat9j9Ny72GNzzbyFdjiURy4D7TNL7uZOwYprLoUoUTPt3fUu jdhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YDMonfeh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si9343730eda.196.2021.03.16.14.22.02; Tue, 16 Mar 2021 14:22:25 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YDMonfeh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240011AbhCPS3P (ORCPT + 99 others); Tue, 16 Mar 2021 14:29:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:33724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236941AbhCPS2k (ORCPT ); Tue, 16 Mar 2021 14:28:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 93A7965144; Tue, 16 Mar 2021 18:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615919319; bh=o5TDeYcIZfv3w4lnvrTEouEqZDlTghi/yYioRz16sfs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YDMonfeho2P2kYrP1Eouqage1A0JdVUoHkwxBzlILGtvAfJnUe2bImP8a6dwiV3+r qPUBCgpD1rPL1gHhwqpXdBrKWh0yH9WJvAMWpGwv06HgZQQSaZ6F3x36BNWvV3doZJ 0KL3Sl5/s0PuvZro2WswQXfgXjRBJtG0JsJaGD7ySV/cCJ41/TSqI3hwAYg/5SqTWN nga/E/y0OHnVKuP9nFJ6+0XGlBIau8fw4fi4qOO17BgEGqYaHK/PNSDG2ZJUc8pt+f hn+vhm5e8suCzAkC5uAEbqKsF2oyiOKyp9izJAzLDY6agFrCxwGZv4mY0XsiGfnetr b+9t50q48YT5A== Received: by mail-ot1-f49.google.com with SMTP id t23-20020a0568301e37b02901b65ab30024so7373297otr.4; Tue, 16 Mar 2021 11:28:39 -0700 (PDT) X-Gm-Message-State: AOAM533GuKr8BHO38lZ2todszRmeC/E/OpdI6v4sjDOFYRppBB8IyE+W QAPdNDYKRPQPchzvu/rT1jk3UsECA9tTm2ClirE= X-Received: by 2002:a9d:6341:: with SMTP id y1mr116073otk.210.1615919318766; Tue, 16 Mar 2021 11:28:38 -0700 (PDT) MIME-Version: 1.0 References: <5532f9ab-7555-d51b-f4d5-f9b72a61f248@redhat.com> <20210312222718.4117508-1-slyfox@gentoo.org> In-Reply-To: From: Arnd Bergmann Date: Tue, 16 Mar 2021 19:28:22 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] hpsa: fix boot on ia64 (atomic_t alignment) To: Don.Brace@microchip.com Cc: Sergei Trofimovich , "linux-kernel@vger.kernel.org" , linux-ia64@vger.kernel.org, storagedev@microchip.com, linux-scsi , jszczype@redhat.com, Scott.Benesh@microchip.com, Scott.Teel@microchip.com, thenzl@redhat.com, "Martin K. Petersen" , John Paul Adrian Glaubitz Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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