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: <YB8ZuV6SS3T8Y/Ul@krava>
Date:   Sat, 6 Feb 2021 23:35:37 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Ian Rogers <irogers@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexei Budankov <abudankov@...wei.com>
Subject: Re: [PATCH 06/24] perf daemon: Add config file support

On Sat, Feb 06, 2021 at 05:05:04PM +0900, Namhyung Kim wrote:
> On Fri, Feb 5, 2021 at 9:56 PM Jiri Olsa <jolsa@...hat.com> wrote:
> >
> > On Fri, Feb 05, 2021 at 09:14:54PM +0900, Namhyung Kim wrote:
> > > On Sun, Jan 31, 2021 at 8:49 AM Jiri Olsa <jolsa@...nel.org> wrote:
> > > [SNIP]
> > > > @@ -263,9 +605,16 @@ static int __cmd_start(struct daemon *daemon, struct option parent_options[],
> > > >         signal(SIGTERM, sig_handler);
> > > >
> > > >         while (!done && !err) {
> > > > -               if (fdarray__poll(&fda, -1)) {
> > > > +               err = daemon__reconfig(daemon);
> > >
> > > I think it's confusing since you put the reconfig function here.
> > > What not split normal and reconfig passes?
> >
> > hum, not sure what's confusing in here? I've been known to
> > produce confusing code, but this one seems clear to me
> 
> Maybe it's because of the name.  I thought reconfig is a
> special case when it detects some change.  But you call
> it in the loop unconditionally.
> 
> >
> > >
> > > I mean something like below
> > >
> > >  __cmd_start()
> > > {
> > >     setup_server_config();
> > >     daemon__run();
> >
> > what's daemon__run? the daemon operates in the while loop below
> 
> I thought about starting the sessions in the config.
> 
> >
> > >
> > >     while (!done && !err) {
> > >         ...
> > >         if (reconfig) {
> > >             daemon__kill();
> >
> > you don't kill daemon for each reconfig change,
> > we detect changed sessions and kill/restart only them
> 
> Yep, we can make it that way.
> 
> >
> > >             setup_server_config();
> > >             daemon__reconfig();
> > >         }
> > >     }
> >
> >
> > so basically the current workflow is:
> >
> >         setup_server_config                                     <--- reads config file, prepares session objects
> >
> >         while (!done) {
> >                 daemon__reconfig                                <--- check session objects states and run/stop them
> 
> Hmm.. then how about rename it to daemon__handle_state()
> or daemon__do_loop() or something?

well it handles reconfig, so I don't think that there's
better name than daemon__reconfig ;-)

apart from handle_server_socket, all the other functions
we call after poll can change session state, so we need
to 'reconfig' sessions each time we do a loop

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ