linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 4/5] aic7xxx: teach aicasm to not emit unused debug code/data
Date: Mon, 28 Apr 2008 10:25:22 +0200	[thread overview]
Message-ID: <200804281025.22724.vda.linux@googlemail.com> (raw)
In-Reply-To: <48157A34.1080600@suse.de>

On Monday 28 April 2008 09:18, Hannes Reinecke wrote:
> >> I would prefer this: Add a 'count' variable to each symbol
> >> which gets increased every time the symbol is referenced.
> >> And then modify the register definition to include counts
> >> for symbols which are referenced from the source code only
> >> and not from the sequencer code.
> > 
> > To be honest, I don't understand how your patch achieves it.
> > I am not familiar enough with the way aicasm machinery works.
> 
> Ach, that's just straight lex/yacc stuff :-)
> No, seriously, it's not that hard to understand.
> Basically aicasm builds a list of all used symbols, then
> builds a reference table on to of that list whenever a
> symbol is referenced in the actual code, and then does
> some cleanup etc. to be able to put out proper sequencer
> code.
> 
> So the trick here is that we can add a 'count' field to
> the underlying symbol table, which will be incremented
> everytime this symbol is referenced by the sequencer code.
> Nice and clean.
> 
> In theory.
> 
> >> This will give us an automatic usage count for the symbols
> >> with only minimal hand-crafting.
> > 
> > I tested your patches atop my patches 1,2,3 versus my patches
> > 1...5, and versus original scsi-misc-2.6-2008_04_15.
> > They build successfully, although they result in bigger code:
> > 
> [ .. ]
> > 
> > As compared to my patches there are more than 20 kb
> > of unused code. My patches can be improved too.
> > "make namespacecheck" shows unused functions' names.
> > 
> Yes, I know. There is a snag to the above reasoning:
> Symbols are not only referenced by the sequencer code, but
> also by the actual driver. And there are symbols which
> are referenced from the driver source code only, not from
> the sequencer. So aicasm will _not_ catch those.
> 
> That's why I added to 'count' field explicitely to some
> symbols; these are referenced from the source code only.

Why some of these added counts are not 1 but, for example, 19
(CLRINT register)?

> But now we're facing another problem: Those symbols
> referenced from the sequencer code only will in most
> cases _not_ be printed via the autogenerated _print
> functions.
> 
> So what we really need to do here to do this properly
> is to write a preprocessor, which checks the _used_ 
> *_print() functions in the source code and generates
> the aic7*xx_reg_print.c file on the fly. And remove
> this code from aicasm entirely.

I agree that this would be the proper solution in a sense
that it would autodetect and generate only what is needed.

> But this really might be considered a bit of an
> overkill.

Since this is an ad-hoc system, instead of spending time
on more difficult system which does this detection
we can simply manually instruct aicasm to not generate
*_print() functions which won't be ever called by the driver.

Basically this would be a respin of my patch #4.
After you introduced reference counts, I will need
to add much smaller number of "dont_generate_debug_code"
fields than before.

Are you ok with this in principle?
--
vda

  reply	other threads:[~2008-04-28  8:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-25  2:32 [PATCH 1/5] aic7xxx: deinline large or slow functions Denys Vlasenko
2008-04-25  2:34 ` [PATCH 2/5] aic7xxx: add static Denys Vlasenko
2008-04-25  2:36   ` [PATCH 3/5] aic7xxx: add const Denys Vlasenko
2008-04-25  2:41     ` [PATCH 4/5] aic7xxx: teach aicasm to not emit unused debug code/data Denys Vlasenko
2008-04-25  2:44       ` [PATCH 5/5] aic7xxx: update shipped files Denys Vlasenko
2008-04-25 13:03         ` Hannes Reinecke
2008-04-25 13:01       ` [PATCH 4/5] aic7xxx: teach aicasm to not emit unused debug code/data Hannes Reinecke
2008-04-26  0:42         ` Denys Vlasenko
2008-04-28  7:18           ` Hannes Reinecke
2008-04-28  8:25             ` Denys Vlasenko [this message]
2008-05-03  8:40               ` Denys Vlasenko
2008-04-27 13:48         ` James Bottomley
2008-04-25 12:47     ` [PATCH 3/5] aic7xxx: add const Hannes Reinecke
2008-04-25 12:46   ` [PATCH 2/5] aic7xxx: add static Hannes Reinecke
2008-04-25  6:28 ` [PATCH 1/5] aic7xxx: deinline large or slow functions Hannes Reinecke
2008-04-27 13:41 ` James Bottomley
2008-04-27 14:02   ` Denys Vlasenko
2008-04-27 14:20     ` Denys Vlasenko

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=200804281025.22724.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).