Re: [PATCH v3] drivers/base/node.c: fix userspace break from using bin_attributes for cpumap and cpulist

From: Phil Auld
Date: Thu Jul 14 2022 - 10:04:26 EST


On Thu, Jul 14, 2022 at 08:59:25AM -0400 Phil Auld wrote:
> On Thu, Jul 14, 2022 at 12:23:01PM +1200 Barry Song wrote:
> > btw, we have a lot of other places which might need this, such as
> > drivers/base/topology.c
> >
> > so perhaps we can move them to some common place,
> >
> > #define cpu_bitmap_bytes (((NR_CPUS >> 1) > PAGE_SIZE) ? NR_CPUS >> 1
> > : PAGE_SIZE)
> > #define cpu_list_bytes (((NR_CPUS * 7) > PAGE_SIZE) ? NR_CPUS * 7 : PAGE_SIZE)
> >
> > is include/linux/cpumask.h a good place for it?

drivers/base/base.h does not look like the right place, so I think your cpumask.h idea
is better. I'll put in there and update the topology.c BIN_ATTRs.

Thanks,
Phil

>
> My concern is the ones that are breaking actual userspace code. But yes, those
> otherwise have the same 0 size.
>
> It seems somewhat specific to drivers/base. Maybe there's a less global place to
> put those closer. I can look and do it this way if that will help get it fixed.
>
>
> Cheers,
> Phil
>
> >
> > > /**
> > > * struct node_access_nodes - Access class device to hold user visible
> > > --
> > > 2.31.1
> > >
> >
> > Thanks
> > Barry
> >
>
> --

--