Re: [PATCH v2] drm/ttm: Silence randstruct warning about casting struct file

From: Matthew Brost
Date: Fri May 02 2025 - 00:51:34 EST


On Fri, May 02, 2025 at 05:31:49AM +0100, Al Viro wrote:
> On Thu, May 01, 2025 at 09:26:25PM -0700, Matthew Brost wrote:
>
> > I;m fairly certain is just aliasing... but I do understand a file cannot
> > be embedded. Would comment help here indicating no other fields should
> > be added to ttm_backup without struct file be converted to pointer or
> > that just to risky?
>
> What exactly are you trying to do there? IOW, is that always supposed to
> be a struct file, or something dependent upon something in struct ttm_tt
> instance, or...?

Create an opaque ttm_backup object for the rest of TTM / drivers to view
- it could change if the backup implementation changed.

>
> And what is the lifecycle of that thing? E.g. what is guaranteed about
> ttm_backup_fini() vs. functions accessing the damn thing? Are they
> serialized on something/tied to lifecycle stages of struct ttm_tt?

I believe the life cycle is when ttm_tt is destroyed or api allows
overriding the old backup with a new one (currently unused).

Matt