Re: [PATCH] cpumask 5/10 rewrite cpumask.h - single bitmap basedimplementation
From: Andrew Morton
Date: Fri Jun 04 2004 - 04:48:51 EST
Mikael Pettersson <mikpe@xxxxxxxxx> wrote:
>
> Paul Jackson writes:
> > Perhaps I should comment the cpus_addr() definition as 'deprecated'?
>
> Please don't. cpus_addr() is useful when you need to get a
> handle on the representation for non-cpumask_t operations.
>
> Case in point: the perfctr kernel extension needs to communicate
> a cpumask_t to user-space because of the asymmetric nature of
> HT P4s. Unfortunately, a simple copy_to_user() won't work because:
> a) the size depends on kernel .config, and
> b) the representation is defined in terms of sequences of ulong,
> which breaks 32-bit applications on 64-bit kernels.
> So perfctr instead converts a cpumask_t to a sequence of uint,
> and copies both the number of uints and the uints themselves
> to user-space.
In that case the cpumask code should provide some API function which
converts a cpumask_t into (and from?) some canonical and documented form.
Then you copy what it gave you to userspace.
Particular pieces of code shouldn't go poking inside the cpumask_t's
representation. It's different on different architectures and we could
even change it in the future.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/