[RFC PATCH 3/5] RISC-V: hwprobe: Introduce which-cpus flag

Andrew Jones ajones at ventanamicro.com
Mon Sep 25 05:12:35 PDT 2023


On Mon, Sep 25, 2023 at 04:23:29AM -0700, Palmer Dabbelt wrote:
> On Thu, 21 Sep 2023 05:55:22 PDT (-0700), ajones at ventanamicro.com wrote:
...
> > @@ -274,11 +405,24 @@ static int do_riscv_hwprobe(struct riscv_hwprobe __user *pairs,
> >  		if (ret)
> >  			return -EFAULT;
> > 
> > +		cpumask_and(&cpus, &cpus, cpu_online_mask);
> > +
> > +		if (which_cpus) {
> > +			if (cpumask_empty(&cpus))
> > +				cpumask_copy(&cpus, cpu_online_mask);
> > +			ret = hwprobe_which_cpus(pairs, pair_count, cpusetsize, &cpus);
> > +			if (ret)
> > +				return ret;
> > +			ret = copy_to_user(cpus_user, &cpus, cpusetsize);
> > +			if (ret)
> > +				return -EFAULT;
> > +			return 0;
> 
> So this is now essentailly two syscalls.  IMO it'd be cleaner to split out
> the implementations into two functions (ie,
> hwprobe_{which_cpus,which_featurs}() or whatever) rather than have an early
> out and the rest inline.
> 
> Also: maybe we want a whole hwprobe file?  It's sort of its own thing now,
> and it's only going to get bigger...

I'll do both for v1.

Thanks,
drew



More information about the linux-riscv mailing list