lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87il7hyvqf.fsf@nvidia.com>
Date: Sun, 8 Oct 2023 18:26:58 +0300
From: Vlad Buslov <vladbu@...dia.com>
To: Jamal Hadi Salim <jhs@...atatu.com>
CC: <netdev@...r.kernel.org>, <deb.chatterjee@...el.com>,
	<anjali.singhai@...el.com>, <namrata.limaye@...el.com>, <tom@...anda.io>,
	<mleitner@...hat.com>, <Mahesh.Shirshyad@....com>,
	<tomasz.osinski@...el.com>, <jiri@...nulli.us>, <xiyou.wangcong@...il.com>,
	<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
	<pabeni@...hat.com>, <horms@...nel.org>, <kernel@...atatu.com>,
	<khalidm@...dia.com>, <toke@...hat.com>, <mattyk@...dia.com>
Subject: Re: [PATCH RFC v6 net-next 05/17] net: sched: act_api: Add support
 for preallocated dynamic action instances

On Sat 30 Sep 2023 at 10:35, Jamal Hadi Salim <jhs@...atatu.com> wrote:
> In P4, actions are assumed to pre exist and have an upper bound number of
> instances. Typically if you have 1M table entries you want to allocate
> enough action instances to cover the 1M entries. However, this is a big
> waste of memory if the action instances are not in use. So for our case,
> we allow the user to specify a minimal amount of actions in the template
> and then if more dynamic action instances are needed then they will be
> added on demand as in the current approach with tc filter-action
> relationship.
>
> Add the necessary code to preallocate actions instances for dynamic
> actions.
>
> We add 2 new actions flags:
> - TCA_ACT_FLAGS_PREALLOC: Indicates the action instance is a dynamic action
>   and was preallocated for future use the templating phase of P4TC
> - TCA_ACT_FLAGS_UNREFERENCED: Indicates the action instance was
>   preallocated and is currently not being referenced by any other object.
>   Which means it won't show up in an action instance dump.
>
> Once an action instance is created we don't free it when the last table
> entry referring to it is deleted.
> Instead we add it to the pool/cache of action instances for
> that specific action i.e it counts as if it is preallocated.
> Preallocated actions can't be deleted by the tc actions runtime commands
> and a dump or a get will only show preallocated actions
> instances which are being used (TCA_ACT_FLAGS_UNREFERENCED == false).
>
> The preallocated actions will be deleted once the pipeline is deleted
> (which will purge the dynamic action kind and its instances).
>
> For example, if we were to create a dynamic action that preallocates 128
> elements and dumped:
>
> $ tc -j p4template get action/myprog/send_nh | jq .
>
> We'd see the following:
>
> [
>   {
>     "obj": "action template",
>     "pname": "myprog",
>     "pipeid": 1
>   },
>   {
>     "templates": [
>       {
>         "aname": "myprog/send_nh",
>         "actid": 1,
>         "params": [
>           {
>             "name": "port",
>             "type": "dev",
>             "id": 1
>           }
>         ],
>         "prealloc": 128
>       }
>     ]
>   }
> ]
>
> If we try to dump the dynamic action instances, we won't see any:
>
> $ tc -j actions ls action myprog/send_nh | jq .
>
> []
>
> However, if we create a table entry which references this action kind:
>
> $ tc p4ctrl create myprog/table/cb/FDB \
>    dstAddr d2:96:91:5d:02:86 action myprog/send_nh \
>    param port type dev dummy0
>
> Dumping the action instance will now show this one instance which is
> associated with the table entry:
>
> $ tc -j actions ls action myprog/send_nh | jq .
>
> [
>   {
>     "total acts": 1
>   },
>   {
>     "actions": [
>       {
>         "order": 0,
>         "kind": "myprog/send_nh",
>         "index": 1,
>         "ref": 1,
>         "bind": 1,
>         "params": [
>           {
>             "name": "port",
>             "type": "dev",
>             "value": "dummy0",
>             "id": 1
>           }
>         ],
>         "not_in_hw": true
>       }
>     ]
>   }
> ]
>
> Co-developed-by: Victor Nogueira <victor@...atatu.com>
> Signed-off-by: Victor Nogueira <victor@...atatu.com>
> Co-developed-by: Pedro Tammela <pctammela@...atatu.com>
> Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
> Signed-off-by: Jamal Hadi Salim <jhs@...atatu.com>
> ---

act_api part looks good to me.

[...]


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ