[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5a8520dd-0dd6-4d51-9e4a-6eebcf7e792d@linux.dev>
Date: Tue, 31 Oct 2023 17:02:56 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Kui-Feng Lee <sinquersw@...il.com>
Cc: kuifeng@...a.com, netdev@...r.kernel.org, bpf@...r.kernel.org,
ast@...nel.org, song@...nel.org, kernel-team@...a.com, andrii@...nel.org,
thinker.li@...il.com, drosen@...gle.com
Subject: Re: [PATCH bpf-next v8 07/10] bpf, net: switch to dynamic
registration
On 10/31/23 4:34 PM, Kui-Feng Lee wrote:
>>> diff --git a/include/linux/btf.h b/include/linux/btf.h
>>> index a8813605f2f6..954536431e0b 100644
>>> --- a/include/linux/btf.h
>>> +++ b/include/linux/btf.h
>>> @@ -12,6 +12,8 @@
>>> #include <uapi/linux/bpf.h>
>>> #define BTF_TYPE_EMIT(type) ((void)(type *)0)
>>> +#define BTF_STRUCT_OPS_TYPE_EMIT(type) {((void)(struct type *)0); \
>>
>> ((void)(struct type *)0); is new. Why is it needed?
>
> This is a trick of BTF to force compiler generate type info for
> the given type. Without trick, compiler may skip these types if these
> type are not used at all in the module. For example, modules usually
> don't use value types of struct_ops directly.
It is not the value type and value type emit is understood. It is the struct_ops
type itself and it is new addition in this patchset afaict. The value type emit
is in the next line which was cut out from the context here.
Powered by blists - more mailing lists