Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Magnus Karlsson <magnus.karlsson@gmail.com>,
	<magnus.karlsson@intel.com>, <bjorn@kernel.org>, <ast@kernel.org>,
	<daniel@iogearbox.net>, <netdev@vger.kernel.org>,
	<maciej.fijalkowski@intel.com>
Cc: <jonathan.lemon@gmail.com>, <ciara.loftus@intel.com>,
	<joamaki@gmail.com>, <bpf@vger.kernel.org>, <andrii@kernel.org>
Subject: Re: [PATCH bpf-next 04/17] selftests: xsk: set rlimit per thread
Date: Tue, 27 Jul 2021 11:39:11 -0700	[thread overview]
Message-ID: <8d3d2bdb-3750-80dd-3874-def189e0e51f@fb.com> (raw)
In-Reply-To: <20210727131753.10924-5-magnus.karlsson@gmail.com>



On 7/27/21 6:17 AM, Magnus Karlsson wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Set rlimit per thread instead of on the main thread. The main thread
> does not register any umem area so do not need this.

I think setrlimit() is per process. Did I miss anything?

> 
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> ---
>   tools/testing/selftests/bpf/xdpxceiver.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
> index 4d8ee636fc24..2100ab4e58b7 100644
> --- a/tools/testing/selftests/bpf/xdpxceiver.c
> +++ b/tools/testing/selftests/bpf/xdpxceiver.c
> @@ -252,6 +252,7 @@ static void gen_eth_frame(struct xsk_umem_info *umem, u64 addr)
>   
>   static void xsk_configure_umem(struct ifobject *data, void *buffer, int idx)
>   {
> +	const struct rlimit _rlim = { RLIM_INFINITY, RLIM_INFINITY };
>   	struct xsk_umem_config cfg = {
>   		.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
>   		.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
> @@ -263,6 +264,10 @@ static void xsk_configure_umem(struct ifobject *data, void *buffer, int idx)
>   	struct xsk_umem_info *umem;
>   	int ret;
>   
> +	ret = XSK_UMEM__DEFAULT_FRAME_SIZE;
> +	if (setrlimit(RLIMIT_MEMLOCK, &_rlim))
> +		exit_with_error(errno);
> +
>   	umem = calloc(1, sizeof(struct xsk_umem_info));
>   	if (!umem)
>   		exit_with_error(errno);
> @@ -1088,13 +1093,9 @@ static void run_pkt_test(int mode, int type)
>   
>   int main(int argc, char **argv)
>   {
> -	struct rlimit _rlim = { RLIM_INFINITY, RLIM_INFINITY };
>   	bool failure = false;
>   	int i, j;
>   
> -	if (setrlimit(RLIMIT_MEMLOCK, &_rlim))
> -		exit_with_error(errno);
> -
>   	for (int i = 0; i < MAX_INTERFACES; i++) {
>   		ifdict[i] = malloc(sizeof(struct ifobject));
>   		if (!ifdict[i])
> 

  reply	other threads:[~2021-07-27 18:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 13:17 [PATCH bpf-next 00/17] selftests: xsk: various simplifications Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 01/17] selftests: xsk: remove color mode Magnus Karlsson
2021-07-27 16:43   ` Yonghong Song
2021-07-28  6:12     ` Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 02/17] selftests: xsk: remove the num_tx_packets option Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 03/17] selftests: xsk: remove unused variables Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 04/17] selftests: xsk: set rlimit per thread Magnus Karlsson
2021-07-27 18:39   ` Yonghong Song [this message]
2021-07-28  6:13     ` Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 05/17] selftests: xsk: return correct error codes Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 06/17] selftests: xsk: simplify the retry code Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 07/17] selftests: xsk: remove end-of-test packet Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 08/17] selftests: xsk: disassociate umem size with packets sent Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 09/17] selftests: xsk: rename worker_* functions that are not thred entry points Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 10/17] selftests: xsk: simplify packet validation in xsk tests Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 11/17] selftests: xsk: validate tx stats on tx thread Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 12/17] selftests: xsk: decrease batch size Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 13/17] selftests: xsk: remove cleanup at end of program Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 14/17] selftests: xsk: generate packet directly in umem Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 15/17] selftests: xsk: generate packets from specification Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 16/17] selftests: xsk: make enums lower case Magnus Karlsson
2021-07-27 13:17 ` [PATCH bpf-next 17/17] selftests: xsk: preface options with opt Magnus Karlsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d3d2bdb-3750-80dd-3874-def189e0e51f@fb.com \
    --to=yhs@fb.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=ciara.loftus@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=joamaki@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH bpf-next 04/17] selftests: xsk: set rlimit per thread' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).