mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kuehling, Felix" <felix.kuehling@amd.com>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] drm/amdgpu/amdkfd: Avoid a couple hundred -Wflex-array-member-not-at-end warnings
Date: Tue, 2 Sep 2025 11:11:29 -0400	[thread overview]
Message-ID: <7a25b5ae-b995-431b-bd46-6d2d58d18e36@amd.com> (raw)
In-Reply-To: <aLF5vQv9P_vp0R6_@kspp>

On 2025-08-29 5:58 a.m., Gustavo A. R. Silva wrote:
> -Wflex-array-member-not-at-end was introduced in GCC-14, and we are
> getting ready to enable it, globally.
>
> Move the conflicting declarations to the end of the corresponding
> structures. Notice that `struct dev_pagemap` is a flexible structure,
> this is a structure that contains a flexible-array member.
>
> Fix 283 of the following type of warnings:
>      283 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:111:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thank you. I'll apply this to amd-staging-drm-next. I'll also add a note 
to the commit description that struct dev_pagemap always has space for 
at least one range, and that amdgpu only uses a single range. Therefore 
no changes are needed in the way struct amdgpu_device is allocated.

Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 8 +++++---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 8 +++++---
>   2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index ddd472e56f69..24f3e5cfbe5d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1155,9 +1155,6 @@ struct amdgpu_device {
>   	/* for userq and VM fences */
>   	struct amdgpu_seq64		seq64;
>   
> -	/* KFD */
> -	struct amdgpu_kfd_dev		kfd;
> -
>   	/* UMC */
>   	struct amdgpu_umc		umc;
>   
> @@ -1320,6 +1317,11 @@ struct amdgpu_device {
>   	struct mutex                    userq_mutex;
>   	bool                            userq_halt_for_enforce_isolation;
>   	struct amdgpu_uid *uid_info;
> +
> +	/* KFD
> +	 * Must be last --ends in a flexible-array member.
> +	 */
> +	struct amdgpu_kfd_dev		kfd;
>   };
>   
>   static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> index 33eb4826b58b..127927b16ee2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
> @@ -107,11 +107,13 @@ struct amdgpu_kfd_dev {
>   	bool init_complete;
>   	struct work_struct reset_work;
>   
> -	/* HMM page migration MEMORY_DEVICE_PRIVATE mapping */
> -	struct dev_pagemap pgmap;
> -
>   	/* Client for KFD BO GEM handle allocations */
>   	struct drm_client_dev client;
> +
> +	/* HMM page migration MEMORY_DEVICE_PRIVATE mapping
> +	 * Must be last --ends in a flexible-array member.
> +	 */
> +	struct dev_pagemap pgmap;
>   };
>   
>   enum kgd_engine_type {

  reply	other threads:[~2025-09-02 15:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  9:58 Gustavo A. R. Silva
2025-09-02 15:11 ` Kuehling, Felix [this message]
2025-09-03  8:36   ` Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a25b5ae-b995-431b-bd46-6d2d58d18e36@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavoars@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®