Re: [RFC PATCH 7/9] btf_encoder: switch to shared elf_functions table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday, November 29th, 2024 at 2:35 PM, Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:

> 
> 
> On Thu, 2024-11-28 at 01:24 +0000, Ihor Solodrai wrote:
> 
> > Do not collect functions from ELF for each new btf_encoder, and
> > instead set a pointer to a shared elf_functions table, built
> > beforehand by btf_encoder__pre_cus__load_module().
> > 
> > Do not call btf_encoder__add_saved_funcs() on every
> > btf_encoder__add_encoder(). Instead, for non-reproducible
> > multi-threaded case do that in pahole_threads_collect(), and for
> > single-threaded or reproducible_build do that right before
> > btf_encoder__encode().
> > 
> > Signed-off-by: Ihor Solodrai ihor.solodrai@xxxxx
> > ---
> 
> 
> Acked-by: Eduard Zingerman eddyz87@xxxxxxxxx
> 
> 
> [...]
> 
> > diff --git a/pahole.c b/pahole.c
> > index 1f8cf4b..b5aea56 100644
> > --- a/pahole.c
> > +++ b/pahole.c
> > @@ -3185,12 +3185,16 @@ static int pahole_threads_collect(struct conf_load *conf, int nr_threads, void *
> > if (error)
> > goto out;
> > 
> > + err = btf_encoder__add_saved_funcs(btf_encoder);
> > + if (err < 0)
> > + goto out;
> > +
> > for (i = 0; i < nr_threads; i++) {
> > /*
> > * Merge content of the btf instances of worker threads to the btf
> > * instance of the primary btf_encoder.
> > */
> > - if (!threads[i]->btf)
> > + if (!threads[i]->encoder || !threads[i]->btf)
> > continue;
> 
> 
> When can 'threads[i]->encoder' be NULL? In case if worker thread exits with error?

IIRC if the number of CUs is less than number of jobs, the threads
array may contain NULL elements. I believe this was caught by testing
earlier versions of the patch.

> 
> > err = btf_encoder__add_encoder(btf_encoder, threads[i]->encoder);
> > if (err < 0)
> 
> 
> [...]





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux