linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users <linux-perf-users@vger.kernel.org>
Subject: Re: [PATCH v3] perf bench sched pipe: Add -G/--cgroups option
Date: Tue, 17 Oct 2023 13:36:49 +0530	[thread overview]
Message-ID: <D6B30B31-80DC-4EB0-A111-B92CD99DD75F@linux.vnet.ibm.com> (raw)
In-Reply-To: <ZS1Y5PhXhp384ynY@kernel.org>



> On 16-Oct-2023, at 9:08 PM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> Em Mon, Oct 16, 2023 at 11:35:35AM +0200, Ingo Molnar escreveu:
>> 
>> 
>> * Namhyung Kim <namhyung@kernel.org> wrote:
>> 
>>> + /* try cgroup v2 interface first */
>>> + if (threaded)
>>> + fd = openat(cgrp->fd, "cgroup.threads", O_WRONLY);
>>> + else
>>> + fd = openat(cgrp->fd, "cgroup.procs", O_WRONLY);
>>> +
>>> + /* try cgroup v1 if failed */
>>> + if (fd < 0)
>>> + fd = openat(cgrp->fd, "tasks", O_WRONLY);
>>> +
>>> + if (fd < 0) {
>>> + char mnt[PATH_MAX];
>>> +
>>> + printf("Failed to open cgroup file in %s\n", cgrp->name);
>>> +
>>> + if (cgroupfs_find_mountpoint(mnt, sizeof(mnt), "perf_event") == 0)
>>> + printf(" Hint: create the cgroup first, like 'mkdir %s/%s'\n",
>>> +        mnt, cgrp->name);
>> 
>> Ok, this works too I suppose.
>> 
>> Acked-by: Ingo Molnar <mingo@kernel.org>
> 
> I'm not getting that:
> 
> [root@five ~]# perf bench sched pipe -l 10000 -G AAA,BBB
> # Running 'sched/pipe' benchmark:
> no access to cgroup /sys/fs/cgroup/AAA
> cannot open sender cgroup: AAA
> Usage: perf bench sched pipe <options>
> 
>    -G, --cgroups <SEND,RECV>
>                          Put sender and receivers in given cgroups
> [root@five ~]#
> 
> Its better now as it bails out, but it is not emitting any message that
> helps with running the test, well, there is that /sys/fs/cgroup/AAA
> path, lemme try doing a mkdir:
> 
> [root@five ~]# perf bench sched pipe -l 10000 -G AAA,BBB
> # Running 'sched/pipe' benchmark:
> no access to cgroup /sys/fs/cgroup/BBB
> cannot open receiver cgroup: BBB
> Usage: perf bench sched pipe <options>
> 
>    -G, --cgroups <SEND,RECV>
>                          Put sender and receivers in given cgroups
> [root@five ~]#
> 
> [root@five ~]# perf bench sched pipe -l 10000 -G AAA,BBB
> # Running 'sched/pipe' benchmark:
> [root@five ~]#
> 
> It seems to be bailing out but doesn't run the test nor emits any
> warning.

In the “parse_two_cgroups” function itself it checks for :

cgrp_send = cgroup__new(p, /*do_open=*/true);
        if (cgrp_send == NULL) {
                fprintf(stderr, "cannot open sender cgroup: %s", p);
                goto out;
        }

And we fail here since the cgroup is not created. May be we can add the Hint or warning in here ?


Thanks
Athira

> 
> I'm using v3. I'll try to debug it a bit.
> 
> - Arnaldo



  parent reply	other threads:[~2023-10-17  8:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  4:42 [PATCH v3] perf bench sched pipe: Add -G/--cgroups option Namhyung Kim
2023-10-16  9:35 ` Ingo Molnar
2023-10-16 15:38   ` Arnaldo Carvalho de Melo
2023-10-16 15:45     ` Arnaldo Carvalho de Melo
2023-10-16 15:51       ` Arnaldo Carvalho de Melo
2023-10-16 15:55         ` Arnaldo Carvalho de Melo
2023-10-16 20:34           ` Arnaldo Carvalho de Melo
2023-10-16 21:44             ` Namhyung Kim
2023-10-17 12:09               ` Arnaldo Carvalho de Melo
2023-10-17 11:40             ` Ingo Molnar
2023-10-17 12:28               ` [perf stat] Extend --cpu to non-system-wide runs too? was " Arnaldo Carvalho de Melo
2023-10-17 12:43                 ` Ingo Molnar
2023-10-17 18:31                   ` Arnaldo Carvalho de Melo
2023-10-17 19:05                     ` Namhyung Kim
2023-10-18 12:07                     ` Ingo Molnar
2023-10-17  8:06     ` Athira Rajeev [this message]
2023-10-16 17:25 ` Athira Rajeev

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=D6B30B31-80DC-4EB0-A111-B92CD99DD75F@linux.vnet.ibm.com \
    --to=atrajeev@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).