LKML Archive on
help / color / mirror / Atom feed
From: Pavel Machek <>
To: Tejun Heo <>
Cc: Jeff Garzik <>,,,
Subject: Re: [PATCH/RFC] implement __attribute_discard_text/data__ and use it to leave out PM functions if !CONFIG_PM
Date: Sat, 10 Mar 2007 08:21:25 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>


> This patch is the result from the following discussion.
> The problem is that CONFIG_PM affects a lot of low level drivers and
> scattering CONFIG_PM all over the place is too ugly.  This patch...
> * implements __attribute_discard_text__ and __attribute_discard_data__
>   (not implemented for modules yet, only for built-ins)
> * uses them to implement __pm and __pmdata markers
> * convert libata midlayer and ahci to use it instead of CONFIG_PM
> __attribute_discard_text/data__ puts the marked symbols in separate
> sections which are located from VMA 0 and discarded when generating
> the final image.  It's similar to putting those into /DISCARD/ section
> but won't complain even if the discarded symbols are referenced by
> active sections.  As the discard sections are located from VMA 0,
> actually dereferencing such symbols will result in OOPS.
> This trick certainly makes LLDs cleaner but there are also some
> downsides, so here are the cons.
> * Cannot depend on the compiler to detect illegal dereferences to
>   discarded symbols.  We probably can do this using sparse.
> * Cannot use the compiler to detect unused but unmarked symbols.  This
>   also probably can be done with sparse.
> * EXPORT_SYMBOL() is nullified, so it will take extra bytes for
>   each symbol marked with __pm.  (insignificant)
> * Implementation involves modifying kernel image, module build process
>   and possibly sparse.  It might be too expensive to achieve device
>   driver prettiness, but there are a lot of device drivers out there
>   and a lot of CONFIG_PM's to be added.  Also, discard attributes can
>   be used for other purposes too.
> Any better ideas?  Comments?

Seems ok to me. Certainly better than config_pm...

(cesky, pictures)

      reply	other threads:[~2007-03-10  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-05  3:38 Tejun Heo
2007-03-10  8:21 ` Pavel Machek [this message]

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:

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

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH/RFC] implement __attribute_discard_text/data__ and use it to leave out PM functions if '\!'CONFIG_PM' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).