From: Michael Ellerman <mpe@ellerman.id.au>
To: Dave Olson <olson@cumulusnetworks.com>, linuxppc-dev@lists.ozlabs.org
Cc: Dave Olson <olson@cumulusnetworks.com>
Subject: Re: [v3] Fix missing L2 cache size in /sys/devices/system/cpu
Date: Thu, 26 Mar 2015 15:49:27 +1100 (AEDT) [thread overview]
Message-ID: <20150326044927.EAD4D1400B7@ozlabs.org> (raw)
In-Reply-To: <1424909087-2819-1-git-send-email-olson@cumulusnetworks.com>
On Thu, 2015-26-02 at 00:04:47 UTC, Dave Olson wrote:
> @@ -324,14 +335,33 @@ static bool cache_node_is_unified(const struct device_node *np)
> return of_get_property(np, "cache-unified", NULL);
> }
>
> +/*
> + * Handle unified caches that have two different types of tags. Most embedded
> + * use cache-size, etc. for the unified cache size, but open firmware systems
> + * use d-cache-size, etc. Since they all appear to be consistent, check on
> + * initialization for which type we are, and use the appropriate structure.
> + */
> static struct cache *cache_do_one_devnode_unified(struct device_node *node,
> int level)
> {
> struct cache *cache;
> + int ucache;
>
> pr_debug("creating L%d ucache for %s\n", level, node->full_name);
>
> cache = new_cache(CACHE_TYPE_UNIFIED, level, node);
^^
> + if (of_get_property(node,
> + cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL)) {
> + ucache = CACHE_TYPE_UNIFIED_D;
> + } else {
> + ucache = CACHE_TYPE_UNIFIED; /* assume embedded */
> + if (of_get_property(node,
> + cache_type_info[CACHE_TYPE_UNIFIED].size_prop, NULL) ==
> + NULL)
> + printk(KERN_WARNING "Unified cache property missing\n");
> + }
> +
> + cache = new_cache(ucache, level, node);
^^
>
> return cache;
> }
That looks fishy. You create a cache, and then throw it away and create another
one and return that. I don't think that's what you intended, is it?
It would also be cleaner I think if you created another helper, eg.
cache_is_unified_d() to do the property lookup.
And also I don't think you need to do the second property lookup, especially if
all you're going to do is print a warning.
cheers
next prev parent reply other threads:[~2015-03-26 4:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 0:04 [PATCH v3] Fix missing L2 cache size in /sys/devices/system/cpu olson
2015-03-26 4:49 ` Michael Ellerman [this message]
2015-03-26 19:49 ` [v3] " Dave Olson
2015-03-26 23:39 ` Michael Ellerman
2015-04-03 3:33 ` [PATCH] " olson
2015-04-03 4:28 ` [PATCHv5 1/1] " olson
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=20150326044927.EAD4D1400B7@ozlabs.org \
--to=mpe@ellerman.id.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=olson@cumulusnetworks.com \
/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).