[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWvf66snfmUfaTQ6BZ9EmsmBs0PUT8PAfehW74bnEE5nQ@mail.gmail.com>
Date: Fri, 26 Aug 2022 13:52:07 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Adrian Hunter <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>,
André Almeida <andrealmeid@...lia.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, Weiguo Li <liwg06@...mail.com>,
Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Thomas Richter <tmricht@...ux.ibm.com>,
Ravi Bangoria <ravi.bangoria@....com>,
Dario Petrillo <dario.pk1@...il.com>,
Hewenliang <hewenliang4@...wei.com>,
yaowenbin <yaowenbin1@...wei.com>,
Wenyu Liu <liuwenyu7@...wei.com>,
Song Liu <songliubraving@...com>,
Andrii Nakryiko <andrii@...nel.org>,
Dave Marchevsky <davemarchevsky@...com>,
Leo Yan <leo.yan@...aro.org>,
Kim Phillips <kim.phillips@....com>,
Pavithra Gurushankar <gpavithrasha@...il.com>,
Alexandre Truong <alexandre.truong@....com>,
Quentin Monnet <quentin@...valent.com>,
William Cohen <wcohen@...hat.com>,
Andres Freund <andres@...razel.de>,
Martin Liška <mliska@...e.cz>,
Colin Ian King <colin.king@...el.com>,
James Clark <james.clark@....com>,
Fangrui Song <maskray@...gle.com>,
Stephane Eranian <eranian@...gle.com>,
Kajol Jain <kjain@...ux.ibm.com>,
Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
Riccardo Mancini <rickyman7@...il.com>,
Andi Kleen <ak@...ux.intel.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Zechuan Chen <chenzechuan1@...wei.com>,
Jason Wang <wangborong@...rlc.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Remi Bernon <rbernon@...eweavers.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
bpf <bpf@...r.kernel.org>, llvm@...ts.linux.dev
Subject: Re: [PATCH v3 09/18] perf ui: Update use of pthread mutex
On Fri, Aug 26, 2022 at 1:40 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Fri, Aug 26, 2022 at 12:21 PM Adrian Hunter <adrian.hunter@...el.com> wrote:
> >
> > On 26/08/22 22:00, Namhyung Kim wrote:
> > > On Fri, Aug 26, 2022 at 11:53 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
> > >> Below seems adequate for now, at least logically, but maybe it
> > >> would confuse clang thread-safety analysis?
> > >
> > > I think it's not just about locks, the exit_browser should bail out early
> > > if the setup code was not called.
> >
> > In those cases, use_browser is 0 or -1 unless someone has inserted
> > an invalid perf config like "tui.script=on" or "gtk.script=on".
> > So currently, in cases where exit_browser() is called without
> > setup_browser(), it does nothing. Which means it is only the
> > unconditional mutex_destroy() that needs to be conditional.
>
> Yeah there's a possibility that it can be called with > 0 use_browser
> on some broken config or something. So I think it's safer and better
> for future changes.
I'd thought about a:
static bool ui__lock_initialized;
but the issue is shouldn't it be atomic? Maybe we should guard it with
a lock? Then we are back where we started. Having a clean init/exit
invariant would be best but such a change has the potential to be
large and out of scope here.
Thanks,
Ian
> Thanks,
> Namhyung
Powered by blists - more mailing lists