From nobody Mon Feb 9 16:02:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1680678299; cv=none; d=zohomail.com; s=zohoarc; b=d4m4hDinQgioWvaL2y506nJlkT5LtcdPQE6d3rFZKmbAVTt49Ucny+bE4ozJQHh8r2VPur9f4VIKMIz+gz+fA4N13cY7OixNKS5knQTGohor8yc52Pdf+k+2b4VmEZuGuc9cSEyc2KkoguWJVpHREH0WEZwcV2T5zA9NQaNMibU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680678299; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0FVX/N0LxAMOywC2jlDscHABd/v4BQEj8zV+MLHaj68=; b=g56wEf5cfwInszZyUL1KpCLd6mvp+lTgdl40Quyl1pOL6h+DdleITSV1otN4cUhXN4uzBVvj/oGPW08vS9sxlxN6p7rGPEZ59YdS64rPHiT/jnjCFpe47bFzyExOd093XUDI7iasdB+3CSHViVv9r0ZY0hq1TxrTXlHFaF6b2u0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1680678299727716.2264029209799; Wed, 5 Apr 2023 00:04:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.518248.804607 (Exim 4.92) (envelope-from ) id 1pjxCA-0005jl-AN; Wed, 05 Apr 2023 07:04:38 +0000 Received: by outflank-mailman (output) from mailman id 518248.804607; Wed, 05 Apr 2023 07:04:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjxCA-0005jc-6c; Wed, 05 Apr 2023 07:04:38 +0000 Received: by outflank-mailman (input) for mailman id 518248; Wed, 05 Apr 2023 07:04:37 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjxC9-0002UC-5c for xen-devel@lists.xenproject.org; Wed, 05 Apr 2023 07:04:37 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [2001:67c:2178:6::1d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 200ce63f-d380-11ed-85db-49a42c6b2330; Wed, 05 Apr 2023 09:04:36 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7340C20592; Wed, 5 Apr 2023 07:04:36 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3D6E213A31; Wed, 5 Apr 2023 07:04:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TNk3DYQdLWTWEwAAMHmgww (envelope-from ); Wed, 05 Apr 2023 07:04:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 200ce63f-d380-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680678276; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0FVX/N0LxAMOywC2jlDscHABd/v4BQEj8zV+MLHaj68=; b=kkFJhyYeVvEhEobwXdCyZzLJpbdI1PB+Q0ceqAJQc3IV+ScoJrBQheTkPhfSOhU8j3Zi3j 3ilgCE1AnCRHhreOXN4+uAJwR+yzepxIshlSbqaD/7DaYRvHBtTmzKm2pa5Bk8NRtaU9Sq BdXYeOhCOuCgRFvcGQSoWQSQhTyy5rs= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v4 08/13] tools/xenstore: add accounting trace support Date: Wed, 5 Apr 2023 09:03:44 +0200 Message-Id: <20230405070349.25293-9-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230405070349.25293-1-jgross@suse.com> References: <20230405070349.25293-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1680678300298100001 Content-Type: text/plain; charset="utf-8" Add a new trace switch "acc" and the related trace calls. The "acc" switch is off per default. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- tools/xenstore/xenstored_core.c | 2 +- tools/xenstore/xenstored_core.h | 1 + tools/xenstore/xenstored_domain.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 67aa7c1578..bd816ce709 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -2746,7 +2746,7 @@ static void set_quota(const char *arg, bool soft) =20 /* Sorted by bit values of TRACE_* flags. Flag is (1u << index). */ const char *const trace_switches[] =3D { - "obj", "io", "wrl", + "obj", "io", "wrl", "acc", NULL }; =20 diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_cor= e.h index 1f811f38cb..3e0734a6c6 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -302,6 +302,7 @@ extern unsigned int trace_flags; #define TRACE_OBJ 0x00000001 #define TRACE_IO 0x00000002 #define TRACE_WRL 0x00000004 +#define TRACE_ACC 0x00000008 extern const char *const trace_switches[]; int set_trace_switch(const char *arg); =20 diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_d= omain.c index 22836ae881..1caa60bb14 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -540,6 +540,12 @@ static struct domain *find_domain_by_domid(unsigned in= t domid) return (d && d->introduced) ? d : NULL; } =20 +#define trace_acc(...) \ +do { \ + if (trace_flags & TRACE_ACC) \ + trace("acc: " __VA_ARGS__); \ +} while (0) + int acc_fix_domains(struct list_head *head, bool chk_quota, bool update) { struct changed_domain *cd; @@ -603,6 +609,8 @@ static int acc_add_changed_dom(const void *ctx, struct = list_head *head, return 0; =20 errno =3D 0; + trace_acc("local change domid %u: what=3D%u %d add %d\n", domid, what, + cd->acc[what], val); cd->acc[what] +=3D val; =20 return cd->acc[what]; @@ -1114,6 +1122,8 @@ static int domain_acc_add(struct connection *conn, un= signed int domid, return domain_acc_add_valid(d, what, ret); } =20 + trace_acc("global change domid %u: what=3D%u %u add %d\n", domid, what, + d->acc[what], add); d->acc[what] =3D domain_acc_add_valid(d, what, add); =20 return d->acc[what]; --=20 2.35.3