Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5309048ioo; Wed, 1 Jun 2022 02:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5UB34GDodo9xhraSgOYJrmDoXLju8DeqEUPMY/J6BEHI4a/8d5ycZ3Coibt0VOysEI4ds X-Received: by 2002:a50:eb92:0:b0:42d:ce7c:721f with SMTP id y18-20020a50eb92000000b0042dce7c721fmr17010574edr.147.1654077015824; Wed, 01 Jun 2022 02:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654077015; cv=none; d=google.com; s=arc-20160816; b=QDsZl9MWcyfx/BlxRB3BENch7uftJp4TB1f4HxT31wZ5gmX3lwtR7carUtA3uahEfJ S4FDvZMkx3shSfT8JQV+SZ2ibR02dfIELIgr+C85Qf6pN9cfB3wuDYyi2o/uWbOPtCYz SYdpN9oaDKZgTSX9CXDYnxJQLGHIV7CteUjJWl170iSWCPSV2YUonfEJ+LRTei/ND25H K1yCPyQwPxTwkBMp42G+WJkZ4rtIrnLskH5QdR/2OmiPkkSc6JUt6xIzyFChiPuAJJvK NLLORdM0uCWghZgRDWlnalcP4EdxwJkZBdOClz74z94D44VH9cU5LUzZev3Gvyp571ZY zz8A== 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; bh=2MZssREOb/Nhl0KLEzMuyvz1JYBhl4+wq7CIex8RAsk=; b=ziW8gEua2bRJYQoSJQIyKreP2PHAA4AYZBIr5etR6FkxzlsjarNhW5M3td/pik4MNE bVtGk5huY3uUA5KITrj4yd6nkr96NbVJJXbf1lfeFreAdX/v6ocvJ6ulcpac/QeZEOvh fOTomWO3V2eUC+3vsL2UFW9e7qDaYNZXJfHIwbdZz3+ep4ApaMtCSm/lnSiRUviMguOZ nvo1aHnDtRqXVpPciKLJ0QoTV6Aqv6VrywR+rr3Z5fdM8ZRWz/7xq7t0IQ0YXODLIcH6 AYRRJvdARpbL2X2HIJWuzs7OLnrNf/QpQLMaR/FoO1dTqcvjjEcSoTw08/kVfAcztQ9+ 6o2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a24-20020aa7c818000000b0042af0de5be0si1209526edt.41.2022.06.01.02.49.50; Wed, 01 Jun 2022 02:50:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236313AbiE3PZ3 (ORCPT + 99 others); Mon, 30 May 2022 11:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241804AbiE3PZB (ORCPT ); Mon, 30 May 2022 11:25:01 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF424140C5 for ; Mon, 30 May 2022 07:27:03 -0700 (PDT) Received: from mail-yb1-f175.google.com ([209.85.219.175]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MAwoL-1o705U2mAD-00BNnR for ; Mon, 30 May 2022 16:27:01 +0200 Received: by mail-yb1-f175.google.com with SMTP id t31so6376265ybi.2 for ; Mon, 30 May 2022 07:27:01 -0700 (PDT) X-Gm-Message-State: AOAM530iK3Q2mV8VZSC7415vACqiXJ7deUN+Nxd+NCGh1deNO/Jec/+s uOOWffgn70Zwp4/0T3M9UwRiZ5pM+8T+1oJ0c9E= X-Received: by 2002:a25:4f0a:0:b0:64f:6a76:3d8f with SMTP id d10-20020a254f0a000000b0064f6a763d8fmr43544693ybb.134.1653920820404; Mon, 30 May 2022 07:27:00 -0700 (PDT) MIME-Version: 1.0 References: <87a6aztli2.fsf@intel.com> <877d63tleq.fsf@intel.com> <87czfvrwsv.fsf@intel.com> <874k17ru44.fsf@intel.com> In-Reply-To: <874k17ru44.fsf@intel.com> From: Arnd Bergmann Date: Mon, 30 May 2022 16:26:43 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") To: Jani Nikula Cc: Arnd Bergmann , Linus Torvalds , Sudip Mukherjee , Russell King , Viresh Kumar , Shiraz Hashim , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel , Linux Kernel Mailing List , Linux ARM , SoC Team , Julia Lawall Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:GsNo+lmxofIjxKfQ8P/W5vYMLw6wvfExggyZZJBLHymM0U2xCqF cxpRJ+VsjR+G/v2AI1vekY7nhm32qhgNDTfnRRMES1bZLtvq3j9ylWbEBxn+eNBwcmwlxoP 3Pg83FL9wGY6nxqr7sZlorgCf9dc6tpvs3EGxhPPbOCaHT/SODxv+qIS27AhGBLcWNFfOKA KQT89jtpp9CxL1rLWkHAQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:VU2d7sJRNV8=:Bb/K79iZoDkd6FMmH6HbZr ShzTmmi4LwZ192mHRmZ3E/bDE6RcJY/kLczT9q/T596wCFBUf8pIfkJlG1mYS/zSkPHmi6ZRq IEjHfkH+c55EXwx5vlQDkdWuwNvA+g4BLC4Z2eXZsFpeXCUM1iPdwQfQ25kmwzR7holEsuWVm kkdcqlDAOQKv0aErxKI1LkS5CBWhb59LJ2+jZ+wzhd1RrcZTeUmdPLUYYGEn08ogIHj32y6PU maDeS++VXnS7Ltjl0b1tvH8IsaAMpkVbp4Dvz/iIpo/xeMv1ftETwJaY9T1a5TFhEf2jm9FJc +R21QJACaW8P0kcDqxyZ6Aegx3oFgomTKYtmmVanAErV4oBDaxeJQMOwdqMp+25Pd3pNKUZK2 je+T5kATa3Sb511AmWyANY0JEo8kbJhnXeXl6UqpF95aErZIK1/5V/v91P7nFiqHJIi0FDiSj k2nn52NezY02cJmIdyGm2M9kS7b+6gTBroxnNjoM326pQRVXwxtSvuTo7XPE4DcM3+iiYgrks ozFP++1g3WrlOiGPK/8+dSElauOyEYwDmTIoztHxvBPacaqiDfcyfy3lUCMlckz3YgNVz57+T I0NzhKoqpd7V524JO12hc5iMKQjna/l0Cf9lC4nrcycAkAa1C+MCweVGPP3iPVc378fbdE1Tv BtGzSsJsUZTVGxCSuObU248PDkw/Hzt6XcNVtM/vpoJ5qszqQA8a+jxmaN90lcMTWScUmIhMU OA7W9zcmiRghRH7MaVPBnGyn5F5APCeOeLBTtcsUi+Wtkmf9mtvM8KkI+FqeJHJnc0l2hmZaq I4VxKFtmAlYDOSTnkFG4iEMpl414Oi591niobnfbMtCjpu54KaU3O62z9+AeZ6sp4j/QL0SEI F1gjL/J0BPIEyhbIxwliWD8hFV8SNgNnQtvzU1Vds= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 4:08 PM Jani Nikula wrote: > On Mon, 30 May 2022, Arnd Bergmann wrote: > > struct my_driver_priv { > > struct device dev; > > u8 causes_misalignment; > > spinlock_t lock; > > atomic_t counter; > > } __packed; /* this annotation is harmful because it breaks the atomics */ > > I wonder if this is something that could be caught with coccinelle. Or > sparse. Are there any cases where this combo is necessary? (I can't > think of any, but it's a low bar. ;) > > Cc: Julia. I think one would first have to make a list of data types that are not meant to be in a packed structure. It could be a good start to search for any packed aggregates with a pointer, atomic_t or spinlock_t in them, but there are of course many more types that you won't find in hardware structures. > > or if the annotation does not change the layout like > > > > struct my_dma_descriptor { > > __le64 address; > > __le64 length; > > } __packed; /* does not change layout but makes access slow on some > > architectures */ > > Why is this the case, though? I'd imagine the compiler could figure this > out. When you annotate the entire structure as __packed without an extra __aligned() annotation, the compiler has to assume that the structure itself is unaligned as well. On many of the older architectures, this will result in accessing the values one byte at a time. Marking the structure as "__packed __aligned(8)" instead would be harmless. When I have a structure with a few misaligned members, I generally prefer to only annotate the members that are not naturally aligned, but this approach is not very common. Arnd