From: Arnd Bergmann <arnd@arndb.de>
To: cbe-oss-dev@ozlabs.org
Cc: Christian Krafft <krafft@de.ibm.com>, cpufreq@lists.linux.org.uk
Subject: Re: [Cbe-oss-dev] Subject: cell: add spu aware cpufreq governor
Date: Sat, 19 Jan 2008 22:38:44 +0100 [thread overview]
Message-ID: <200801192238.45636.arnd@arndb.de> (raw)
In-Reply-To: <20080118171119.3faa4a6a@de.ibm.com>
On Friday 18 January 2008, Christian Krafft wrote:
> +#include <linux/cpufreq.h>
> +#include <linux/sched.h>
> +#include <linux/timer.h>
> +#include <asm/atomic.h>
> +#include <asm/machdep.h>
> +#include <asm/spu.h>
> +
> +#include "asm/cell-regs.h"
> +
> +#define DEBUG 1
You should have the '#define DEBUG' _before_ the #includes, otherwise pr_debug
and friends don't do what you think they do.
> +static void spu_gov_init_work(struct spu_gov_info_struct *info);
Try to avoid forward declarations for static functions, instead reorder
the functions in call order.
> +
> +static void spu_gov_timer(struct work_struct *work)
'timer' is a bad name for a work function, because it suggests
you're working on a timer_list.
> +static void spu_gov_init_work(struct spu_gov_info_struct *info)
> +{
> + int delay = usecs_to_jiffies(info->poll_int * 1000);
> + delay -= jiffies % delay;
> + INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_timer);
> + queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
> +}
I think you shouldn't call INIT_DELAYED_WORK_DEFERRABLE() more than once.
While I'm not sure if it's actually broken like you do it, it's certainly
not how this interface was meant to be used.
What's the point of the computation, can't you just always queue the
work to be run in info->poll_int miliseconds from the time you call it?
> +static void spu_gov_cancel_work(struct spu_gov_info_struct *info)
> +{
> + cancel_delayed_work(&info->work);
> +}
Doesn't that need to be cancel_delayed_work_sync() for rearming work queues?
> +static int __init spu_gov_init(void)
> +{
> + if (!machine_is(cell))
> + return -ENODEV;
This seems wrong, why would you only allow that on cell platforms,
but e.g. not celleb or even ps3 (assuming they had a cpufreq
backend)? I think the only dependency is on spufs being loaded and
that should work using module dependencies.
> + kspugov_wq = create_workqueue("kspugov");
> + if (!kspugov_wq) {
> + printk(KERN_ERR "creation of kspugov failed\n");
> + return -EFAULT;
> + }
> +
> + return cpufreq_register_governor(&spu_governor);
> +}
> +
> +static void __exit spu_gov_exit(void)
> +{
> + cpufreq_unregister_governor(&spu_governor);
> + destroy_workqueue(kspugov_wq);
> +}
What happens when the work functions is called after unregistering?
Arnd <><
next prev parent reply other threads:[~2008-01-19 21:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 16:11 Subject: cell: add spu aware cpufreq governor Christian Krafft
2008-01-19 21:38 ` Arnd Bergmann [this message]
2008-01-28 18:03 ` [Cbe-oss-dev] " Christian Krafft
2008-01-28 18:12 ` [Cbe-oss-dev] [Patch] Resending: " Christian Krafft
2008-04-14 0:21 ` Arnd Bergmann
2008-04-16 11:49 ` [Cbe-oss-dev] [Patch] Resending: cell_add_spuaware_cpufreq_governor.diff Christian Krafft
2008-04-16 12:08 ` Arnd Bergmann
2008-04-16 14:53 ` Christian Krafft
2008-01-21 3:09 ` [Cbe-oss-dev] Subject: cell: add spu aware cpufreq governor Akinobu Mita
2008-01-28 10:26 ` Christian Krafft
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=200801192238.45636.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=cbe-oss-dev@ozlabs.org \
--cc=cpufreq@lists.linux.org.uk \
--cc=krafft@de.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.