Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4169428pxf; Tue, 30 Mar 2021 00:36:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGHvxhnc4lClUNFQZ/nPJNsNR2pkqYUr2aP8RjSfFLmDtkFlzYaGicSlkHIa2F7jM2KwBN X-Received: by 2002:aa7:cd54:: with SMTP id v20mr32358800edw.80.1617089767979; Tue, 30 Mar 2021 00:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617089767; cv=none; d=google.com; s=arc-20160816; b=eB2vbbtDHMxIKTY8FdbJ517jww4PSu8GzeYl1CkvjnIyFRRVPvLIkdpyapRXrp9oQO Csr5vCmHaRuZx7R2d5Opm7WnKc4FHsHuL6ZCdvp6n98GRMxrHlMAcKgXHbIrhvoJgl13 pKz0KYkHZ/yz7RyecgusVinylYWhXqWK1w6PjY4d22kjxj/XFBaDibEvxnDEYWipC7gt m/pNUtNOqOMsHRUH8zFVdth0caaotmYN1VCnuyOmAkwPkih/KZ4vJAbLFDVzxrd9Qi0B y6ehkhZGPS533A7Yz68VyAza1s1vcSvKYsEvJfK+5IXdC34uRdNJmifDO64q217JnCWB EfOw== 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=5e/NHlyAn9rB/ujF7AKU8luzTgfrQWDPRgZqr8KrEOo=; b=tQnRYN8Gd3Md6UVndssDabsb6C5/5tJ1CZuZfDap1mgGBCx4q7fjEsHLYBlz8fs3rf qC82mEaO2VK8vOEF3uVAqt69NKXZis60wtu/GJJFiWbrHFZ+AGclGlpzAPxLQQeGBEMU pbZZODYrlWreaGWkWJqxspJfPmezOgeA1UjnphNKCkCyS/E/l9Kkk4fB0KCVIFi1q8T6 gh/bTaZ6ZV7OPDnvPOcrodRiPEdfBIdh2XvbxGXs4RXnq8cthXzdGQOKd6iZR/hZaa8l K5JY5JgoSWlsd9JdfSVpGHRVndBzZJd4f/RrYRx6rTUTPpvPgo1MeEUSv/bRL1p18sDZ +XUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rt3OaYyk; 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 u8si13967682ejz.667.2021.03.30.00.35.44; Tue, 30 Mar 2021 00:36:07 -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=Rt3OaYyk; 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 S230248AbhC3Heq (ORCPT + 99 others); Tue, 30 Mar 2021 03:34:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:58002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbhC3HeP (ORCPT ); Tue, 30 Mar 2021 03:34:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 20D1761957; Tue, 30 Mar 2021 07:34:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617089655; bh=YtguDODw8Uj/hE0IRHyy+onzpCZQS84rIgWYYMtsB8E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Rt3OaYykxMqzqMwR/09kXKocomqoYkBD7dGW2fk8T6GGtr3z3fIlZ76/GaLVGn6U4 a/J/5ce9TayAuAfr7Hn/l9YINP5jaaMcJbdsV0LNg3CuSw7axu1G+sI2MsoTXf6fus 8gaWOHLi5KD+Req07Wjb7blmGp67SLvEwmybP5v3Rqf1twp1icUzg20dYnh6fkbSgX CS1Vz5UbQUibD3vECLRdceMe8W4yH/h9h8s3lq5NZF0meT/K1cr7SmzD2i6CJq79ku 99lVpHilpQnuDC4ZDjW2P1GIJqEUz9Q3GAHnX7Cq5JuzvVe4iAixsdg8+zLl7AC7cI HAyAUrpaLBIZg== Received: by mail-oi1-f179.google.com with SMTP id x207so15630905oif.1; Tue, 30 Mar 2021 00:34:15 -0700 (PDT) X-Gm-Message-State: AOAM532DpQsj2IdKANAO00X6A4MBWwpwiuDpy0RZjnx8gF8Y3hGpvqkx H/BZPVgIp+9G0K5hZe1RyNp3xLwqa0MxrHFSrws= X-Received: by 2002:a05:6808:3d9:: with SMTP id o25mr2303636oie.4.1617089654371; Tue, 30 Mar 2021 00:34:14 -0700 (PDT) MIME-Version: 1.0 References: <20210330071958.3788214-1-slyfox@gentoo.org> <20210330071958.3788214-3-slyfox@gentoo.org> In-Reply-To: <20210330071958.3788214-3-slyfox@gentoo.org> From: Arnd Bergmann Date: Tue, 30 Mar 2021 09:34:00 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/3] hpsa: add an assert to prevent from __packed reintroduction To: Sergei Trofimovich Cc: "Martin K. Petersen" , John Paul Adrian Glaubitz , Don Brace , linux-ia64@vger.kernel.org, storagedev@microchip.com, linux-scsi , jszczype@redhat.com, Scott Benesh , Scott Teel , thenzl@redhat.com, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 30, 2021 at 9:23 AM Sergei Trofimovich wrote: > +/* > + * Make sure our embedded atomic variable is aligned. Otherwise we break atomic > + * operations on architectures that don't support unaligned atomics like IA64. > + * > + * The assert guards against reintroductin against unwanted __packed to > + * the struct CommandList. > + */ > +static_assert(offsetof(struct CommandList, refcount) % __alignof__(atomic_t) == 0); > + There are a few other members that need to be aligned: the work_struct has another atomic_t inside it, and there are a few pointers that might rely on being written to atomically. While you could add a static_assert for each member, the easier solution is to just not ask for the members to be misaligned in the first place. Arnd