lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 26 Jun 2008 06:56:08 -0700 (PDT)
From:	Alan Jenkins <aj504@...york.ac.uk>
To:	夏亮 <xiaiaxaxi@...u.edu.cn>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Can I use yield in this way

夏亮 wrote:
> Hello,
>
>         I'd like to ask a question about the use of a kernel function,
> yield(); I am working on Intel Core Duo, running Linux 2.6.21 I want
> to let current process be off the cpu when the temperature of cpu is
> too high. I add a function called thermal_balance in the timer
> interrupt. My program is as following,
>
> scheduler_tick()
> {
>        static int count = 0;
>        count++;
>        if(count % 100 == 0)
>            thermal_balance();
> }
>
> static int thermal_balance(void)
> {
>        int cpu = smp_processor_id();
>        struct task_struct* task;
>        Get CPU temperature.
>
>        if (temperature is too high){
>                task = cpu_rq(cpu)->curr;
>                yield();
>                Move task to other cpu.
>        }
> }
>
>        Can yield() be used as above. After I compile the kernel and
> run again. Kernel is not working just as it meets deadlock. And if I
> comment yield(), it runs ok. Could anyone help me?Thanks!
>

That sounds like an odd solution.

Two other possible solutions come to mind.

1) Use a real-time thread at the highest priority pinned to each
processor to poll the temperature.  When the temperature is too high
on that cpu, the real-time thread should run idle.  I don't know if
that's realistically possible though; I'm sure you can't execute a HLT
instruction in a userspace thread and you would want to be able to
call the cpu-specific idle function which is already used during
normal idle.

2) hotplug CPUs when they become too hot.  Unfortunately a hotplugged
CPU will not idle in the most efficient way - it's a known problem
which can e.g prevent the use of CPU deep sleep states on other cores
in the same package.

What would be best is if you could use the existing power management
infrastructure.  ACPI already has thermal management, so it might be
nicer if you could add "stop the cpu completely" as a method to the
existing ACPI thermal code (the current methods involve cooling
devices aka fans and ACPI CPU throttling states).

Your logic also sounds strange.  What is supposed to happen if the
temperature stays too high on all cpus?

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists