Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1274184lfc; Wed, 1 Jun 2022 13:51:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhcy4rMGCKGlRRs2sDON3AAFv064oljSiHwlQPV4KvNbdY8+3JiHVjfYizZ1nFnq6nJZzp X-Received: by 2002:a05:6a00:1826:b0:518:4c8b:c5db with SMTP id y38-20020a056a00182600b005184c8bc5dbmr1410940pfa.22.1654116679692; Wed, 01 Jun 2022 13:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654116679; cv=none; d=google.com; s=arc-20160816; b=qB4JcBYUavXiyWfhOBSdTZMzhk4jysJXF6EZzA8nTlfoVeB3STr2Ef9dN9N22HAIH6 frs8R6iSq1b+67RqedT6+qK6aICC8fEVmMS7jBn9wb0CAsu2mR6XZ92051nk91/X5fSk XSuicZ3lYif2s8SyKwl2pMRz2RbEc3k5BtewXw2vD+B0nDbHoPUMmpWitfuyB4upfhlG e6RY81FZ4H5JzX2/toWY9nvZWJ3nwB/7VWkoWkfQ/1OdQO5goYV0j9kt53hgMbwM2O10 DrLYmCbOGv8oNlYAJJTDUQKIF7qgskzg6kMW5+z4dVmcja2zboaEneixdffrWYpCZuMM zWNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=59KW1/d1Q5qOugGE9P25vaYuPz0Nun/7LCRNf8v9NXc=; b=SftUlQ9I88U/HYEgUs5ObNpB+KgcISsLTmb7HojtbfkhON28/lohpRTydkNHaNJs4C UlG1BkJlz21nnOEKILlkNqP+ZlcBinwFWfrY4COqtJktX/75RyRhVxSqQ1rAThkVspWS tc9gJMasnxO5bNQeYEWb96ivTeiR43K5Qk3TJ3Nzf/0bwF+T2vK6XvOHN7tgtGXgJWq6 fIXP22vSxcXVNtifQhOD/NUt6kzjK7zeOGMo3X0Z4RYbiJ7YHlGP8HWpoPDmNx1pBfoe gERvgE++uOfcwj5kmgQB4NzdZXn7IUGNFnxdil3rxRseYOB0/Zi9fB15knuf2LX3eyXV Udog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a02bX00P; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bt14-20020a17090af00e00b001e2d70eb5bcsi6958841pjb.48.2022.06.01.13.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:51:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a02bX00P; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2AD4720E6EB; Wed, 1 Jun 2022 12:54:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239416AbiE3PKj (ORCPT + 99 others); Mon, 30 May 2022 11:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242029AbiE3PKO (ORCPT ); Mon, 30 May 2022 11:10:14 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84C0F5F24E for ; Mon, 30 May 2022 07:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653919700; x=1685455700; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=4UKqK9LTE8r/QhEwT/GHcr6rLTi06cgfbkbko9SrhVU=; b=a02bX00PkLEw1zZo8rJ44HnsmPMSlgxEqFZA66rNstSySsZ3NMDdy2EE uKf2xGofMe8KL1+QYa0lJLkFcIJXKXdEoFmIDVL7R6K6zUjnjjXaHCxYN qRTHy9n464cRhnnJX4iUw6kk5myDzQ44rmOtyMcfIVYIjuyn4VWD8qq/2 Nv41L25/Msqf9hL9+Xj8e6MCCdW/D8qD3dBrsVDBkJoi/Zx/Ez9nSMzku 0bcMY7/XghUU2YFByYBELGJOztDj5Ta9w7o6RgHwKn0ROp2KSzmTzNEQm 5bUEA23Sj45qXQnufsmPBY9yuxwhDP6xjnBu9XqgWdlJoHSVMVvLf5PZD w==; X-IronPort-AV: E=McAfee;i="6400,9594,10363"; a="255497083" X-IronPort-AV: E=Sophos;i="5.91,263,1647327600"; d="scan'208";a="255497083" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 07:08:20 -0700 X-IronPort-AV: E=Sophos;i="5.91,263,1647327600"; d="scan'208";a="605206585" Received: from jkuna-mobl.ger.corp.intel.com (HELO localhost) ([10.249.150.228]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 07:08:14 -0700 From: Jani Nikula To: Arnd Bergmann Cc: Arnd Bergmann , Linus Torvalds , Sudip Mukherjee , Russell King , Viresh Kumar , Shiraz Hashim , Ville =?utf-8?B?U3lyasOkbMOk?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel , Linux Kernel Mailing List , Linux ARM , SoC Team , Julia Lawall Subject: Re: mainline build failure due to f1e4c916f97f ("drm/edid: add EDID block count and size helpers") In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <87a6aztli2.fsf@intel.com> <877d63tleq.fsf@intel.com> <87czfvrwsv.fsf@intel.com> Date: Mon, 30 May 2022 17:08:11 +0300 Message-ID: <874k17ru44.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, 30 May 2022, Arnd Bergmann wrote: > On Mon, May 30, 2022 at 3:10 PM Jani Nikula wrote: >> > >> > I think in general, most __packed annotations we have in the kernel are >> > completely pointless because they do not change the structure layout on >> > any architecture but instead just make member access slower on >> >> Please explain. >> >> They are used quite a bit for parsing blob data, or >> serialization/deserialization, like in the EDID case at hand. Try >> removing __attribute__((packed)) from include/drm/drm_edid.h and see the >> sizeof(struct edid) on any architecture. > > The annotations for edid are completely correct and necessary. However > other driver authors just slap __packed annotations on any structure > even if the layout is not fixed at all like: Right. Thanks for the examples. > 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. > 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. BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center