Bug 278822 - Errors in building the kernel config with its own value MSGBUF_SIZE, MCLSHIFT and NBUF
Summary: Errors in building the kernel config with its own value MSGBUF_SIZE, MCLSHIFT...
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-07 00:53 UTC by Vladyslav V. Prodan
Modified: 2024-05-08 14:37 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladyslav V. Prodan 2024-05-07 00:53:58 UTC
FreeBSD 14.1-PRERELEASE #0 stable/14-n267586-19e335596658: Thu May  2 20:41:56 UTC 2024
# cat /usr/src/.gituprevision
stable/14:45764d1d4

# cat << EOF >> /usr/src/sys/amd64/conf/test-14-0

include GENERIC
ident test-14-0
hints   "GENERIC.hints" # Default places to look for devices.

# Size of the kernel message buffer.  Should be N * pagesize.
options		MSGBUF_SIZE=40960

## mbuf
options		MCLSHIFT=12			# mbuf cluster shift in bits, 12 == 4KB
options		MSIZE=512			# mbuf size in bytes

options		MBUF_PROFILING
options		NBUF=1024			# Number of buffer headers

EOF

When building stable/13 (13.3-STABLE d9ec850bd) there is no such problem.


cc -target x86_64-unknown-freebsd14.1 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -c -O2 -pipe  -fno-strict-aliasing  -g -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -I/usr/src/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common    -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD  -MF.depend.freebsd32_misc.o -MTfreebsd32_misc.o -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -fdebug-prefix-map=./i386=/usr/src/sys/i386/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length   -mno-aes -mno-avx  -std=gnu99 -Werror /usr/src/sys/compat/freebsd32/freebsd32_misc.c
In file included from /usr/src/sys/compat/freebsd32/freebsd32_misc.c:57:
/usr/src/sys/sys/mbuf.h:887:7: error: duplicate case value '4096'
  887 |         case MJUMPAGESIZE:
      |              ^
/usr/src/sys/sys/param.h:205:22: note: expanded from macro 'MJUMPAGESIZE'
  205 | #define MJUMPAGESIZE    PAGE_SIZE
      |                         ^
./machine/param.h:98:19: note: expanded from macro 'PAGE_SIZE'
   98 | #define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
      |                         ^
/usr/src/sys/sys/mbuf.h:884:7: note: previous case defined here
  884 |         case MCLBYTES:
      |              ^
/usr/src/sys/sys/param.h:202:18: note: expanded from macro 'MCLBYTES'
  202 | #define MCLBYTES        (1 << MCLSHIFT) /* size of an mbuf cluster */
      |                         ^
In file included from /usr/src/sys/compat/freebsd32/freebsd32_misc.c:57:
/usr/src/sys/sys/mbuf.h:935:7: error: duplicate case value '4096'
  935 |         case MJUMPAGESIZE:
      |              ^
/usr/src/sys/sys/param.h:205:22: note: expanded from macro 'MJUMPAGESIZE'
  205 | #define MJUMPAGESIZE    PAGE_SIZE
      |                         ^
./machine/param.h:98:19: note: expanded from macro 'PAGE_SIZE'
   98 | #define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
      |                         ^
/usr/src/sys/sys/mbuf.h:932:7: note: previous case defined here
  932 |         case MCLBYTES:
      |              ^
/usr/src/sys/sys/param.h:202:18: note: expanded from macro 'MCLBYTES'
  202 | #define MCLBYTES        (1 << MCLSHIFT) /* size of an mbuf cluster */
      |                         ^
2 errors generated.
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/test-14-0
       14.46 real         4.05 user        10.24 sys
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2024-05-07 00:57:30 UTC
This looks like a consequence of commit 840327e5ddf30.

But, why are you changing the mbuf and mbuf cluster size?
Comment 2 Vladyslav V. Prodan 2024-05-07 01:11:54 UTC
(In reply to Mark Johnston from comment #1)

This is how it happened historically, somewhere around release/10.
This is my attempt to allocate a lot of memory to network/buffers at once.

In FreeBSD 12.3-STABLE #0 r372168M: Sat Jun 25 20:34:53 EEST 2022:

# netstat -m
9378/4347/13725 mbufs in use (current/cache/total)
5164/3880/9044/125007 mbuf clusters in use (current/cache/total/max)
47/1477 mbuf+clusters out of packet secondary zone in use (current/cache)
0/254/254/62503 4k (page size) jumbo clusters in use (current/cache/total/max)
0/0/0/18519 9k jumbo clusters in use (current/cache/total/max)
0/0/0/10417 16k jumbo clusters in use (current/cache/total/max)
12672K/9862K/22535K bytes allocated to network (current/cache/total)
0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters)
0/0/0 requests for mbufs delayed (mbufs/clusters/mbuf+clusters)
0/0/0 requests for jumbo clusters delayed (4k/9k/16k)
0/0/0 requests for jumbo clusters denied (4k/9k/16k)
0 sendfile syscalls
0 sendfile syscalls completed without I/O request
0 requests for I/O initiated by sendfile
0 pages read by sendfile as part of a request
0 pages were valid at time of a sendfile request
0 pages were valid and substituted to bogus page
0 pages were requested for read ahead by applications
0 pages were read ahead by sendfile
0 times sendfile encountered an already busy page
0 requests for sfbufs denied
0 requests for sfbufs delayed
Comment 3 Vladyslav V. Prodan 2024-05-07 01:25:05 UTC
(In reply to Vladyslav V. Prodan from comment #2)

Sorry, here is the output from version 12.3:

# netstat -m
2090/11766/13856 mbufs in use (current/cache/total)
2047/2862/4909/400000 mbuf clusters in use (current/cache/total/max)
0/1012 mbuf+clusters out of packet secondary zone in use (current/cache)
0/0/0/125132 4k (page size) jumbo clusters in use (current/cache/total/max)
0/0/0/37076 9k jumbo clusters in use (current/cache/total/max)
0/0/0/20855 16k jumbo clusters in use (current/cache/total/max)
9233K/17331K/26564K bytes allocated to network (current/cache/total)
0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters)
0/0/0 requests for mbufs delayed (mbufs/clusters/mbuf+clusters)
0/0/0 requests for jumbo clusters delayed (4k/9k/16k)
0/0/0 requests for jumbo clusters denied (4k/9k/16k)
0 sendfile syscalls
0 sendfile syscalls completed without I/O request
0 requests for I/O initiated by sendfile
0 pages read by sendfile as part of a request
0 pages were valid at time of a sendfile request
0 pages were valid and substituted to bogus page
0 pages were requested for read ahead by applications
0 pages were read ahead by sendfile
0 times sendfile encountered an already busy page
0 requests for sfbufs denied
0 requests for sfbufs delayed
Comment 4 Vladyslav V. Prodan 2024-05-07 20:14:34 UTC
(In reply to Vladyslav V. Prodan from comment #0)

I rethought these 5 options and decided that I don't need to change them in my kernel config.
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2024-05-08 14:37:50 UTC
(In reply to Vladyslav V. Prodan from comment #4)
Ok, let's close the bug then.  If there's a strong reason to support MCLSIZE == MJUMPAGESIZE, we can consider re-adding it, but I don't see it at the moment.