From nobody Mon Feb 9 12:26:31 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=1667318716; cv=none; d=zohomail.com; s=zohoarc; b=NiFvf/dT60CRzQsV3J+T5cmXNoNInx0MUVlICuP9pWc31SP8xLB1nDTxgpW4fIfIOwdkCthA/3d4YXeIiK0vy+WQslTEmaXhI4fWCKiSbSxpCCFdrEIZES8YhDfZxdzj2w73bY00WyjKBXmDnLjkpBe+GIYCt8I1+Qm5Bw66vIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667318716; 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=ClK+S4fe5XoEXGnmTytfGm/UdGaWd4a4uXnR/ciAATo=; b=nhhjRSHacihKWlfknUnsiywBTxr0EZiigLjGSwX8wkWpqXhT2VrB8vZbmFucGxlI9rpmwcc0yvf4evj9FdQrlaM0Vv0fkfcT8SPi4eGzqgnIbIIEdK8YUMAzUorFbvjdTsP1NyAX+eRS/VoT7oI7FUKuOmnaOZYpCcyrnY+/+2Y= 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 1667318716201996.205448373715; Tue, 1 Nov 2022 09:05:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.435037.688019 (Exim 4.92) (envelope-from ) id 1optkf-0003Ys-Sj; Tue, 01 Nov 2022 16:04:33 +0000 Received: by outflank-mailman (output) from mailman id 435037.688019; Tue, 01 Nov 2022 16:04:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1optkf-0003Yl-QB; Tue, 01 Nov 2022 16:04:33 +0000 Received: by outflank-mailman (input) for mailman id 435037; Tue, 01 Nov 2022 16:04:31 +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 1optkd-0003Iv-R5 for xen-devel@lists.xenproject.org; Tue, 01 Nov 2022 16:04:31 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [2001:67c:2178:6::1c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id de8dce0d-59fe-11ed-91b5-6bf2151ebd3b; Tue, 01 Nov 2022 17:04:31 +0100 (CET) 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-out1.suse.de (Postfix) with ESMTPS id C8C1822566; Tue, 1 Nov 2022 16:04:30 +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 99B781346F; Tue, 1 Nov 2022 16:04:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yt4pJI5DYWMlcgAAMHmgww (envelope-from ); Tue, 01 Nov 2022 16:04:30 +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: de8dce0d-59fe-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667318670; 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=ClK+S4fe5XoEXGnmTytfGm/UdGaWd4a4uXnR/ciAATo=; b=WMGNJh12bIYiZ3wI7cv2gXwEYFjkKcD1gXNtYdWxfxaXL/kQI0nRODknx7zA9E/mJNMdWw AbYTfI8vpU9MlilXn7mveQ2OoEBHanYIDRq60xbbXbcQVTsV+HNrzd/AVWCfnPwYBicJr7 oLOfTYleBpgd/t4E6+CAHPOFD71dXfk= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD Subject: [PATCH 01/12] tools/xenstore: manage per-transaction domain accounting data in an array Date: Tue, 1 Nov 2022 17:04:11 +0100 Message-Id: <20221101160422.7212-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221101160422.7212-1-jgross@suse.com> References: <20221101160422.7212-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1667318718434100002 Content-Type: text/plain; charset="utf-8" In order to prepare keeping accounting data in an array instead of using independent fields, switch the struct changed_domain accounting data to that scheme, for now only using an array with one element. In order to be able to extend this scheme add the needed indexing enum to xenstored_domain.h. Signed-off-by: Juergen Gross --- tools/xenstore/xenstored_domain.c | 17 +++++++++-------- tools/xenstore/xenstored_domain.h | 5 +++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_d= omain.c index 582b78b0ee..399fc920bb 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -99,8 +99,8 @@ struct changed_domain /* Identifier of the changed domain. */ unsigned int domid; =20 - /* Amount by which this domain's nbentry field has changed. */ - int nbentry; + /* Accounting data. */ + int acc[ACC_TR_N]; }; =20 static struct hashtable *domhash; @@ -558,7 +558,7 @@ int acc_fix_domains(struct list_head *head, bool update) int cnt; =20 list_for_each_entry(cd, head, list) { - cnt =3D domain_nbentry_fix(cd->domid, cd->nbentry, update); + cnt =3D domain_nbentry_fix(cd->domid, cd->acc[ACC_NODES], update); if (!update) { if (cnt >=3D quota_nb_entry_per_domain) return ENOSPC; @@ -603,8 +603,8 @@ static struct changed_domain *acc_get_changed_domain(co= nst void *ctx, return cd; } =20 -static int acc_add_dom_nbentry(const void *ctx, struct list_head *head, in= t val, - unsigned int domid) +static int acc_add_changed_dom(const void *ctx, struct list_head *head, + unsigned int what, int val, unsigned int domid) { struct changed_domain *cd; =20 @@ -613,9 +613,9 @@ static int acc_add_dom_nbentry(const void *ctx, struct = list_head *head, int val, return 0; =20 errno =3D 0; - cd->nbentry +=3D val; + cd->acc[what] +=3D val; =20 - return cd->nbentry; + return cd->acc[what]; } =20 static void domain_conn_reset(struct domain *domain) @@ -1076,7 +1076,8 @@ static int domain_nbentry_add(struct connection *conn= , unsigned int domid, =20 if (conn && conn->transaction) { head =3D transaction_get_changed_domains(conn->transaction); - ret =3D acc_add_dom_nbentry(conn->transaction, head, add, domid); + ret =3D acc_add_changed_dom(conn->transaction, head, ACC_NODES, + add, domid); if (errno) { fail_transaction(conn->transaction); return -1; diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_d= omain.h index dc4660861e..124b9e1b1e 100644 --- a/tools/xenstore/xenstored_domain.h +++ b/tools/xenstore/xenstored_domain.h @@ -19,6 +19,11 @@ #ifndef _XENSTORED_DOMAIN_H #define _XENSTORED_DOMAIN_H =20 +enum { + ACC_NODES, + ACC_TR_N /* Number of elements per transaction and domain. */ +}; + void handle_event(void); =20 void check_domains(void); --=20 2.35.3