public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Pratyush Anand <panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [RFC PATCH 1/2] add 99memdebug-ko dracut module
Date: Fri, 4 Nov 2016 16:23:28 +0800	[thread overview]
Message-ID: <20161104082328.GA19275@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <581C3EDE.9080601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Hi Xunlei,

> > If change the logic a bit, it will be clear:
> >
> > is_trace_prepared()
> > {
> >     this function only check if tracing is enabled and events matched.
> > }
> >
> > prepare_trace()
> > {
> >     enable and prepare trace
> > }
> >
> > parse_trace_data()
> > {
> >
> > }
> >
> > if is_trace_prepared == true; then
> >     parse_trace_data
> > else
> >     prepare_trace
> > fi
> >
> > So in cmdline hook is_trace_prepared is false so the script only prepare
> > trace and enable tracing, in latter hooks it will parse trace data.
> >
> > But there should be another function to disable trace before pivot root.
> 
> OK
> 
> We should find a neat way to disable the trace function, what do you think the following way?
> Change show_memstats() and make_trace_mem() as follows:
>     make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem'
>     ... ...
>     make_trace_mem "hook pre-pivot" '1+:mem' '1+:iomem' '3+:slab' '4+:komem'
>     make_trace_mem "hook pre-pivot" '4+:komemfinish' # cleanup trace used by showkomem after use.
> 
>    show_memstats()
>            ... ...
> 
> +        komem)
> +            showkomem
> +            ;;
> +        komemfinish)
> +            # disable trace after use.
> +            showkomem finish
> +            ;;
>      esac
> 

Hmm, I'm not sure it is worth, maybe add a function like
cleanup_trace_mem() is enough and we can add it just before cleanup
hook which is designed for cleanup purpose, cleanup hook is sourced
after pre-pivot so that it will still work for adding trace in any
pre-pivot scripts.

Thanks
Dave

  parent reply	other threads:[~2016-11-04  8:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  9:03 [RFC PATCH 1/2] add 99memdebug-ko dracut module Xunlei Pang
     [not found] ` <1478077386-30039-1-git-send-email-xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-02  9:03   ` [RFC PATCH 2/2] dracut.cmdline.7.asc: update document for rd.memdebug=4 Xunlei Pang
2016-11-03  3:01   ` [RFC PATCH 1/2] add 99memdebug-ko dracut module Dave Young
     [not found]     ` <20161103030142.GA3201-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-03  4:15       ` Xunlei Pang
     [not found]         ` <581AB9D7.2010905-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-03  4:45           ` Xunlei Pang
2016-11-03  7:28           ` Xunlei Pang
     [not found]             ` <581AE707.9050606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-03  8:38               ` Dave Young
     [not found]                 ` <20161103083826.GA15431-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-03 11:52                   ` Xunlei Pang
     [not found]                     ` <581B2518.6060503-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-04  5:50                       ` Dave Young
     [not found]                         ` <20161104055026.GB2889-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-04  6:35                           ` Xunlei Pang
     [not found]                             ` <581C2C30.8070403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-04  7:06                               ` Dave Young
     [not found]                                 ` <20161104070629.GA17145-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-04  7:55                                   ` Xunlei Pang
     [not found]                                     ` <581C3EDE.9080601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-04  8:23                                       ` Dave Young [this message]
     [not found]                                         ` <20161104082328.GA19275-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2016-11-04  9:12                                           ` Xunlei Pang

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=20161104082328.GA19275@dhcp-128-65.nay.redhat.com \
    --to=dyoung-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=panand-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=xlpang-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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