Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AC80C433F5 for ; Mon, 30 May 2022 13:10:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E08910E608; Mon, 30 May 2022 13:10:19 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id D51AD10E3A2 for ; Mon, 30 May 2022 13:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653916217; x=1685452217; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=yR4CvAYEHnhJy9L0L3rshOUShjBlml110o6x0DwIo1A=; b=bNJnMaN128o2MDfFBoSJHSHSkB7Bkc0rDOCb0YBD4XB4pM2+PomCkTFV RVW3RR0qhQzoWU4GxO8ih2qlYGWtX/ZWjouTSHNF5rhnpx0n6jPJ80LQ3 kjE+IiVGrjcRGVUSs7iVBUrBpEM2KBhFYycStnunNt1bW23OyhfPiPX3h 55Zye64RkL1KIs6miznd/+t4ktu9twZq1BzbS+Lg+PXa05Q0I9NV68DQx AUMg8HhlMEfRTkCXh20CKUS336bE8kR473MFxoPkWJ7qHR/zn+S4mh6dF xAbhJMpFdd63dWz2mvZ+L60Xv5gL9rl3IdnSQRPRmUhAngzdVjKJu0oKe A==; X-IronPort-AV: E=McAfee;i="6400,9594,10362"; a="361374142" X-IronPort-AV: E=Sophos;i="5.91,262,1647327600"; d="scan'208";a="361374142" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2022 06:10:16 -0700 X-IronPort-AV: E=Sophos;i="5.91,263,1647327600"; d="scan'208";a="605183061" 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 06:10:10 -0700 From: Jani Nikula To: Arnd Bergmann 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> Date: Mon, 30 May 2022 16:10:08 +0300 Message-ID: <87czfvrwsv.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux ARM , Arnd Bergmann , David Airlie , Viresh Kumar , Russell King , Linux Kernel Mailing List , Linus Torvalds , SoC Team , dri-devel , Thomas Zimmermann , Shiraz Hashim , Sudip Mukherjee Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, 30 May 2022, Arnd Bergmann wrote: > On Mon, May 30, 2022 at 11:33 AM Jani Nikula wrote: >> >> That is, for EDID. Makes you wonder about all the other packed structs >> with enum members across the kernel. > > It is not the 'enum' that is special here, it's the 'union' having > unpacked members, Obviously meant union not enum, that was just a -ENOCOFFEE on my part. > and the same thing happens when you have nested structs: both the inner > and the outer aggregate need to be packed, either with __packed at the > end, or on each individual member that is not fully aligned to > max(sizeof(member), 4)). > > 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. BR, Jani. > architectures that lack unaligned load/store instructions. There have > definitely been other cases though where a __packed annotation is > not needed on any sane architecture but is needed for OABI ARM. > > Overall I'm not that worried because the only machines running OABI > kernels would be on really old hardware that runs a limited set of > driver code. > > A completely different matter are the extraneous __packed annotations > that lead to possible problems when accessed through a misaligned > pointer. We ignore -Waddress-of-packed-member and -Wcast-align > in the kernel, so these never get caught at build time, but we have > seen bugs from gcc making incorrect assumptions about alignment > even on architectures that have unaligned load/store instructions. > > Arnd -- Jani Nikula, Intel Open Source Graphics Center