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: <CAM9d7cgouGAAt46qe_DGqMX0xzYF3a0ZQw2aXFwdxo4d66d18A@mail.gmail.com>
Date:   Wed, 24 Mar 2021 13:04:52 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Like Xu <like.xu@...ux.intel.com>
Cc:     Kan Liang <kan.liang@...ux.intel.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@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>, x86@...nel.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 RESEND 3/5] perf/x86/lbr: Move cpuc->lbr_xsave
 allocation out of sleeping region

On Wed, Mar 24, 2021 at 12:47 PM Like Xu <like.xu@...ux.intel.com> wrote:
>
> Hi Namhyung,
>
> On 2021/3/24 9:32, Namhyung Kim wrote:
> > Hello,
> >
> > On Mon, Mar 22, 2021 at 3:14 PM Like Xu <like.xu@...ux.intel.com> wrote:
> >> +void reserve_lbr_buffers(struct perf_event *event)
> >> +{
> >> +       struct kmem_cache *kmem_cache = x86_get_pmu()->task_ctx_cache;
> >> +       struct cpu_hw_events *cpuc;
> >> +       int cpu;
> >> +
> >> +       if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
> >> +               return;
> >> +
> >> +       for_each_possible_cpu(cpu) {
> >> +               cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
> >> +               if (kmem_cache && !cpuc->lbr_xsave && !event->attr.precise_ip)
> >> +                       cpuc->lbr_xsave = kmem_cache_alloc(kmem_cache, GFP_KERNEL);
> >> +       }
> >> +}
> >
> > I think we should use kmem_cache_alloc_node().
>
> "kmem_cache_alloc_node - Allocate an object on the specified node"
>
> The reserve_lbr_buffers() is called in __x86_pmu_event_init().
> When the LBR perf_event is scheduled to another node, it seems
> that we will not call init() and allocate again.
>
> Do you mean use kmem_cache_alloc_node() for each numa_nodes_parsed ?

I assume cpuc->lbr_xsave will be accessed for that cpu only.
Then it needs to allocate it in the node that cpu belongs to.
Something like below..

    cpuc->lbr_xsave = kmem_cache_alloc_node(kmem_cache, GFP_KERNEL,
                                               cpu_to_node(cpu));

Thanks,
Namhyung

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ