From: Jeremy Kerr <jeremy.kerr@canonical.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH 0/7 v2] Common struct clk implementation
Date: Wed, 13 Jan 2010 12:17:36 +1100 [thread overview]
Message-ID: <201001131217.36575.jeremy.kerr@canonical.com> (raw)
In-Reply-To: <20100112091324.GC26435@n2100.arm.linux.org.uk>
Hi Russell,
> But the point I was trying to convey is that OMAP doesn't work with
> _either_ a pure operations struct _or_ a bunch of per-clock function
> pointers - it currently uses a mixture of the two.
With the common clk, you can do exactly that:
struct clk_foo {
/* ->ops provides functions common to clk_foo */
struct clk;
/* provides a function for only this clock */
int (*single_clock_func)(struct clk_foo *);
}
The only real difference is that the public API is provided through struct =
clk=20
rather than redefined clk_* functions; whatever is implementing the clock-
type-specific struct clk can add whatever fields necessary.
=46rom your earlier mail about sizes on omap:
> There are two function pointers in the struct clk which would be
> identical to the versions proposed in this generic struct clk.
> There's a total of 219 clk structures in OMAP3. So, 219 * (4 + 8)
> =3D 2628. Switching OMAP means 219 * (4 + 32) =3D 7884, which is an
> increase in overhead of 3x.
But we also can reduce the size of the struct clk in most cases; I believe =
the=20
separate clk_operations in v2 of this series will help with this.
Taking OMAP3 for example (I'm not very familiar with that platform, so am=20
basing this on a brief look through the clock code), the first step to a=20
common clk port would be to wrap the existing struct clk:
struct clk_omap {
struct clk clk;
struct list_head node;
const struct clkops *ops;
[...]
};
and define the clk_operations to be the current omap clk_* functions.
This results in one extra pointer per clock, plus the clk_operations, so 90=
8=20
bytes (4 * 219 + 32) overhead.
Next, we can start removing fields that are not used by all clocks; the fix=
ed=20
top-level clocks would be a good start; it looks like we can represent thos=
e=20
with a:
struct clk_omap_fixed {
struct clk clk;
char *name;
unsigned long rate;
}
[For these fixed clocks, we don't need to propagate changes to children, he=
nce=20
I'm assuming no child/sibling members]
The original struct clk is 96 bytes; clk_omap_fixed is 12, but we still nee=
d=20
one clk_operations (32 bytes). Since there are 8 of these, we save 640 byte=
s=20
((96 - 12) * 8 - 32).
If we then take the 'follow parent' clocks, it looks like we can represent=
=20
those with something like:
struct clk_omap_followparent =3D {
struct clk clk;
char *name;
struct clk *parent;
struct list_head children, siblings;
unsigned long rate;
void __iomem *enable_reg;
__u8 enable_bit;
char *clkdm_name;
int flags;
};
This would be 48 bytes, there are 140 of these, saving 6688 bytes ( (96 - 4=
8)=20
* 140 - 32).
Now, we could stop here, or keep looking for common usage patterns of struc=
t=20
clk to find cases where creating another clock type makes sense.
I know I've only looked at the easy OMAP cases here, but the principle stil=
l=20
applies: keep the original struct clk around as a fallback, but use the=20
smaller struct clks where possible.
Cheers,
Jeremy
prev parent reply other threads:[~2010-01-13 1:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-12 6:58 [RFC,PATCH 0/7 v2] Common struct clk implementation Jeremy Kerr
2010-01-12 6:58 ` [RFC,PATCH 3/7 v2] arm/versatile: use generic struct clk Jeremy Kerr
2010-01-12 16:25 ` Russell King - ARM Linux
2010-01-25 0:35 ` Jeremy Kerr
2010-01-12 6:58 ` [RFC,PATCH 7/7 v2] arm/icst307: remove icst307_ps_to_vco Jeremy Kerr
2010-01-12 6:58 ` [RFC,PATCH 5/7 v2] arm/realview: use generic struct clk Jeremy Kerr
2010-01-12 6:58 ` [RFC,PATCH 2/7 v2] Generic support for fixed-rate clocks Jeremy Kerr
2010-01-12 6:58 ` [RFC,PATCH 1/7 v2] Add a common struct clk Jeremy Kerr
2010-01-12 8:48 ` Francesco VIRLINZI
2010-01-12 9:01 ` Russell King - ARM Linux
2010-01-12 14:24 ` Ben Dooks
2010-01-12 14:27 ` Ben Dooks
2010-01-12 14:30 ` Ben Dooks
2010-01-12 6:58 ` [RFC, PATCH 6/7 v2] arm/icst307: use common struct clk, unify realview and versatile clocks Jeremy Kerr
2010-01-12 6:58 ` [RFC,PATCH 4/7 v2] arm/versatile: remove oscoff from clk_versatile Jeremy Kerr
2010-01-12 9:13 ` [RFC,PATCH 0/7 v2] Common struct clk implementation Russell King - ARM Linux
2010-01-13 1:17 ` Jeremy Kerr [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:
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=201001131217.36575.jeremy.kerr@canonical.com \
--to=jeremy.kerr@canonical.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.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).