mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wang Nan <wangnan0@huawei.com>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: <linux@arm.linux.org.uk>, Ingo Molnar <mingo@redhat.com>,
	<masami.hiramatsu.pt@hitachi.com>,
	<anil.s.keshavamurthy@intel.com>, <davem@davemloft.net>,
	<ananth@in.ibm.com>, <dave.long@linaro.org>, <tixy@linaro.org>,
	<lizefan@huawei.com>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 09/11] kprobes: core logic of eraly kprobes
Date: Wed, 7 Jan 2015 17:43:18 +0800	[thread overview]
Message-ID: <54ACFFB6.3040102@huawei.com> (raw)
In-Reply-To: <043a01d02a5b$44ec45f0$cec4d1d0$@alibaba-inc.com>

On 2015/1/7 17:21, Hillf Danton wrote:
>>
>> +struct early_kprobe_slot {
>> +	struct optimized_kprobe op;
>> +};
>> +
> [...]
>>
>>  /* Free optimized instructions and optimized_kprobe */
>> +static int ek_free_early_kprobe(struct early_kprobe_slot *slot);
> 
> [2] How is it implemented? In subsequent patches?
> 

It is implemented using macro. Please see patch 7/11 and

DEFINE_EKPROBE_ALLOC_OPS(struct early_kprobe_slot, early_kprobe, static);

following.

>>  static void free_aggr_kprobe(struct kprobe *p)
>>  {
>>  	struct optimized_kprobe *op;
>> +	struct early_kprobe_slot *ep;
>>
>>  	op = container_of(p, struct optimized_kprobe, kp);
>>  	arch_remove_optimized_kprobe(op);
>>  	arch_remove_kprobe(p);
>> -	kfree(op);
>> +	ep = container_of(op, struct early_kprobe_slot, op);
>> +	if (likely(!ek_free_early_kprobe(ep)))
>> +		kfree(op);
> 
> [1] s/op/ep/   yes?

Which one? Do you mean kfree(op) --> kfree(ep)?

If ek_free_early_kprobe(ep) fail (not in early_kprobe area defined by
DEFINE_EKPROBE_ALLOC_OPS), then this is a normal aggr probe, allocated
using kzalloc() as struct optimized_kprobe, see alloc_aggr_kprobe().
So kfree corresponding op structure.

If ek_free_early_kprobe(ep) success, then this is an struct early_kprobe_slot
and allocated statically.

>>  }
>>
> [...]
>> +#else
>> +static int register_early_kprobe(struct kprobe *p) { return -ENOSYS; }
>> +static int ek_free_early_kprobe(struct early_kprobe_slot *slot) { return 0; }
> 
> [3] Compile-able with CONFIG_EARLY_KPROBES enabled?

These empty functions are for CONFIG_EARLY_KPROBES disabled. They won't be compiled
when CONFIG_EARLY_KPROBES=y. I have tested both cases on x86 and ARM.

> 
>> +static void convert_early_kprobes(void) {};
>> +#endif
>> --
>> 1.8.4
> 

Thanks.



  reply	other threads:[~2015-01-07  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07  9:21 Hillf Danton
2015-01-07  9:43 ` Wang Nan [this message]
2015-01-07 10:02   ` Hillf Danton
2015-01-07 10:34     ` Wang Nan
2015-01-08  2:32       ` Hillf Danton
  -- strict thread matches above, loose matches on Subject: below --
2015-01-07  7:34 [RFC PATCH 00/11] Early kprobe: enable kprobes at very early Wang Nan
2015-01-07  7:36 ` [RFC PATCH 09/11] kprobes: core logic of eraly kprobes Wang Nan

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=54ACFFB6.3040102@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=dave.long@linaro.org \
    --cc=davem@davemloft.net \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=tixy@linaro.org \
    /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

Powered by JetHome