netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net,  netdev@vger.kernel.org,
	 edumazet@google.com, pabeni@redhat.com,  jiri@resnulli.us
Subject: Re: [PATCH net-next 4/4] tools: ynl: add --dbg-small-recv for easier kernel testing
Date: Mon, 04 Mar 2024 11:26:52 +0000	[thread overview]
Message-ID: <m2wmqijkzn.fsf@gmail.com> (raw)
In-Reply-To: <20240301230542.116823-5-kuba@kernel.org> (Jakub Kicinski's message of "Fri, 1 Mar 2024 15:05:42 -0800")

Jakub Kicinski <kuba@kernel.org> writes:

> Most "production" netlink clients use large buffers to
> make dump efficient, which means that handling of dump
> continuation in the kernel is not very well tested.
>
> Add an option for debugging / testing handling of dumps.
> It enables printing of extra netlink-level debug and
> lowers the recv() buffer size in one go. When used
> without any argument (--dbg-small-recv) it picks
> a very small default (4000), explicit size can be set,
> too (--dbg-small-recv 5000).
>
> Example:
>
> $ ./cli.py [...] --dbg-small-recv
> Recv: read 3712 bytes, 29 messages
>    nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
>  [...]
>    nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
> Recv: read 3968 bytes, 31 messages
>    nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
>  [...]
>    nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
> Recv: read 532 bytes, 5 messages
>    nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
>  [...]
>    nl_len = 128 (112) nl_flags = 0x0 nl_type = 19
>    nl_len = 20 (4) nl_flags = 0x2 nl_type = 3
>
> (the [...] are edits to shorten the commit message).
>
> Note that the first message of the dump is sized conservatively
> by the kernel.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  tools/net/ynl/cli.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/net/ynl/cli.py b/tools/net/ynl/cli.py
> index 0f8239979670..e8a65fbc3698 100755
> --- a/tools/net/ynl/cli.py
> +++ b/tools/net/ynl/cli.py
> @@ -38,6 +38,8 @@ from lib import YnlFamily, Netlink
>                          const=Netlink.NLM_F_APPEND)
>      parser.add_argument('--process-unknown', action=argparse.BooleanOptionalAction)
>      parser.add_argument('--output-json', action='store_true')
> +    parser.add_argument('--dbg-small-recv', default=0, const=4000,
> +                        action='store', nargs='?', type=int)

This breaks ynl if you don't use '--dbg-small-recv', it passes 0 which
fails the _recv_size check.

>      args = parser.parse_args()
>  
>      def output(msg):
> @@ -53,7 +55,10 @@ from lib import YnlFamily, Netlink
>      if args.json_text:
>          attrs = json.loads(args.json_text)
>  
> -    ynl = YnlFamily(args.spec, args.schema, args.process_unknown)
> +    ynl = YnlFamily(args.spec, args.schema, args.process_unknown,
> +                    recv_size=args.dbg_small_recv)
> +    if args.dbg_small_recv:
> +        ynl.set_recv_dbg(True)
>  
>      if args.ntf:
>          ynl.ntf_subscribe(args.ntf)

  reply	other threads:[~2024-03-04 11:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 23:05 [PATCH net-next 0/4] tools: ynl: add --dbg-small-recv for easier kernel testing Jakub Kicinski
2024-03-01 23:05 ` [PATCH net-next 1/4] tools: ynl: move the new line in NlMsg __repr__ Jakub Kicinski
2024-03-04 11:08   ` Donald Hunter
2024-03-01 23:05 ` [PATCH net-next 2/4] tools: ynl: allow setting recv() size Jakub Kicinski
2024-03-04 11:38   ` Donald Hunter
2024-03-04 13:38   ` Donald Hunter
2024-03-04 14:58     ` Jakub Kicinski
2024-03-04 15:57       ` Donald Hunter
2024-03-04 16:20         ` Jakub Kicinski
2024-03-01 23:05 ` [PATCH net-next 3/4] tools: ynl: support debug printing messages Jakub Kicinski
2024-03-04 11:34   ` Donald Hunter
2024-03-01 23:05 ` [PATCH net-next 4/4] tools: ynl: add --dbg-small-recv for easier kernel testing Jakub Kicinski
2024-03-04 11:26   ` Donald Hunter [this message]
2024-03-04 14:59     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2wmqijkzn.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).