From nobody Mon Feb 9 12:26:22 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=none dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1603703637; cv=none; d=zohomail.com; s=zohoarc; b=YIeGGCxB0r+vasXeNmntiP8xJV3cv7rzbrS5prI0H1XaV5qPQ+3SwtRlO+XSER5YQjmvn53eK3bU/Xh1YFcqRI9yUq1psXko/HB+4/YD3i1w58+rC3lytQI3/Ygv7MU/srPCGK+FDIDonVI0tOZ3Y0evCuAAyO441lpppd2QVKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603703637; 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=M2krL48gwKtn5+NJtv6lNCEGODluTgIO1YbuF6efH7k=; b=Rp0H0nWomQGmfNscfTZUBcUl/dX8OXXI5Dz+a6TcTaVYPTjnCXl2JQRtlu143qXm8wmno0CoymnFQkmgVZdFHu/mRi9zLcwU13RidlPW6VxXAjeMXaBP+3Ob4FrLxbEfMUHLJKEqlSP8qES734teQh8rr7mwFS2dWPj2TQsBteA= 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=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603703637026184.8665972685841; Mon, 26 Oct 2020 02:13:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.12085.31708 (Exim 4.92) (envelope-from ) id 1kWyZN-00053i-To; Mon, 26 Oct 2020 09:13:37 +0000 Received: by outflank-mailman (output) from mailman id 12085.31708; Mon, 26 Oct 2020 09:13:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kWyZN-00053L-PE; Mon, 26 Oct 2020 09:13:37 +0000 Received: by outflank-mailman (input) for mailman id 12085; Mon, 26 Oct 2020 09:13:35 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kWyZL-0004f1-Rl for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 09:13:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 07e6da9e-aa3a-4f34-8f06-da9f0e4f8e2e; Mon, 26 Oct 2020 09:13:21 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E1AA1B245; Mon, 26 Oct 2020 09:13:20 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kWyZL-0004f1-Rl for xen-devel@lists.xenproject.org; Mon, 26 Oct 2020 09:13:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 07e6da9e-aa3a-4f34-8f06-da9f0e4f8e2e; Mon, 26 Oct 2020 09:13:21 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E1AA1B245; Mon, 26 Oct 2020 09:13:20 +0000 (UTC) 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: 07e6da9e-aa3a-4f34-8f06-da9f0e4f8e2e X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1603703601; h=from:from:reply-to:subject:subject: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=M2krL48gwKtn5+NJtv6lNCEGODluTgIO1YbuF6efH7k=; b=L+h43uW4CetUkMAM1vDXaII+0gwnfcoYb/izkWwW0fDF4ogdzW7BHD4v/gdgvaBmOMzzRq zfpnAMZrb5Y2uk3vtPGOo8On3aJYFUMAKtnv26Q3xIL0C6IfdKlkiFVO8pixTBAvyPQa1p /irvmsgO06EfxSxhvotv8XmbPFgqF84= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Dario Faggioli Subject: [PATCH 10/12] xen/hypfs: add cpupool directories Date: Mon, 26 Oct 2020 10:13:14 +0100 Message-Id: <20201026091316.25680-11-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201026091316.25680-1-jgross@suse.com> References: <20201026091316.25680-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Add /cpupool/ directories to hypfs. Those are completely dynamic, so the related hypfs access functions need to be implemented. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- docs/misc/hypfs-paths.pandoc | 9 +++++ xen/common/sched/cpupool.c | 78 ++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/docs/misc/hypfs-paths.pandoc b/docs/misc/hypfs-paths.pandoc index 6c7b2f7ee3..aaca1cdf92 100644 --- a/docs/misc/hypfs-paths.pandoc +++ b/docs/misc/hypfs-paths.pandoc @@ -175,6 +175,15 @@ The major version of Xen. =20 The minor version of Xen. =20 +#### /cpupool/ + +A directory of all current cpupools. + +#### /cpupool/*/ + +The individual cpupools. Each entry is a directory with the name being the +cpupool-id (e.g. /cpupool/0/). + #### /params/ =20 A directory of runtime parameters. diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index 84f326ea63..8612ee5cf6 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -13,6 +13,8 @@ =20 #include #include +#include +#include #include #include #include @@ -992,6 +994,78 @@ static struct notifier_block cpu_nfb =3D { .notifier_call =3D cpu_callback }; =20 +#ifdef CONFIG_HYPFS +static HYPFS_DIR_INIT(cpupool_pooldir, "id"); + +static int cpupool_dir_read(const struct hypfs_entry *entry, + XEN_GUEST_HANDLE_PARAM(void) uaddr) +{ + int ret =3D 0; + struct cpupool **q; + + spin_lock(&cpupool_lock); + + for_each_cpupool(q) + { + ret =3D hypfs_read_dyndir_id_entry(&cpupool_pooldir, (*q)->cpupool= _id, + !(*q)->next, &uaddr); + if ( ret ) + break; + } + + spin_unlock(&cpupool_lock); + + return ret; +} + +static unsigned int cpupool_dir_getsize(const struct hypfs_entry *entry) +{ + struct cpupool **q; + unsigned int size =3D 0; + + spin_lock(&cpupool_lock); + + for_each_cpupool(q) + size +=3D HYPFS_DIRENTRY_SIZE(snprintf(NULL, 0, "%d", (*q)->cpupoo= l_id)); + + spin_unlock(&cpupool_lock); + + return size; +} + +static struct hypfs_entry *cpupool_dir_findentry(struct hypfs_entry_dir *d= ir, + const char *name, + unsigned int name_len) +{ + unsigned long id; + const char *end; + struct cpupool *cpupool; + + id =3D simple_strtoul(name, &end, 10); + if ( id > INT_MAX || end !=3D name + name_len ) + return ERR_PTR(-ENOENT); + + spin_lock(&cpupool_lock); + + cpupool =3D __cpupool_find_by_id(id, true); + + spin_unlock(&cpupool_lock); + + if ( !cpupool ) + return ERR_PTR(-ENOENT); + + return hypfs_gen_dyndir_entry_id(&cpupool_pooldir, id); +} + +static struct hypfs_funcs cpupool_dir_funcs =3D { + .read =3D cpupool_dir_read, + .getsize =3D cpupool_dir_getsize, + .findentry =3D cpupool_dir_findentry, +}; + +static HYPFS_VARDIR_INIT(cpupool_dir, "cpupool", &cpupool_dir_funcs); +#endif + static int __init cpupool_init(void) { unsigned int cpu; @@ -999,6 +1073,10 @@ static int __init cpupool_init(void) =20 cpupool_gran_init(); =20 +#ifdef CONFIG_HYPFS + hypfs_add_dir(&hypfs_root, &cpupool_dir, true); +#endif + cpupool0 =3D cpupool_create(0, 0, &err); BUG_ON(cpupool0 =3D=3D NULL); cpupool_put(cpupool0); --=20 2.26.2