Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1324083lqt; Tue, 19 Mar 2024 23:14:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXhNA3N3QJN3ed9DcN89rXQ/UuNYc9WjGq2B6I0dnBw8gIj4SJaX3cqysfW180KxqzSomKIsW6dlaDa7RXtkZBkeXnfIUlV30CAA+6nJg== X-Google-Smtp-Source: AGHT+IF16lXRREwU6dzfTHMnjL0Naak3+Ptdd/qBxVbSZJGG9J2VwRdZpFK40b7Sc0qAX0mkMvI4 X-Received: by 2002:a05:620a:462b:b0:78a:1eda:4c08 with SMTP id br43-20020a05620a462b00b0078a1eda4c08mr1705051qkb.77.1710915262952; Tue, 19 Mar 2024 23:14:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710915262; cv=pass; d=google.com; s=arc-20160816; b=OyoJOduUiyEA69Yqr8zYBoiFX2iTxCUr49cbhoDZqlj/ng+/9M8rbffRtFyBz7NMRa L24F1PrJ0tf5AAj+HivxanQsuIF0bhyviL2zieJnY5JXrB89aeKJBmYaKmHUeWoGDB+l dqGNET29vVNQBQkyAIaGLtj7VFSwW60i/X215fdvYTCGVv/acYyH0o8wZ4YNHOEjwrrI A/8+g4pPpT0smheof1Pba6+OwkjgPmUsiANi5K3kgwhPWpAGlcp9AaDiVG5LuW3ZDvA7 GLMTWegfV2l6dnnxcmORqN5DWJ+ndMx/QOn4eZmjEnqoh2SoiI5JxDQEayJedSSa6Qiq dyWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=PM9nMc41ADKyGZTy12/RGWjJCZ6ZCtRC9lOyLcRYv54=; fh=Wo+OB/zUZLgwxDoUM7qi03HsXRpQXETWUIrp0+6tqck=; b=lvnVqV3ZmQqHY/sB+u3ZjXo9SWk7gcwKijzN9KK2H94CVbvL0EUlXhm5gSiGsGldo8 b7coQ0yv4cz8n8n1lq83Zo4X0HeymivWo8Z+AEn3mf20xLgVvl2KWU7YBeRneG2/ZPVf tJKiX5uMqMGFvkS+3PyvKnJ9E2k9aZGNx6t+7R88LrqPw/OJeJ/Xelws73uM+fg8CXMJ J5eaH0q4Y1bp/14O17ubh2qkxEHt/JOWVcRY4FzAZdpVUHqUkZ/YuBxZ4zYcphcqz5Wi MXrUIdZggoLCI8+1XT/QkABGLqtZI3F7DFak+icw/1/hrCqmGIC3yS1/MLZYat32ICwf 37kw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Aa9VgBo5; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-108485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108485-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a6-20020a05620a066600b00789ed541240si8689864qkh.330.2024.03.19.23.14.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 23:14:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Aa9VgBo5; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-108485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108485-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 985821C22089 for ; Wed, 20 Mar 2024 06:14:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D27C182A1; Wed, 20 Mar 2024 06:14:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Aa9VgBo5" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAC88179B7 for ; Wed, 20 Mar 2024 06:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710915255; cv=none; b=GYf/ujmQz28sfQbpZ1no5/rgQSqNV3Lfadx+YmVVT73t0BUat7Ff7yoo1mIj4Dg88UH7YV3zLU4g0mvrz8SbhI9A8X5bNZWmKMbcrAFIkJD09OqMbHzhEfUhiP8n3FS4YfA8K2KvVnJjQLDhuz5g5er3VeVQ1Dfk6ZFtY660Gxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710915255; c=relaxed/simple; bh=snOyPHld+qgFruG1hDUnAYVoP1xl95J5yKDm39XL5Kg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=f5hELZWJWV5x/DKYc9KajAZgKxZ/ZCsRpE+M6yX808+6q7j9dIFc9aWdvQaOo8lIq0F5hegjvCrOLgOx9BOPRXPKzZ5c/REns1hjJaUrmUtDkkdbumFAVMQ9seGAc8h65QWoPOYGu4ONCS4qKn56lgvHFYv0a9PDP2zblpYjkCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Aa9VgBo5; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from [192.168.88.20] (91-154-34-181.elisa-laajakaista.fi [91.154.34.181]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 16D353F1; Wed, 20 Mar 2024 07:13:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710915224; bh=snOyPHld+qgFruG1hDUnAYVoP1xl95J5yKDm39XL5Kg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Aa9VgBo5kgJXZbZS8oWTc0Rdeu+GwUcp1l/Wy3A6cccUgR4rZBEDRT+0Q8/Hud/SJ FmfwGh+Tbc4+0IOESvXIle8Qz5uinbqQ/BA4Lsv4x6TbYQuHgw/wguHz0CTQQWVuPo mZxEXZbX9kr9yaI5Y9hYW3FAJSIIYu25/xR/jiwY= Message-ID: <0fdbb6e4-6be8-4a21-8cf3-2a419b4b44ed@ideasonboard.com> Date: Wed, 20 Mar 2024 08:14:08 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 4/8] drm: zynqmp_dp: Rearrange zynqmp_dp for better padding Content-Language: en-US To: Sean Anderson Cc: Michal Simek , David Airlie , linux-kernel@vger.kernel.org, Daniel Vetter , linux-arm-kernel@lists.infradead.org, Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org References: <20240319225122.3048400-1-sean.anderson@linux.dev> <20240319225122.3048400-5-sean.anderson@linux.dev> From: Tomi Valkeinen Autocrypt: addr=tomi.valkeinen@ideasonboard.com; keydata= xsFNBE6ms0cBEACyizowecZqXfMZtnBniOieTuFdErHAUyxVgtmr0f5ZfIi9Z4l+uUN4Zdw2 wCEZjx3o0Z34diXBaMRJ3rAk9yB90UJAnLtb8A97Oq64DskLF81GCYB2P1i0qrG7UjpASgCA Ru0lVvxsWyIwSfoYoLrazbT1wkWRs8YBkkXQFfL7Mn3ZMoGPcpfwYH9O7bV1NslbmyJzRCMO eYV258gjCcwYlrkyIratlHCek4GrwV8Z9NQcjD5iLzrONjfafrWPwj6yn2RlL0mQEwt1lOvn LnI7QRtB3zxA3yB+FLsT1hx0va6xCHpX3QO2gBsyHCyVafFMrg3c/7IIWkDLngJxFgz6DLiA G4ld1QK/jsYqfP2GIMH1mFdjY+iagG4DqOsjip479HCWAptpNxSOCL6z3qxCU8MCz8iNOtZk DYXQWVscM5qgYSn+fmMM2qN+eoWlnCGVURZZLDjg387S2E1jT/dNTOsM/IqQj+ZROUZuRcF7 0RTtuU5q1HnbRNwy+23xeoSGuwmLQ2UsUk7Q5CnrjYfiPo3wHze8avK95JBoSd+WIRmV3uoO rXCoYOIRlDhg9XJTrbnQ3Ot5zOa0Y9c4IpyAlut6mDtxtKXr4+8OzjSVFww7tIwadTK3wDQv Bus4jxHjS6dz1g2ypT65qnHen6mUUH63lhzewqO9peAHJ0SLrQARAQABzTBUb21pIFZhbGtl aW5lbiA8dG9taS52YWxrZWluZW5AaWRlYXNvbmJvYXJkLmNvbT7CwY4EEwEIADgWIQTEOAw+ ll79gQef86f6PaqMvJYe9QUCX/HruAIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRD6 PaqMvJYe9WmFD/99NGoD5lBJhlFDHMZvO+Op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type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20/03/2024 00:51, Sean Anderson wrote: > Sort the members of struct zynqmp_dp to reduce padding necessary for > alignment. > > Signed-off-by: Sean Anderson > --- > > Changes in v2: > - New > > drivers/gpu/drm/xlnx/zynqmp_dp.c | 28 ++++++++++++++-------------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c > index 8635b5673386..f1834c8e3c02 100644 > --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c > +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c > @@ -255,10 +255,10 @@ struct zynqmp_dp_link_config { > * @fmt: format identifier string > */ > struct zynqmp_dp_mode { > - u8 bw_code; > - u8 lane_cnt; > - int pclock; > const char *fmt; > + int pclock; > + u8 bw_code; > + u8 lane_cnt; > }; > > /** > @@ -295,27 +295,27 @@ struct zynqmp_dp_config { > * @train_set: set of training data > */ > struct zynqmp_dp { > + struct drm_dp_aux aux; > + struct drm_bridge bridge; > + struct delayed_work hpd_work; > + > + struct drm_bridge *next_bridge; > struct device *dev; > struct zynqmp_dpsub *dpsub; > void __iomem *iomem; > struct reset_control *reset; > - int irq; > - > - struct drm_bridge bridge; > - struct drm_bridge *next_bridge; > - > - struct zynqmp_dp_config config; > - struct drm_dp_aux aux; > struct phy *phy[ZYNQMP_DP_MAX_LANES]; > - u8 num_lanes; > - struct delayed_work hpd_work; > + > enum drm_connector_status status; > + int irq; > bool enabled; > > - u8 dpcd[DP_RECEIVER_CAP_SIZE]; > - struct zynqmp_dp_link_config link_config; > struct zynqmp_dp_mode mode; > + struct zynqmp_dp_link_config link_config; > + struct zynqmp_dp_config config; > + u8 dpcd[DP_RECEIVER_CAP_SIZE]; > u8 train_set[ZYNQMP_DP_MAX_LANES]; > + u8 num_lanes; > }; > > static inline struct zynqmp_dp *bridge_to_dp(struct drm_bridge *bridge) If you change the order of the fields, you should change the order in the kernel doc accordingly. To be honest, I'm not sure if I like this patch. We have usually one instance of these structs allocated. How many bytes do we save? I'm fine with getting easy savings by changing the field order in some cases, but I think the "human" side of the order is important too: usually the fields are grouped in some way, and ordered so that the more base or generic ones are first, and fields for some specific feature are later. And fields protected by a lock should be grouped together, with their lock being first/last in that group. Looking at the zynqmp_dp struct with this patch, I get an urge to start moving things around: dev, dpsub, iomem, etc first, hpd somewhere later. Base config fields like config, num_lanes, irq would be grouped together. Etc. Tomi