Re: git: fcaa890c4469 - main - mbuf: Only allow extpg mbufs if the system has a direct map

From: Mark Johnston <markj_at_freebsd.org>
Date: Sat, 21 May 2022 15:59:05 UTC
On Sat, May 21, 2022 at 06:58:39PM +0400, Sergey Kandaurov wrote:
> On Tue, 16 Nov 2021 at 22:52, Mark Johnston <markj@freebsd.org> wrote:
> 
> > The branch main has been updated by markj:
> >
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=fcaa890c4469118255d463495b4044eef484fa3e
> >
> > commit fcaa890c4469118255d463495b4044eef484fa3e
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2021-11-16 18:31:04 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2021-11-16 18:31:04 +0000
> >
> >     mbuf: Only allow extpg mbufs if the system has a direct map
> >
> >     Some upcoming changes will modify software checksum routines like
> >     in_cksum() to operate using m_apply(), which uses the direct map to
> >     access packet data for unmapped mbufs.  This approach of course does
> > not
> >     work on platforms without a direct map, so we have to disallow the use
> >     of unmapped mbufs on such platforms.
> >
> >     I believe this is the right tradeoff: we only configure KTLS on amd64
> >     and arm64 today (and one KTLS consumer, NFS TLS, requires a direct map
> >     already), and the use of unmapped mbufs with plain sendfile is a recent
> >     optimization.  If need be, m_apply() could be modified to create
> >     CPU-private mappings of extpg mbuf pages as a fallback.
> >
> >     So, change mb_use_ext_pgs to be hard-wired to zero on systems without a
> >     direct map.  Note that PMAP_HAS_DMAP is not a compile-time constant on
> >     some systems, so the default value of mb_use_ext_pgs has to be
> >     determined during boot.
> >
> >     Reviewed by:    jhb
> >     Discussed with: gallatin
> >     MFC after:      2 weeks
> >     Sponsored by:   The FreeBSD Foundation
> >     Differential Revision:  https://reviews.freebsd.org/D32940
> > ---
> >  sys/kern/kern_mbuf.c             | 32 ++++++++++++++++++++++++++++++--
> >  sys/rpc/rpcsec_tls/rpctls_impl.c |  2 +-
> >  2 files changed, 31 insertions(+), 3 deletions(-)
> >
> > diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
> > index d1f2fd2bd9e4..78a270189a4b 100644
> > --- a/sys/kern/kern_mbuf.c
> > +++ b/sys/kern/kern_mbuf.c
> > @@ -116,9 +116,26 @@ int nmbjumbop;                     /* limits number
> > of page size jumbo clusters */
> >  int nmbjumbo9;                 /* limits number of 9k jumbo clusters */
> >  int nmbjumbo16;                        /* limits number of 16k jumbo
> > clusters */
> >
> > -bool mb_use_ext_pgs = true;    /* use M_EXTPG mbufs for sendfile & TLS */
> > -SYSCTL_BOOL(_kern_ipc, OID_AUTO, mb_use_ext_pgs, CTLFLAG_RWTUN,
> > +bool mb_use_ext_pgs = false;   /* use M_EXTPG mbufs for sendfile & TLS */
> >
> 
> Hi,
> 
> Does it mean that mb_use_ext_pgs has to be enabled manually now
> in head and releng/13.1 ? (it was on by default in releng/13.0)
> I failed to see how it still can be on by default from this change.
> 
> What about initializing to true under #if PMAP_HAS_DMAP ?

This is my mistake.  The intent was to have mb_use_ext_pgs set to true
when there is a direct map.  I fixed the problem in main, but failed to
MFC the fixup. :(

I've merged the fixup to stable/13 now.  We could release an EN for
this, but there is a simple workaround at least.