> From: Thomas Monjalon [mailto:tho...@monjalon.net]
> Sent: Friday, 27 June 2025 19.35
> 
> 27/06/2025 18:38, Morten Brørup:
> > > From: Thomas Monjalon [mailto:tho...@monjalon.net]
> > > Sent: Friday, 27 June 2025 17.58
> > >
> > > 24/06/2025 10:03, Morten Brørup:
> > > > +               if ((ssize_t)page_size < 0)
> > > > +                       rte_panic("sysconf(_SC_PAGESIZE) failed: %s",
> > > > +                                       errno == 0 ? "Indeterminate" :
> > > strerror(errno));
> > >
> > > We don't want more rte_panic().
> > > You could log the problem and return 0 here.
> > > It will be a problem later, but it may allow the application to
> cleanup
> > > instead of abrupting crashing.
> >
> > Disagree.
> > That would be likely to cause crash with division by zero later.
> > Better to fail early.
> 
> Which division by zero?

Functions dividing by page size. E.g.:
https://elixir.bootlin.com/dpdk/v25.03/source/lib/eal/common/eal_common_memory.c#L313

> 
> I don't think a library should take this decision on behalf of the app.

I expect lots of things to break if sysconf(_SC_PAGESIZE) fails, so the purpose 
of this patch is to centralize error handling here, and only continue/return 
with non-failing values.

Otherwise, everywhere using rte_mem_page_size() or sysconf(_SC_PAGESIZE) should 
implement error handling (or ignore errors).
That's a lot of places, so I'm not going to provide a patch doing that.

Reply via email to