[dpdk-dev] [PATCH v6 04/11] eal/mem: extract common code for memseg list initialization
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Wed Jun 10 16:31:51 CEST 2020
On Wed, 10 Jun 2020 11:26:22 +0100
"Burakov, Anatoly" <anatoly.burakov at intel.com> wrote:
[snip]
> >>> + addr = eal_get_virtual_area(
> >>> + msl->base_va, &mem_sz, page_sz, 0, reserve_flags);
> >>> + if (addr == NULL) {
> >>> +#ifndef RTE_EXEC_ENV_WINDOWS
> >>> + /* The hint would be misleading on Windows, but this function
> >>> + * is called from many places, including common code,
> >>> + * so don't duplicate the message.
> >>> + */
> >>> + if (rte_errno == EADDRNOTAVAIL)
> >>> + RTE_LOG(ERR, EAL, "Cannot reserve %llu bytes at [%p] - "
> >>> + "please use '--" OPT_BASE_VIRTADDR "' option\n",
> >>> + (unsigned long long)mem_sz, msl->base_va);
> >>> + else
> >>> + RTE_LOG(ERR, EAL, "Cannot reserve memory\n");
> >>> +#endif
> >>
> >> You're left without any error messages on Windows. How about:
> >>
> >> const char *err_str = "Cannot reserve memory\n";
> >> #ifndef RTE_EXEC_ENV_WINDOWS
> >> if (rte_errno == EADDRNOTAVAIL)
> >> err_str = ...
> >> #endif
> >> RTE_LOG(ERR, EAL, err_str);
> >>
> >> or something like that?
> >>
> >
> > How about removing generic error message here completely and printing more
> > specific messages at call sites? In fact, almost all of them already do this.
> > It would be more helpful in tracking down errors.
> >
>
> Agreed, let's do that :) We do pass up the rte_errno, correct? So, we
> should be able to do that.
Actually, callers don't need rte_errno, because we only have to distinguish
EADDRNOTAVAIL here, and eal_get_virtual_area() already prints precise
diagnostics at WARNING and ERR level. rte_errno is preserved, however.
--
Dmitry Kozlyuk
More information about the dev
mailing list