Skip to content
Snippets Groups Projects
  1. Mar 12, 2010
    • Stanislaw Gruszka's avatar
      cpu-timers: Avoid iterating over all threads in fastpath_timer_check() · c2873937
      Stanislaw Gruszka authored
      
      Spread p->sighand->siglock locking scope to make sure that
      fastpath_timer_check() never iterates over all threads. Without
      locking there is small possibility that signal->cputimer will stop
      running while we write values to signal->cputime_expires.
      
      Calling thread_group_cputime() from fastpath_timer_check() is not only
      bad because it is slow, also it is racy with __exit_signal() which can
      lead to invalid signal->{s,u}time values.
      
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      c2873937
    • Stanislaw Gruszka's avatar
      cpu-timers: Change SIGEV_NONE timer implementation · 1f169f84
      Stanislaw Gruszka authored
      
      When user sets up a timer without associated signal and process does
      not use any other cpu timers and does not exit, tsk->signal->cputimer
      is enabled and running forever.
      
      Avoid running the timer for no reason.
      
      I used below program to check patch does not break current user space
      visible behavior.
      
       #include <sys/time.h>
       #include <signal.h>
       #include <stdio.h>
       #include <stdlib.h>
       #include <string.h>
       #include <time.h>
       #include <unistd.h>
       #include <assert.h>
      
       void consume_cpu(void)
       {
      	int i = 0;
      	int count = 0;
      
      	for(i=0; i<100000000; i++)
      		count++;
       }
      
       int main(void)
       {
      	int i;
      	struct sigaction act;
      	struct sigevent evt = { };
      	timer_t tid;
      	struct itimerspec spec = { };
      
      	evt.sigev_notify = SIGEV_NONE;
      	assert(timer_create(CLOCK_PROCESS_CPUTIME_ID, &evt,  &tid) == 0);
      
      	spec.it_value.tv_sec = 10;
      	assert(timer_settime(tid, 0, &spec,  NULL) == 0);
      
      	for (i = 0; i < 30; i++) {
      		consume_cpu();
      		memset(&spec, 0, sizeof(spec));
      		assert(timer_gettime(tid, &spec) == 0);
      		printf("%lu.%09lu\n",
      			(unsigned long) spec.it_value.tv_sec,
      			(unsigned long) spec.it_value.tv_nsec);
      	}
      
      	assert(timer_delete(tid) == 0);
      	return 0;
       }
      
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      1f169f84
    • Stanislaw Gruszka's avatar
      cpu-timers: Return correct previous timer reload value · ae1a78ee
      Stanislaw Gruszka authored
      
      According POSIX we need to correctly set old timer it_interval value when
      user request that in timer_settime().  Tested using below program.
      
       #include <sys/time.h>
       #include <signal.h>
       #include <stdio.h>
       #include <stdlib.h>
       #include <time.h>
       #include <unistd.h>
       #include <assert.h>
      
       int main(void)
       {
      	struct sigaction act;
      	struct sigevent evt = { };
      	timer_t tid;
      	struct itimerspec spec, u_spec, k_spec;
      
      	evt.sigev_notify = SIGEV_SIGNAL;
      	evt.sigev_signo = SIGPROF;
      	assert(timer_create(CLOCK_PROCESS_CPUTIME_ID, &evt,  &tid) == 0);
      
      	spec.it_value.tv_sec = 1;
      	spec.it_value.tv_nsec = 2;
      	spec.it_interval.tv_sec = 3;
      	spec.it_interval.tv_nsec = 4;
      	u_spec = spec;
      	assert(timer_settime(tid, 0, &spec,  NULL) == 0);
      
      	spec.it_value.tv_sec = 5;
      	spec.it_value.tv_nsec = 6;
      	spec.it_interval.tv_sec = 7;
      	spec.it_interval.tv_nsec = 8;
      	assert(timer_settime(tid, 0, &spec,  &k_spec) == 0);
      
       #define PRT(val) printf(#val ":\t%d/%d\n", (int) u_spec.val, (int) k_spec.val)
      	PRT(it_value.tv_sec);
      	PRT(it_value.tv_nsec);
      	PRT(it_interval.tv_sec);
      	PRT(it_interval.tv_nsec);
      
      	return 0;
       }
      
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      ae1a78ee
    • Stanislaw Gruszka's avatar
      cpu-timers: Cleanup arm_timer() · 5eb9aa64
      Stanislaw Gruszka authored
      
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      5eb9aa64
    • Stanislaw Gruszka's avatar
      cpu-timers: Simplify RLIMIT_CPU handling · f55db609
      Stanislaw Gruszka authored
      Let always set signal->cputime_expires expiration cache when setting
      new itimer, POSIX 1.b timer, and RLIMIT_CPU.  Since we are
      initializing prof_exp expiration cache during fork(), this allows to
      remove "RLIMIT_CPU != inf" check from fastpath_timer_check() and do
      some other cleanups.
      
      Checked against regression using test cases from:
      http://marc.info/?l=linux-kernel&m=123749066504641&w=4
      http://marc.info/?l=linux-kernel&m=123811277916642&w=2
      
      
      
      Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      f55db609
  2. Mar 08, 2010
  3. Mar 07, 2010
    • Randy Dunlap's avatar
      msi-laptop: depends on RFKILL · 410c1765
      Randy Dunlap authored
      
      msi-laptop uses rfkill*() interfaces so it should depend on RFKILL.
      
      msi-laptop.c:(.text+0x1fcd1b): undefined reference to `rfkill_alloc'
      msi-laptop.c:(.text+0x1fcd76): undefined reference to `rfkill_register'
      msi-laptop.c:(.text+0x1fcdc8): undefined reference to `rfkill_destroy'
      msi-laptop.c:(.text+0x1fcdd9): undefined reference to `rfkill_unregister'
      
      This repairs "msi-laptop: Detect 3G device exists by standard ec command",
      which is in some gregkh tree.
      
      Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Cc: Lee, Chun-Yi <jlee@novell.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      410c1765
    • Lee, Chun-Yi's avatar
      msi-laptop: Detect 3G device exists by standard ec command · e22388e7
      Lee, Chun-Yi authored
      
      Detect 3G device exists by standard ec command. Driver will not create the threeg sysfs
      file and threeg rfkill interface if there have no internal 3G device in MSI notebook/netbook.
      
      Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e22388e7
    • Lee, Chun-Yi's avatar
      msi-laptop: Add resume method for set the SCM load again · ec766278
      Lee, Chun-Yi authored
      
      Implement the resume method for set the load SCM flag after system reusme.
      Without this patch, the wifi function key on SCM model will back to BIOS
      control mode then confuse with the userland software control.
      e.g. MSI N034
      
      Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ec766278
    • Lee, Chun-Yi's avatar
      msi-laptop: Support some MSI 3G netbook that is need load SCM · 472ea12d
      Lee, Chun-Yi authored
      
      Some MSI 3G netbook only have one fn key to control Wlan/Bluetooth/3G,
      those netbook will load the SCM (windows app) to disable the original
      Wlan/Bluetooth control by BIOS when user press fn key, then control
      Wlan/Bluetooth/3G by SCM (software control by OS). Without SCM, user
      cann't on/off 3G module on those 3G netbook.
      On Linux, msi-laptop driver will do the same thing to disable the
      original BIOS control, then might need use HAL or other userland
      application to do the software control that simulate with SCM.
      e.g. MSI N034 netbook
      
      Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      472ea12d
    • Lee, Chun-Yi's avatar
      msi-laptop: Add threeg sysfs file for support query 3G state by standard 66/62 ec command · fc0dc4c9
      Lee, Chun-Yi authored
      
      Add threeg sysfs file for support query 3G state by standard 66/62 ec
      command, the MSI standard ec interface supported this feature.
      
      Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      fc0dc4c9
    • Lee, Chun-Yi's avatar
      msi-laptop: Support standard ec 66/62 command on MSI notebook and nebook · 46d0e9e0
      Lee, Chun-Yi authored
      
      Suppport standard ec 66/62 command on MSI notebook and nebook. MSI
      netbook and notebook already support 66/62 command, so, add new
      get_state function, and put the old model to non-standard model, but
      driver still support those old model.
      
      Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
      Cc: Lennart Poettering <mzxreary@0pointer.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      46d0e9e0
    • Greg Kroah-Hartman's avatar
      Driver core: create lock/unlock functions for struct device · 8e9394ce
      Greg Kroah-Hartman authored
      
      In the future, we are going to be changing the lock type for struct
      device (once we get the lockdep infrastructure properly worked out)  To
      make that changeover easier, and to possibly burry the lock in a
      different part of struct device, let's create some functions to lock and
      unlock a device so that no out-of-core code needs to be changed in the
      future.
      
      This patch creates the device_lock/unlock/trylock() functions, and
      converts all in-tree users to them.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Dave Young <hidave.darkstar@gmail.com>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Magnus Damm <damm@igel.co.jp>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Alex Chiang <achiang@hp.com>
      Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrew Patterson <andrew.patterson@hp.com>
      Cc: Yu Zhao <yu.zhao@intel.com>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Wolfram Sang <w.sang@pengutronix.de>
      Cc: CHENG Renquan <rqcheng@smu.edu.sg>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Frans Pop <elendil@planet.nl>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      8e9394ce
    • Stephen Rothwell's avatar
      sysfs: fix for thinko with sysfs_bin_attr_init() · 62e877b8
      Stephen Rothwell authored
      
      After merging the final tree, today's linux-next build (powerpc
      allyesconfig) failed like this:
      
      drivers/pci/pci-sysfs.c: In function 'pci_create_legacy_files':
      drivers/pci/pci-sysfs.c:645: error: lvalue required as unary '&' operand
      drivers/pci/pci-sysfs.c:658: error: lvalue required as unary '&' operand
      
      Caused by commit "sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on
      dynamic attributes" interacting with commit "sysfs: Use one lockdep
      class per sysfs attribute") both from the driver-core tree.
      
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      62e877b8
Loading