1. 10 7月, 2009 2 次提交
    • F
      printk: Restore previous console_loglevel when re-enabling logging · 1aaad49e
      Frans Pop 提交于
      When logging to console is disabled from userspace using klogctl()
      and later re-enabled, console_loglevel gets set to the default
      log level instead to the previous value.
      
      This means that if the kernel was booted with 'quiet', the boot is
      suddenly no longer quiet after logging to console gets re-enabled.
      
      Save the current console_loglevel when logging is disabled and
      restore to that value. If the log level is set to a specific value
      while disabled, this is interpreted as an implicit re-enabling of
      the logging.
      
      The problem that prompted this patch is described in:
      
          http://lkml.org/lkml/2009/6/28/234
      
      There are two variations possible on the patch below:
      
       1) If klogctl(7) is called while logging is not disabled, then set level
          to default (partially preserving current functionality):
        	case 7:		/* Enable logging to console */
       -		console_loglevel = default_console_loglevel;
       +		if (saved_console_loglevel == -1)
       +			console_loglevel = default_console_loglevel;
       +		else {
       +			console_loglevel = saved_console_loglevel;
       +			saved_console_loglevel = -1;
       +		}
      
       2) If klogctl(8) is called while logging is disabled, then don't enable
          logging, but remember the requested value for when logging does get
          enabled again:
        	case 8:		/* Set level of messages printed to console */
       [...]
       - 		console_loglevel = len;
       +		if (saved_console_loglevel == -1)
       +			console_loglevel = len;
       +		else
       +			saved_console_loglevel = len;
      
      Yet another option would be to ignore the request.
      Signed-off-by: NFrans Pop <elendil@planet.nl>
      Cc: cryptsetup@packages.debian.org
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <200907061331.49930.elendil@planet.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1aaad49e
    • R
      printk: Ensure that "console enabled" messages are printed on the console · 8259cf43
      Robin Getz 提交于
      Today, when a console is registered without CON_PRINTBUFFER,
      end users never see the announcement of it being added, and
      never know if they missed something, if the console is really
      at the start or not, and just leads to general confusion.
      
      This re-orders existing code, to make sure the console is
      added, before the "console [%s%d] enabled" is printed out -
      ensuring that this message is _always_ seen.
      
      This has the desired/intended side effect of making sure that
      "console enabled:" messages are printed on the bootconsole, and
      the real console. This does cause the same line is printed
      twice if the bootconsole and real console are the same device,
      but if they are on different devices, the message is printed to
      both consoles.
      
      Signed-off-by : Robin Getz <rgetz@blackfin.uclinux.org>
      Cc: "Andrew Morton" <akpm@linux-foundation.org>
      Cc: "Linus Torvalds" <torvalds@linux-foundation.org>
      LKML-Reference: <200907091308.37370.rgetz@blackfin.uclinux.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8259cf43
  2. 03 7月, 2009 3 次提交
    • R
      printk: Enable the use of more than one CON_BOOT (early console) · 4d091611
      Robin Getz 提交于
      Today, register_console() assumes the following usage:
      
        - The first console to register with a flag set to CON_BOOT
          is the one and only bootconsole.
      
        - If another register_console() is called with an additional
          CON_BOOT, it is silently rejected.
      
        - As soon as a console without the CON_BOOT set calls
          registers the bootconsole is automatically unregistered.
      
        - Once there is a "real" console - register_console() will
          silently reject any consoles with it's CON_BOOT flag set.
      
      In many systems (alpha, blackfin, microblaze, mips, powerpc,
      sh, & x86), there are early_printk implementations, which use
      the CON_BOOT which come out serial ports, vga, usb, & memory
      buffers.
      
      In many embedded systems, it would be nice to have two
      bootconsoles - in case the primary fails, you always have
      access to a backup memory buffer - but this requires at least
      two CON_BOOT consoles...
      
      This patch enables that functionality.
      
      With the change applied, on boot you get (if you try to
      re-enable a boot console after the "real" console has been
      registered):
      
        root:/> dmesg | grep console
        bootconsole [early_shadow0] enabled
        bootconsole [early_BFuart0] enabled
        Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600 console=ttyBF0,57600 nmi_debug=regs
        console handover:boot [early_BFuart0] boot [early_shadow0]  -> real [ttyBF0]
        Too late to register bootconsole early_shadow0
      
      or:
      
        root:/> dmesg | grep console
        Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,57600
        console [ttyBF0] enabled
      Signed-off-by: NRobin Getz <rgetz@blackfin.uclinux.org>
      Cc: "Linus Torvalds" <torvalds@linux-foundation.org>
      Cc: "Andrew Morton" <akpm@linux-foundation.org>
      Cc: "Mike Frysinger" <vapier.adi@gmail.com>
      Cc: "Paul Mundt" <lethal@linux-sh.org>
      LKML-Reference: <200907012108.38030.rgetz@blackfin.uclinux.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4d091611
    • Y
      x86: add boundary check for 32bit res before expand e820 resource to alignment · 7c5371c4
      Yinghai Lu 提交于
      fix hang with HIGHMEM_64G and 32bit resource.  According to hpa and
      Linus, use (resource_size_t)-1 to fend off big ranges.
      
      Analyzed by hpa
      Reported-and-tested-by: NMikael Pettersson <mikpe@it.uu.se>
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7c5371c4
    • L
      x86: fix power-of-2 round_up/round_down macros · 43644679
      Linus Torvalds 提交于
      These macros had two bugs:
       - the type of the mask was not correctly expanded to the full size of
         the argument being expanded, resulting in possible loss of high bits
         when mixing types.
       - the alignment argument was evaluated twice, despite the macro looking
         like a fancy function (but it really does need to be a macro, since
         it works on arbitrary integer types)
      
      Noticed by Peter Anvin, and with a fix that is a modification of his
      suggestion (bug noticed by Yinghai Lu).
      
      Cc: Peter Anvin <hpa@zytor.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      43644679
  3. 02 7月, 2009 15 次提交
    • D
      FRV: Add basic performance counter support · 42ca4fb6
      David Howells 提交于
      Add basic performance counter support to the FRV arch.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      42ca4fb6
    • D
      FRV: Implement atomic64_t · 00460f41
      David Howells 提交于
      Implement atomic64_t and its ops for FRV.  Tested with the following patch:
      
      	diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
      	index 55e4fab..086d50d 100644
      	--- a/arch/frv/kernel/setup.c
      	+++ b/arch/frv/kernel/setup.c
      	@@ -746,6 +746,52 @@ static void __init parse_cmdline_early(char *cmdline)
      
      	 } /* end parse_cmdline_early() */
      
      	+static atomic64_t xxx;
      	+
      	+static void test_atomic64(void)
      	+{
      	+	atomic64_set(&xxx, 0x12300000023LL);
      	+
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != 0x12300000023LL);
      	+	mb();
      	+	if (atomic64_inc_return(&xxx) != 0x12300000024LL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != 0x12300000024LL);
      	+	mb();
      	+	if (atomic64_sub_return(0x36900000050LL, &xxx) != -0x2460000002cLL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != -0x2460000002cLL);
      	+	mb();
      	+	if (atomic64_dec_return(&xxx) != -0x2460000002dLL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != -0x2460000002dLL);
      	+	mb();
      	+	if (atomic64_add_return(0x36800000001LL, &xxx) != 0x121ffffffd4LL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != 0x121ffffffd4LL);
      	+	mb();
      	+	if (atomic64_cmpxchg(&xxx, 0x123456789abcdefLL, 0x121ffffffd4LL) != 0x121ffffffd4LL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != 0x121ffffffd4LL);
      	+	mb();
      	+	if (atomic64_cmpxchg(&xxx, 0x121ffffffd4LL, 0x123456789abcdefLL) != 0x121ffffffd4LL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != 0x123456789abcdefLL);
      	+	mb();
      	+	if (atomic64_xchg(&xxx, 0xabcdef123456789LL) != 0x123456789abcdefLL)
      	+		BUG();
      	+	mb();
      	+	BUG_ON(atomic64_read(&xxx) != 0xabcdef123456789LL);
      	+	mb();
      	+}
      	+
      	 /*****************************************************************************/
      	 /*
      	  *
      	@@ -845,6 +891,8 @@ void __init setup_arch(char **cmdline_p)
      	 //	asm volatile("movgs %0,timerd" :: "r"(10000000));
      	 //	__set_HSR(0, __get_HSR(0) | HSR0_ETMD);
      
      	+	test_atomic64();
      	+
      	 } /* end setup_arch() */
      
      	 #if 0
      
      Note that this doesn't cover all the trivial wrappers, but does cover all the
      substantial implementations.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      00460f41
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 · 5a475ce4
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
        sh: LCDC dcache flush for deferred io
        sh: Fix compiler error and include the definition of IS_ERR_VALUE
        sh: re-add LCDC fbdev support to the Migo-R defconfig
        sh: fix se7724 ceu names
        sh: ms7724se: Enable sh_eth in defconfig.
        arch/sh/boards/mach-se/7206/io.c: Remove unnecessary semicolons
        sh: ms7724se: Add sh_eth support
        nommu: provide follow_pfn().
        sh: Kill off unused DEBUG_BOOTMEM symbol.
        perf_counter tools: add cpu_relax()/rmb() definitions for sh.
        sh64: Hook up page fault events for software perf counters.
        sh: Hook up page fault events for software perf counters.
        sh: make set_perf_counter_pending() static inline.
        clocksource: sh_tmu: Make undefined TCOR behaviour less undefined.
      5a475ce4
    • P
      sh: LCDC dcache flush for deferred io · 1c6a307a
      Paul Mundt 提交于
      Since writenotify on uncached vmas is unsupported in 2.6.31,
      live with cached framebuffer memory in the deferred io
      case for now and flush the dcache before forcing refresh.
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      Acked-by: NMagnus damm <damm@igel.co.jp>
      1c6a307a
    • M
      sh: Fix compiler error and include the definition of IS_ERR_VALUE · 34e19ada
      Matt Fleming 提交于
      When arch/sh/include/asm/syscall_32.h is included from a file that
      doesn't also include linux/err.h the following error is produced,
      
      In file included from /home/matt/src/kernels/sh-2.6/arch/sh/include/asm/syscall.h:5,
                       from kernel/trace/trace_syscalls.c:3:
      /home/matt/src/kernels/sh-2.6/arch/sh/include/asm/syscall_32.h: In function 'syscall_get_error':
      /home/matt/src/kernels/sh-2.6/arch/sh/include/asm/syscall_32.h:28: error: implicit declaration of function 'IS_ERR_VALUE'
      make[2]: *** [kernel/trace/trace_syscalls.o] Error 1
      make[1]: *** [kernel/trace] Error 2
      make: *** [kernel] Error 2
      Signed-off-by: NMatt Fleming <matt@console-pimps.org>
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      34e19ada
    • R
      kernel-doc: move ignoring kmemcheck · d960eea9
      Randy Dunlap 提交于
      Somehow I managed to generate a diff that put these 2 lines
      into the wrong function:  should have been in dump_struct()
      instead of in dump_enum().
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d960eea9
    • L
      Merge git://git.infradead.org/mtd-2.6 · 5c5d4e8e
      Linus Torvalds 提交于
      * git://git.infradead.org/mtd-2.6:
        mtd: nand: fix build failure and incorrect return from omap_wait()
        mtd: Use BLOCK_NIL consistently in NFTL/INFTL
        mtd: m25p80 timeout too short for worst-case m25p16 devices
        mtd: atmel_nand: Fix typo s/parititions/partitions/
        mtd: cmdlineparts: Use 64-bit format when printing a debug message.
        mtd: maps: Remove BUS_ID_SIZE from integrator_flash
        jffs2: fix another potential leak on error path in scan.c
      5c5d4e8e
    • L
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse · fa172f40
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
        fuse: invalidation reverse calls
        fuse: allow umask processing in userspace
        fuse: fix bad return value in fuse_file_poll()
        fuse: fix return value of fuse_dev_write()
      fa172f40
    • D
      Fix iommu address space allocation · a15a519e
      David Woodhouse 提交于
      This fixes kernel.org bug #13584. The IOVA code attempted to optimise
      the insertion of new ranges into the rbtree, with the unfortunate result
      that some ranges just didn't get inserted into the tree at all. Then
      those ranges would be handed out more than once, and things kind of go
      downhill from there.
      
      Introduced after 2.6.25 by ddf02886
      ("PCI: iova RB tree setup tweak").
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Cc: mark gross <mgross@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a15a519e
    • D
      Fix pci_unmap_addr() et al on i386. · 788d84bb
      David Woodhouse 提交于
      We can run a 32-bit kernel on boxes with an IOMMU, so we need
      pci_unmap_addr() etc. to work -- without it, drivers will leak mappings.
      
      To be honest, this whole thing looks like it's more pain than it's
      worth; I'm half inclined to remove the no-op #else case altogether.
      
      But this is the minimal fix, which just does the right thing if
      CONFIG_DMAR is set.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Cc: stable@kernel.org  [ for 2.6.30 ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      788d84bb
    • A
      elf: fix one check-after-use · e2dbe125
      Amerigo Wang 提交于
      Check before use it.
      Signed-off-by: NWANG Cong <amwang@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: David Howells <dhowells@redhat.com>
      Acked-by: NRoland McGrath <roland@redhat.com>
      Acked-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e2dbe125
    • L
      Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block · 2027bd9f
      Linus Torvalds 提交于
      * 'for-linus' of git://git.kernel.dk/linux-2.6-block:
        cfq-iosched: remove redundant check for NULL cfqq in cfq_set_request()
        blocK: Restore barrier support for md and probably other virtual devices.
        block: get rid of queue-private command filter
        block: Create bip slabs with embedded integrity vectors
        cfq-iosched: get rid of the need for __GFP_NOFAIL in cfq_find_alloc_queue()
        cfq-iosched: move cfqq initialization out of cfq_find_alloc_queue()
        Trivial typo fixes in Documentation/block/data-integrity.txt.
      2027bd9f
    • L
      Merge branch 'for-linus' of git://neil.brown.name/md · 544ae5f9
      Linus Torvalds 提交于
      * 'for-linus' of git://neil.brown.name/md:
        md: use interruptible wait when duration is controlled by userspace.
        md/raid5: suspend shouldn't affect read requests.
        md: tidy up error paths in md_alloc
        md: fix error path when duplicate name is found on md device creation.
        md: avoid dereferencing NULL pointer when accessing suspend_* sysfs attributes.
        md: Use new topology calls to indicate alignment and I/O sizes
      544ae5f9
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · 7b85425f
      Linus Torvalds 提交于
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (31 commits)
        Revert "ipv4: arp announce, arp_proxy and windows ip conflict verification"
        igb: return PCI_ERS_RESULT_DISCONNECT on permanent error
        e1000e: io_error_detected callback should return PCI_ERS_RESULT_DISCONNECT
        e1000: return PCI_ERS_RESULT_DISCONNECT on permanent error
        e1000: fix unmap bug
        igb: fix unmap length bug
        ixgbe: fix unmap length bug
        ixgbe: Fix link capabilities during adapter resets
        ixgbe: Fix device capabilities of 82599 single speed fiber NICs.
        ixgbe: Fix SFP log messages
        usbnet: Remove private stats structure
        usbnet: Use netdev stats structure
        smsc95xx: Use netdev stats structure
        rndis_host: Use netdev stats structure
        net1080: Use netdev stats structure
        dm9601: Use netdev stats structure
        cdc_eem: Use netdev stats structure
        ipv4: Fix fib_trie rebalancing, part 3
        bnx2x: Fix the behavior of ethtool when ONBOOT=no
        sctp: xmit sctp packet always return no route error
        ...
      7b85425f
    • I
      kmemleak: Fix scheduling-while-atomic bug · 57d81f6f
      Ingo Molnar 提交于
      One of the kmemleak changes caused the following
      scheduling-while-holding-the-tasklist-lock regression on x86:
      
      BUG: sleeping function called from invalid context at mm/kmemleak.c:795
      in_atomic(): 1, irqs_disabled(): 0, pid: 1737, name: kmemleak
      2 locks held by kmemleak/1737:
       #0:  (scan_mutex){......}, at: [<c10c4376>] kmemleak_scan_thread+0x45/0x86
       #1:  (tasklist_lock){......}, at: [<c10c3bb4>] kmemleak_scan+0x1a9/0x39c
      Pid: 1737, comm: kmemleak Not tainted 2.6.31-rc1-tip #59266
      Call Trace:
       [<c105ac0f>] ? __debug_show_held_locks+0x1e/0x20
       [<c102e490>] __might_sleep+0x10a/0x111
       [<c10c38d5>] scan_yield+0x17/0x3b
       [<c10c3970>] scan_block+0x39/0xd4
       [<c10c3bc6>] kmemleak_scan+0x1bb/0x39c
       [<c10c4331>] ? kmemleak_scan_thread+0x0/0x86
       [<c10c437b>] kmemleak_scan_thread+0x4a/0x86
       [<c104d73e>] kthread+0x6e/0x73
       [<c104d6d0>] ? kthread+0x0/0x73
       [<c100959f>] kernel_thread_helper+0x7/0x10
      kmemleak: 834 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
      
      The bit causing it is highly dubious:
      
      static void scan_yield(void)
      {
              might_sleep();
      
              if (time_is_before_eq_jiffies(next_scan_yield)) {
                      schedule();
                      next_scan_yield = jiffies + jiffies_scan_yield;
              }
      }
      
      It called deep inside the codepath and in a conditional way,
      and that is what crapped up when one of the new scan_block()
      uses grew a tasklist_lock dependency.
      
      This minimal patch removes that yielding stuff and adds the
      proper cond_resched().
      
      The background scanning thread could probably also be reniced
      to +10.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NPekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      57d81f6f
  4. 01 7月, 2009 20 次提交