On 16.11.2023 13:04, Oleksii wrote: > On Thu, 2023-11-16 at 08:36 +0100, Jan Beulich wrote: >> On 10.11.2023 17:30, Oleksii Kurochko wrote: >>> --- /dev/null >>> +++ b/xen/include/asm-generic/percpu.h >>> @@ -0,0 +1,35 @@ >>> +/* SPDX-License-Identifier: GPL-2.0-only */ >>> +#ifndef __ASM_GENERIC_PERCPU_H__ >>> +#define __ASM_GENERIC_PERCPU_H__ >>> + >>> +#ifndef __ASSEMBLY__ >>> + >>> +#include <xen/types.h> >>> + >>> +extern char __per_cpu_start[], __per_cpu_data_end[]; >> >> Can we go one tiny step beyond what Arm presently has and make the >> latter of the two const? > I am not sure I think we will have compilation issue with the following > code in Arm and x86 because of [-Werror=discarded-qualifiers]: > > static void cf_check _free_percpu_area(struct rcu_head *head) > { > struct free_info *info = container_of(head, struct free_info, rcu); > unsigned int cpu = info->cpu; > char *p = __per_cpu_start + __per_cpu_offset[cpu]; > > free_xenheap_pages(p, PERCPU_ORDER); > __per_cpu_offset[cpu] = INVALID_PERCPU_AREA; > }
There's no use of __per_cpu_data_end here; I specifically didn't ask for both of the declarations to have const added. > I guess cast can help. There may not be casts casting away constness, except maybe in very delicate situations. Jan