From: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
To: no-reply@sashiko.virtuozzo.com, ptikhomirov@virtuozzo.com,
vasileios.almpanis@virtuozzo.com,
Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v3 3/6] ve/printk: Specify ve in printks
Date: Mon, 26 Oct 2026 16:27:27 +0100 [thread overview]
Message-ID: <3796e8c6-7ad9-4e12-ba48-631a1970fe3a@virtuozzo.com> (raw)
In-Reply-To: <010701a12d345369-5d179f41-d21a-45b0-82e2-87a06104ee54-000000@eu-central-1.amazonses.com>
On 10/12/26 01:02, no-reply@sashiko.virtuozzo.com wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] ve/ratelimit: global net_ratelimit_state mixes suppressed counts across VEs
> --
>
> commit e1b1b77160f4d75abebd7d4609682186ec201a82
> Author: Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>
>
> ve/printk: Specify ve in printks
>
> This commit adds ve_printk helpers that take an explicit VE pointer, so
> that printing and ratelimiting no longer depend on get_exec_env() where it
> is unreliable. The VE requirement is forwarded through ve_net_ratelimit()
> and the net_velog_ratelimited()/net_veboth_ratelimited() macros, and the
> netfilter callers now pass net->owner_ve.
>
> Link: https://virtuozzo.atlassian.net/browse/VSTOR-146839
>
>> diff --git a/lib/ratelimit.c b/lib/ratelimit.c
>> --- a/lib/ratelimit.c
>> +++ b/lib/ratelimit.c
>
> [ ... ]
>
>> @@ -55,7 +56,7 @@ int __ve_ratelimit(int dst, struct ve_struct *ve, struct ratelimit_state *rs, const char *func)
>>
>> if (m) {
>> if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
>> - ve_printk_deferred(dst, KERN_WARNING
>> + ve_printk_deferred(dst, ve, KERN_WARNING
>> "%s: %d callbacks suppressed\n", func, m);
>> }
>> }
>
> [Severity: Low]
> This isn't a regression in the new interface, but the miss count printed
> here comes from the shared ratelimit_state, so it includes suppressions
> caused by every VE. Is it intended that the aggregated count is written
> only into the log of whichever VE happens to reset the interval?
>
> The shared state is defined once in net/core/utils.c:
>
> net/core/utils.c:
> DEFINE_RATELIMIT_STATE(net_ratelimit_state, 5 * HZ, 10);
> ...
> int ve_net_ratelimit(int dst, struct ve_struct *ve)
> {
> return ve_ratelimit(dst, ve, &net_ratelimit_state);
> }
>
> For example, if a container fills its own conntrack table and triggers
> net_veboth_ratelimited() in __nf_conntrack_alloc(), the "N callbacks
> suppressed" notice in another VE's log can include misses from the first
> VE. A busy VE can also consume the shared burst of 10 per 5 seconds and
> suppress the netfilter warnings of other VEs.
>
> This patch now makes the target VE explicit, but the ratelimit_state
> remains global. Would a per-VE ratelimit_state be needed for the ve
> argument to give per-VE behaviour?
I don't see an easy solution for this.
Printing to host isn't very helpful - it will just print ratelimit
message.
Adding per-VE ratelimits is a bad idea. So yes, somebody may miss
log message if another CT is spamming them.
>
--
Best regards, Riabchun Vladimir
Linux Kernel Developer, Virtuozzo
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-10-26 15:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 22:52 [Devel] [PATCH hci-8.1 v3 0/6] ve/printk: Fix logs leakage via ve_printk called from IRQ context Vladimir Riabchun
2026-10-11 22:52 ` [Devel] [PATCH hci-8.1 v3 1/6] ve/printk: Add sanity checks in ve_printk functions Vladimir Riabchun
2026-10-11 22:57 ` no-reply
2026-10-11 22:52 ` [Devel] [PATCH hci-8.1 v3 2/6] ve/printk: Report potentially leaking usage of " Vladimir Riabchun
2026-10-11 22:59 ` no-reply
2026-10-26 15:21 ` Vladimir Riabchun
2026-10-11 22:52 ` [Devel] [PATCH hci-8.1 v3 3/6] ve/printk: Specify ve in printks Vladimir Riabchun
2026-10-11 23:02 ` no-reply
2026-10-26 15:27 ` Vladimir Riabchun [this message]
2026-10-11 22:52 ` [Devel] [PATCH hci-8.1 v3 4/6] ve/printk: Fix time virtualization Vladimir Riabchun
2026-10-11 23:03 ` no-reply
2026-10-26 15:36 ` Vladimir Riabchun
2026-10-11 22:52 ` [Devel] [PATCH hci-8.1 v3 5/6] ve/failcount: Use ve_printk with specified ve Vladimir Riabchun
2026-10-11 23:05 ` no-reply
2026-10-11 22:52 ` [Devel] [PATCH hci-8.1 v3 6/6] ve: add neigh_tbl failcounter Vladimir Riabchun
2026-10-11 23:04 ` no-reply
2026-10-12 7:59 ` Vasileios Almpanis
2026-10-12 7:59 ` [Devel] [PATCH hci-8.1 v3 0/6] ve/printk: Fix logs leakage via ve_printk called from IRQ context Vasileios Almpanis
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=3796e8c6-7ad9-4e12-ba48-631a1970fe3a@virtuozzo.com \
--to=vladimir.riabchun@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=no-reply@sashiko.virtuozzo.com \
--cc=ptikhomirov@virtuozzo.com \
--cc=vasileios.almpanis@virtuozzo.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