Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4168835pxf; Tue, 30 Mar 2021 00:34:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhH98D1f+b3oMQnrULHPiwQSWqayv2Z4qVGrX7emq+nD1zjVloaJHNfz6zep3afnRqCuyo X-Received: by 2002:a17:906:4055:: with SMTP id y21mr31557381ejj.507.1617089695536; Tue, 30 Mar 2021 00:34:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617089695; cv=none; d=google.com; s=arc-20160816; b=OSq3bE40u7uVjPMNmj8PNwnWT3L6s4ch1WZoI9JFcOT3tCz2NEG/tu5m2tY+HI2ZG5 X/+mQck5OUkPa5O5W+UKRfAFbk0yBJNmkPhRZ9OPXm+MIIGHx0AaSL4jq30w66tN7oRe RALQgljK2YxZfwq0nnnVQyrx/BsaYDqRTKhrG4OyAxCELMFUdh2i4Plt6pPYeFBN1FA9 xqKq9LTlcmGOrjPd9W/0N5W4is3Y8PdVcMOIIgz2uQD9R96Hnaxh3smiQHfu8K29zX3K m568uNB/VhYRN/mQMhacSrduK4dI95h2219UnMknBoZqy+k/sN89RtVIqPeiyw5mqLYy ZBwg== 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=mNTMiL2GHSS0X6bUJrRHfpkdkg694AuAFH8DIjSQrss=; b=Fo7Ppy3GJLhrIPCsGpuF42IECUGgLpXQs8AYEM1OsKO33ZxpIHb6ywTEToouV8ml4C bxJGF8lepRiLY//oZso2gpwqAT/10UF653EV0J+bsSFKS1k2DALkQoetLI126prql6rY driK/P0Rz7NEwKmXX40J/foN7sWEX+PVk+urmSfzeaBs2rmCDNIT4WftrCpltXk/r7Ps SeMse/ZYe9Icsq/BOpBKJECtq52cxqrnKynLKJjqHlvp7ge0/wp4ZPO92vw8sXp1lOwU A13PCnoe4lWQJS/OUuBKn8WizZviIk9K0SA0bzoYfBWiF96SVki8RS0DZrEHuWhlXZ3Y YdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ugJCV1z8; 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 n13si13975671ejs.39.2021.03.30.00.34.29; Tue, 30 Mar 2021 00:34:55 -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=ugJCV1z8; 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 S229483AbhC3Hb1 (ORCPT + 99 others); Tue, 30 Mar 2021 03:31:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:57392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbhC3Ha7 (ORCPT ); Tue, 30 Mar 2021 03:30:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C77E61953; Tue, 30 Mar 2021 07:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617089459; bh=89DgxQC8PTyukm1mDqpIejFWerzPhaf6+PaOBTtGORk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ugJCV1z8a13ckwEFFHho9/CI3tgJfQQoIpMtiiRRsMgxlj5IznPzdRTzXSB4/NXv3 4hln6kdANarsJhcWaWmR7DFSKrMP12h6YI06empfG+U5dVuCzX/xt+sQDmXucJkxZk cYSQneGIMMAe4yg2sW6XpD9iXLvIGKlx2pGO18/R6IKzUPyRAU7zJ2+6ZMZt5eS4n9 u3isJL/kTza4kV2GQhIFJwtqssdzRf8m8zh7KXKagda8eMPu4br1WCDZ0TkJ88FgQU LxOtqzZr5bvLj4yapYhVWSGd17sdgtwRND+0DUi2jMogQ5jU4/VkJJ4NGwiRKGowMW RLvOt+Iw3d/NA== Received: by mail-ot1-f43.google.com with SMTP id s11-20020a056830124bb029021bb3524ebeso14793319otp.0; Tue, 30 Mar 2021 00:30:59 -0700 (PDT) X-Gm-Message-State: AOAM532XDgmRf/u1m4JVxQH+NUW5P8dHGI5l+TgGpFdu4cYCuZhTnfEp UV7ME+j1TwgfCYLUf2AE5rHO1drox+FiWfKbxLQ= X-Received: by 2002:a9d:316:: with SMTP id 22mr26071919otv.210.1617089458397; Tue, 30 Mar 2021 00:30:58 -0700 (PDT) MIME-Version: 1.0 References: <20210330071958.3788214-1-slyfox@gentoo.org> In-Reply-To: <20210330071958.3788214-1-slyfox@gentoo.org> From: Arnd Bergmann Date: Tue, 30 Mar 2021 09:30:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/3] hpsa: use __packed on individual structs, not header-wide 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:22 AM Sergei Trofimovich wrote: > > Some of the structs contain `atomic_t` values and are not intended to be > sent to IO controller as is. > > The change adds __packed to every struct and union in the file. > Follow-up commits will fix `atomic_t` problems. > > The commit is a no-op at least on ia64: > $ diff -u <(objdump -d -r old.o) <(objdump -d -r new.o) This looks better to me, but I think it still has the same potential bug in the CommandList definition. Moving from #pragma to annotating the misaligned structures as __packed is more of a cleanup that could be done separately from the bugfix, but it does make it a little more robust. > #define HPSA_INQUIRY 0x12 > struct InquiryData { > u8 data_byte[36]; > -}; > +} __packed; Marking this one and a few others as __packed is a bit silly, but also obviously harmless, and closer to the original version, so that's ok. > @@ -451,7 +452,7 @@ struct CommandList { > bool retry_pending; > struct hpsa_scsi_dev_t *device; > atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */ > -} __aligned(COMMANDLIST_ALIGNMENT); > +} __packed __aligned(COMMANDLIST_ALIGNMENT); You are still marking CommandList as __packed here, which is what caused the original problem. Please don't mark this one as __packed at all. If there are individual members that you want to be misaligned inside of the structure, you could mark those explicitly. Arnd