netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Kui-Feng Lee <sinquersw@gmail.com>
Cc: kuifeng@meta.com, netdev@vger.kernel.org, bpf@vger.kernel.org,
	ast@kernel.org, song@kernel.org, kernel-team@meta.com,
	andrii@kernel.org, thinker.li@gmail.com, drosen@google.com
Subject: Re: [PATCH bpf-next v8 07/10] bpf, net: switch to dynamic registration
Date: Tue, 31 Oct 2023 17:02:56 -0700	[thread overview]
Message-ID: <5a8520dd-0dd6-4d51-9e4a-6eebcf7e792d@linux.dev> (raw)
In-Reply-To: <10f383a2-c83b-4a40-a1f9-bcf33c76c164@gmail.com>

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.


  reply	other threads:[~2023-11-01  0:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20231030192810.382942-1-thinker.li@gmail.com>
2023-10-30 19:28 ` [PATCH bpf-next v8 02/10] bpf, net: introduce bpf_struct_ops_desc thinker.li
2023-10-31  6:40   ` Martin KaFai Lau
2023-10-31 16:00     ` Kui-Feng Lee
2023-10-30 19:28 ` [PATCH bpf-next v8 07/10] bpf, net: switch to dynamic registration thinker.li
2023-10-31  6:36   ` Martin KaFai Lau
2023-10-31 23:34     ` Kui-Feng Lee
2023-11-01  0:02       ` Martin KaFai Lau [this message]
2023-11-01  0:19         ` Kui-Feng Lee
2023-11-01  0:19         ` Kui-Feng Lee
2023-11-02  0:17           ` Martin KaFai Lau
2023-11-02  0:59             ` Kui-Feng Lee
2023-11-02  1:32               ` Martin KaFai Lau
2023-11-02  4:19                 ` Kui-Feng Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a8520dd-0dd6-4d51-9e4a-6eebcf7e792d@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=drosen@google.com \
    --cc=kernel-team@meta.com \
    --cc=kuifeng@meta.com \
    --cc=netdev@vger.kernel.org \
    --cc=sinquersw@gmail.com \
    --cc=song@kernel.org \
    --cc=thinker.li@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).