On Wed, Sep 02, 2026 at 08:35:47AM +0200, Jan Beulich wrote:
> While _set_status_v2() indeed doesn't alter the grant_entry_header_t it
> is handed a pointer to, _set_status_v1() does. Drop the const from the
> parameter of the latter (and then necessarily also from _set_status()'s),
> while adding const to the local variable of the former.
> 
> No functional change.
> 
> Signed-off-by: Jan Beulich <[email protected]>

Acked-by: Roger Pau Monné <[email protected]>

Could we also use a union in the functions themselves to avoid the cast?

union {
    const grant_entry_header_t *shah;
    uint32_t *raw;
} grant = { .shah = shah };

> ---
> Really I think it would be best if we did away with the raw_shah local
> variables (which looks reasonably simple for at least _set_status_v2()).
> I'm unconvinced that we really need to use ACCESS_ONCE() here. Torn reads
> aren't a problem; what we require is that we look at a stable local copy,
> and that can be achieved by putting barrier() after the reads.

Possibly - I would be fine with that, which kinds of render my
previous suggestion to use a union not very useful, if we can get rid
of those variables in the first place.

Thanks, Roger.

Reply via email to