All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: <arnd@arndb.de>, <linux-arch@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
	<mingo@redhat.com>, <davem@davemloft.net>, <ast@kernel.org>,
	<ryabinin.a.a@gmail.com>, <mpe@ellerman.id.au>,
	<benh@kernel.crashing.org>, <paulus@samba.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Sami Tolvanen <samitolvanen@google.com>,
	Nathan Chancellor <nathan@kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH v2 5/7] kallsyms: Rename is_kernel() and is_kernel_text()
Date: Thu, 29 Jul 2021 00:05:31 -0400	[thread overview]
Message-ID: <20210729000531.7c4da1f1@oasis.local.home> (raw)
In-Reply-To: <1551f9cc-eaf8-efef-0590-e2549eebe4ae@huawei.com>

On Thu, 29 Jul 2021 10:00:51 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> On 2021/7/28 23:28, Steven Rostedt wrote:
> > On Wed, 28 Jul 2021 16:13:18 +0800
> > Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> >  
> >> The is_kernel[_text]() function check the address whether or not
> >> in kernel[_text] ranges, also they will check the address whether
> >> or not in gate area, so use better name.  
> > Do you know what a gate area is?
> >
> > Because I believe gate area is kernel text, so the rename just makes it
> > redundant and more confusing.  
> 
> Yes, the gate area(eg, vectors part on ARM32, similar on x86/ia64) is 
> kernel text.
> 
> I want to keep the 'basic' section boundaries check, which only check 
> the start/end
> 
> of sections, all in section.h,  could we use 'generic' or 'basic' or 
> 'core' in the naming?
> 
>   * is_kernel_generic_data()	--- come from core_kernel_data() in kernel.h
>   * is_kernel_generic_text()
> 
> The old helper could remain unchanged, any suggestion, thanks.

Because it looks like the check of just being in the range of "_stext"
to "_end" is just an internal helper, why not do what we do all over
the kernel, and just prefix the function with a couple of underscores,
that denote that it's internal?

  __is_kernel_text()

Then you have:

 static inline int is_kernel_text(unsigned long addr)
 {
	if (__is_kernel_text(addr))
 		return 1;
 	return in_gate_area_no_mm(addr);
 }

-- Steve

WARNING: multiple messages have this Message-ID (diff)
From: Steven Rostedt <rostedt@goodmis.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: linux-arch@vger.kernel.org, ryabinin.a.a@gmail.com,
	Daniel Borkmann <daniel@iogearbox.net>,
	arnd@arndb.de, linux-kernel@vger.kernel.org, ast@kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	mingo@redhat.com, paulus@samba.org,
	Sami Tolvanen <samitolvanen@google.com>,
	bpf@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	davem@davemloft.net
Subject: Re: [PATCH v2 5/7] kallsyms: Rename is_kernel() and is_kernel_text()
Date: Thu, 29 Jul 2021 00:05:31 -0400	[thread overview]
Message-ID: <20210729000531.7c4da1f1@oasis.local.home> (raw)
In-Reply-To: <1551f9cc-eaf8-efef-0590-e2549eebe4ae@huawei.com>

On Thu, 29 Jul 2021 10:00:51 +0800
Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> On 2021/7/28 23:28, Steven Rostedt wrote:
> > On Wed, 28 Jul 2021 16:13:18 +0800
> > Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> >  
> >> The is_kernel[_text]() function check the address whether or not
> >> in kernel[_text] ranges, also they will check the address whether
> >> or not in gate area, so use better name.  
> > Do you know what a gate area is?
> >
> > Because I believe gate area is kernel text, so the rename just makes it
> > redundant and more confusing.  
> 
> Yes, the gate area(eg, vectors part on ARM32, similar on x86/ia64) is 
> kernel text.
> 
> I want to keep the 'basic' section boundaries check, which only check 
> the start/end
> 
> of sections, all in section.h,  could we use 'generic' or 'basic' or 
> 'core' in the naming?
> 
>   * is_kernel_generic_data()	--- come from core_kernel_data() in kernel.h
>   * is_kernel_generic_text()
> 
> The old helper could remain unchanged, any suggestion, thanks.

Because it looks like the check of just being in the range of "_stext"
to "_end" is just an internal helper, why not do what we do all over
the kernel, and just prefix the function with a couple of underscores,
that denote that it's internal?

  __is_kernel_text()

Then you have:

 static inline int is_kernel_text(unsigned long addr)
 {
	if (__is_kernel_text(addr))
 		return 1;
 	return in_gate_area_no_mm(addr);
 }

-- Steve

  reply	other threads:[~2021-07-29  4:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  8:13 [PATCH v2 0/7] sections: Unify kernel sections range check and use Kefeng Wang
2021-07-28  8:13 ` Kefeng Wang
2021-07-28  8:13 ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 1/7] kallsyms: Remove arch specific text and data check Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 2/7] kallsyms: Fix address-checks for kernel related range Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang
2021-07-28 14:46   ` Steven Rostedt
2021-07-28 14:46     ` Steven Rostedt
2021-07-29  2:03     ` Kefeng Wang
2021-07-29  2:03       ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 3/7] sections: Move and rename core_kernel_data() to is_kernel_core_data() Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 4/7] sections: Move is_kernel_inittext() into sections.h Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 5/7] kallsyms: Rename is_kernel() and is_kernel_text() Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang
2021-07-28 15:28   ` Steven Rostedt
2021-07-28 15:28     ` Steven Rostedt
2021-07-29  2:00     ` Kefeng Wang
2021-07-29  2:00       ` Kefeng Wang
2021-07-29  4:05       ` Steven Rostedt [this message]
2021-07-29  4:05         ` Steven Rostedt
2021-07-29 11:06         ` Kefeng Wang
2021-07-29 11:06           ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 6/7] sections: Add new " Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang
2021-07-28 15:32   ` Steven Rostedt
2021-07-28 15:32     ` Steven Rostedt
2021-07-29  2:02     ` Kefeng Wang
2021-07-29  2:02       ` Kefeng Wang
2021-07-28  8:13 ` [PATCH v2 7/7] powerpc/mm: Use is_kernel_text() and is_kernel_inittext() helper Kefeng Wang
2021-07-28  8:13   ` Kefeng Wang

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=20210729000531.7c4da1f1@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=paulus@samba.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=samitolvanen@google.com \
    --cc=wangkefeng.wang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.