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]
Date:   Fri, 4 Sep 2020 07:50:40 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     "Zhang, Qiang" <Qiang.Zhang@...driver.com>
Cc:     "tglx@...utronix.de" <tglx@...utronix.de>,
        "longman@...hat.com" <longman@...hat.com>,
        "elver@...gle.com" <elver@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: 回复: [PATCH v2] debugobjects:
 install cpu hotplug callback


* Zhang, Qiang <Qiang.Zhang@...driver.com> wrote:

> tglx please review.
> 
> Thanks
> Qiang
> ________________________________________
> 发件人: linux-kernel-owner@...r.kernel.org <linux-kernel-owner@...r.kernel.org> 代表 qiang.zhang@...driver.com <qiang.zhang@...driver.com>
> 发送时间: 2020年8月27日 13:06
> 收件人: tglx@...utronix.de; longman@...hat.com; elver@...gle.com
> 抄送: linux-kernel@...r.kernel.org
> 主题: [PATCH v2] debugobjects: install cpu hotplug callback
> 
> From: Zqiang <qiang.zhang@...driver.com>
> 
> Due to cpu hotplug, it may never be online after it's offline,
> some objects in percpu pool is never free, in order to avoid
> this happening, install cpu hotplug callback, call this callback
> func to free objects in percpu pool when cpu going offline.

We capitalize 'CPU'. Also, please split this in at least two sentences.

> 
> Signed-off-by: Zqiang <qiang.zhang@...driver.com>
> ---
>  v1->v2:
>  Modify submission information.
> 
>  include/linux/cpuhotplug.h |  1 +
>  lib/debugobjects.c         | 23 +++++++++++++++++++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index a2710e654b64..2e77db655cfa 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -36,6 +36,7 @@ enum cpuhp_state {
>         CPUHP_X86_MCE_DEAD,
>         CPUHP_VIRT_NET_DEAD,
>         CPUHP_SLUB_DEAD,
> +       CPUHP_DEBUG_OBJ_DEAD,
>         CPUHP_MM_WRITEBACK_DEAD,
>         CPUHP_MM_VMSTAT_DEAD,
>         CPUHP_SOFTIRQ_DEAD,
> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
> index fe4557955d97..50e21ed0519e 100644
> --- a/lib/debugobjects.c
> +++ b/lib/debugobjects.c
> @@ -19,6 +19,7 @@
>  #include <linux/slab.h>
>  #include <linux/hash.h>
>  #include <linux/kmemleak.h>
> +#include <linux/cpu.h>
> 
>  #define ODEBUG_HASH_BITS       14
>  #define ODEBUG_HASH_SIZE       (1 << ODEBUG_HASH_BITS)
> @@ -433,6 +434,23 @@ static void free_object(struct debug_obj *obj)
>         }
>  }
> 
> +#if defined(CONFIG_HOTPLUG_CPU)
> +static int object_cpu_offline(unsigned int cpu)
> +{
> +       struct debug_percpu_free *percpu_pool;
> +       struct hlist_node *tmp;
> +       struct debug_obj *obj;
> +
> +       percpu_pool = per_cpu_ptr(&percpu_obj_pool, cpu);
> +       hlist_for_each_entry_safe(obj, tmp, &percpu_pool->free_objs, node) {
> +               hlist_del(&obj->node);
> +               kmem_cache_free(obj_cache, obj);
> +       }
> +
> +       return 0;
> +}
> +#endif

What happens to ->obj_free, if the CPU is brought back online? Won't it be 
out of sync at that point?

> +#if defined(CONFIG_HOTPLUG_CPU)

There's a shorter preprocessor sequence for that pattern.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ