From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 1070680681 for ; Fri, 25 Sep 2026 16:55:22 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68PGs8WE027460; Fri, 25 Sep 2026 19:54:09 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68PGs8WE027460 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="FdDTd2eq" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68PGre2o027372 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 25 Sep 2026 19:53:40 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68PGre2o027372 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48706ee8fbaso738725f8f.1 for ; Fri, 25 Sep 2026 09:53:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBzLQsLgbthbAOqpb6qEjFU6EP/Siox5Mrao6gNu6lnbPprWuB5fiT4rXIa4AreW0utxGUsNqw==@openvz.org X-Gm-Message-State: AFuF++mrlp8p4kIjmWwVbrexAnYC/5+kIZuVtlKKFjJCW0TERDYcIHMp MXqrCCjwcE9Z4wxiBaxhCvtFwHFzXYoKPPjIdGesHqsm+MltP4JOBK2vNUkuv87GkgCjXG0OjS4 g5mD8kTqUmTI3JgNWzhJ5nE/y3tp3vhn0wRqQHLL28O2S5A2/Jq8pXw== X-Gm-Gg: AYBFou2NkkAaeOOOlagOqKP97aWDJX8m5MhjprXGCYgsWLdKKTg1ttjUlxMSTlXoDSx pGQhZNQglgX2x0yECbBR3OE+Zuw08ArntuF1zkBM5/QbDsOPeWHlZ9/CxsGOBF4SBuET5Bm9BfM jSRQyd04S65UNO7ofdv7EpA9Jvq4jv9ixEk9CW7MyZbio8vBMzLHltH5Xbf8GPfPZP1VjN1fzmW r7U6XzQ5Qe3gbe5OHf4FFN9rpqdlvCDgu8LaiRIaX/pGajlhJk/ZBBF4573FQcXEczIBVVbCd9J AZpCj/2yBCuaqODksv1Pog7qnmxL3rtYGiBEMO7p5IO7HgAbl0kxyrS8jG4V+wWBQ7KFEugFfY0 tb76/iuecCA1Z2Hs69w== X-Received: by 2002:a05:6000:2387:b0:487:b50:101c with SMTP id ffacd0b85a97d-488716b2bb1mr10789234f8f.5.1790355219867; Fri, 25 Sep 2026 09:53:39 -0700 (PDT) X-Received: by 2002:a05:6000:2387:b0:487:b50:101c with SMTP id ffacd0b85a97d-488716b2bb1mr10789089f8f.5.1790355217879; Fri, 25 Sep 2026 09:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790355217; cv=none; d=google.com; s=arc-20260327; b=jenD3/BiEjW7yzg1MVvywker4ZCo/AT6cHb/mfpLm6SY3dqHaYYB8sUU+hwFgQvfi5 FSsjFnoGJpQhRXejxvDYYduILcKQmwWZ28+OiQvl+Ml5l9ufTP3Shd9UDZBivvnETmak 1TsPz6TOdycdk+59++KkjY7hAQlWKiNeiNgDyyVI3XEbvwtZfU2OMIB46j6+gLP41yDb fgAXQTi+GvzjIBOyhsvvEPdG22SM9GHrTJYbw/tPw2Uy9Jo3I613xRnxysDsOrSovnnW dlMpyky6G8Nx/UB9EmcfEDyNrTkqDTgGRkGUrr4kIjb9Jdnmy23uEC++NYRqZuYeXDjz ZQ0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=Qbd/aHsyY+7EXAAMddD9pVXu2gEebq4F8C+uevh6fqo=; fh=zK/v/gHQ7GavWYhLJT8+SASJ7h8osfxqNHUzmzGkT+o=; b=QLm9qw67TMqK7x0bQE92/6bbBlgz7yWH5QB2NDz/ggaIPbF9jf5k8py6K8iAedYcaE JIeL4GBhrInVvwTvRJsoGbFIQt0uArSq1HQqWD7ouhS5Y5Ls1S2Y+EK/CFglSuaQwTQo qrXS5cqQ5iBgc39gH5g40qr0lDDk2cSbZ0RW+cVwIpoRDcl+5i4DkYcXBZEkE8uDEJol yzOWwKA9NKALpSEiqkrM3FmY9Ix62ahniBnP/+FZgSf/Hj6eprO+XHjRuKCPP0pWqBnp PvUfjDhO1c7QzAQ4cPZAnmsFzaWCrVJT6L1rUhUqtT5NciexymlTSvh2j1L75RoSwCtC 592g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=FdDTd2eq; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48884570d8esi750830f8f.326.2026.09.25.09.53.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2026 09:53:37 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=FdDTd2eq; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Content-Type:MIME-Version:Subject:Date :From; bh=Qbd/aHsyY+7EXAAMddD9pVXu2gEebq4F8C+uevh6fqo=; b=FdDTd2eqDl1RKJa8iGE CEeTwoxbZ5SCc82+RdZePWYnFSxLlkyn0R8mgDFE0A76iTMchAAlCOrCNbt3QBG2MxzFPiLBkWU3A dMeG7p+zQ6vJzRl15zIZ80cytwQcXGIDRGmL8iM1hyz9U3UecX/65v3ekX7Kg1Z8b8tmLaTs17F1H 4/h9wikxVgEhjBmbco1YMusNWwlMnBUtq7b2pZc5EfHy7o2uSpthK58q4HgMg4BoF9p0BvmjHUVNB +jSlFO4nEnRkvfrMnLLYAt9oRFnu+bqSnhptxeM+g+EuHpM2sKvPTRlSqA09lBqM9jK6Dhg1SieY/ 3m2zTQB3EjQV7kg==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xA985-00CFkL-14; Fri, 25 Sep 2026 18:53:33 +0200 From: Konstantin Khorenko Date: Fri, 25 Sep 2026 18:53:28 +0200 MIME-Version: 1.0 Message-Id: <20260925-b4-kh-ve_fail-v10-7-77a6b6ea4205@virtuozzo.com> References: <20260925-b4-kh-ve_fail-v10-0-77a6b6ea4205@virtuozzo.com> In-Reply-To: <20260925-b4-kh-ve_fail-v10-0-77a6b6ea4205@virtuozzo.com> To: Vasileios Almpanis , Pavel Tikhomirov , cover.1789491989.git.vladimir.riabchun@virtuozzo.com, Konstantin Khorenko , devel@openvz.org X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3565; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=XzdYtwtC2kMfzsguosULvCMGowL3/WCnL+3GskHTZcA=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqtqcNJYSVR7D6q2M0v5QqGr2tSKqFMCwk4SeKn m32uZ2NSGqJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCaranDQAKCRBRlgpH+WFc KjueD/wOdJn+FOGoH7Qy8IuGW7Zm39sGHNm8wiwy8g/BSLtcuPXTCgUjqXjiq9ftalq0ht5A4Cy 7RAbv6vd1LKeJTE2XGKbQUsqDh0qTyM06f5fA8UjwMQ0O5eCt7mZ63IAHi8W/8P+IBuOD455kHK QVoHraRbDyppv6Qb4PflxPUxApajl4T5jUmZXX/xcmzuLNMCfl4DbfJFIdlbAR1ULeNSS5DywkT jPmMsqVuGFFZ0JsXVqmTiYjrZb/AKFmiwyKRsQ36Li6smL/NM4DY648kuv2ufyD527QnCGJTxCQ joi6BD/Jelzd3HfMJTiyVIjrxINEpaJL5OKOxZ48PcM+cahCJz7DZN2OwcYalyKbDRH4H24cuRY wi9+Vb7Jm9aoUmBSGFhDNCA/K8VxJgcxteQCLExEvDFP3KwI1An699K3ao6ImPMeCs5OMRGQnqF yhxMTxeUNayTQirjpgrHXDEW5SkU6DsS1UI3IAkmBZp2T6iiby5iVjYHJL9YLrJ9GAu0mN/fThX GoSNKMXmOUsaJnoiBaOV+SJU6qQYQ+/iQTRv9PIhTD3JoYqyfPhw984211HK63t6yCIYxxV1FEi dA4mZN2AgAGozyoNAkkZv4ZgsD5zqx5Uila4zCeoVIcLOuN1yzoAukr9WV7gI141zH5zoLjZMLv XbaFVg3m9kbODYw== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Subject: [Devel] [PATCH hci-8.1 v10 07/13] ve: introduce per-VE failcounter infrastructure X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Vladimir Riabchun It may be useful to have a history of resource limit hits for every VE, this may simplify debugging and provide some information about the resources usage. This information is provided by ve.failcount file, any write to it resets all failcounts. To add a new failcounter we need to create a new atomic_t field name_failcount in ve structure and add a new VE_FC_ENTRY in ve_failcounts array. The counters themselves come in the follow-up patches, one per resource. The neighbour table overflow will not be counted for now: neigh_alloc can run in softirq context, where ve log must not be used, and ve_failcount_inc writes to it. The neigh_tbl counter will be added together with the ve_printk softirq fix (VSTOR-146839). https://virtuozzo.atlassian.net/browse/VSTOR-135520 Feature: per-ve failcounters Signed-off-by: Vladimir Riabchun Signed-off-by: Konstantin Khorenko --- include/linux/ve.h | 10 ++++++++++ kernel/ve/ve.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/include/linux/ve.h b/include/linux/ve.h index fabc608e31f51..546060eddc765 100644 --- a/include/linux/ve.h +++ b/include/linux/ve.h @@ -151,6 +151,16 @@ extern int nr_ve; #define BPF_PROG_MAX_NR_DEFAULT 256 /* number of loaded BPF progs per-VE */ #define MNT_MAX_NR_DEFAULT 4096 /* number of mounts per-VE */ +#define ve_failcount_inc(ve, name) \ +do { \ + struct ve_struct *__ve = (ve); \ + \ + atomic_inc(&__ve->name##_failcount); \ + ve_pr_warn_ratelimited(VE_LOG_BOTH, "CT%s: hits the " #name \ + " limit, see the '" #name "' counter in ve.failcount " \ + "of the container's ve cgroup\n", ve_name(__ve)); \ +} while (0) + #ifdef CONFIG_VE static inline void ve_set_state(struct ve_struct *ve, int new_state) { diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index c4e5c000bc427..f915f86e7471e 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -1079,6 +1079,45 @@ VE_RESOURCE(mnt); VE_RESOURCE(netif); VE_RESOURCE(bpf_prog); +static const struct ve_failcount_entry { + const char *name; + size_t offset; +} ve_failcounts[] = { +#define VE_FC_ENTRY(name) { #name, offsetof(struct ve_struct, name##_failcount) } + {} +}; + +static int ve_failcount_read(struct seq_file *sf, void *v) +{ + struct ve_struct *ve = css_to_ve(seq_css(sf)); + const struct ve_failcount_entry *entry; + atomic_t *fc; + + for (entry = ve_failcounts; entry->name; entry++) { + fc = (void *)ve + entry->offset; + seq_printf(sf, "%s: %d\n", entry->name, atomic_read(fc)); + } + return 0; +} + +static ssize_t ve_failcount_write(struct kernfs_open_file *of, char *buf, + size_t nbytes, loff_t off) +{ + struct ve_struct *ve = css_to_ve(of_css(of)); + const struct ve_failcount_entry *entry; + atomic_t *fc; + + if (!ve_is_super(get_exec_env()) && !ve->is_pseudosuper) + return -EPERM; + + for (entry = ve_failcounts; entry->name; entry++) { + fc = (void *)ve + entry->offset; + atomic_set(fc, 0); + } + + return nbytes; +} + static int ve_os_release_read(struct seq_file *sf, void *v) { struct cgroup_subsys_state *css = seq_css(sf); @@ -1618,6 +1657,12 @@ static struct cftype ve_cftypes[] = { .flags = CFTYPE_NOT_ON_ROOT, .write_u64 = ve_rpc_kill_write, }, + { + .name = "failcount", + .flags = CFTYPE_NOT_ON_ROOT, + .seq_show = ve_failcount_read, + .write = ve_failcount_write, + }, { } }; -- 2.43.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel