From b643289a8084af94bc5a4be0c0c4c4de41872dbe Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 23 May 2007 16:55:15 -0700 Subject: [PATCH] add backlogged 2.6.21 patches --- ...ction-of-audio-codec-on-toshiba-a100.patch | 57 +++++++++++++ ...e-additional-slots-only-if-necessary.patch | 65 +++++++++++++++ queue-2.6.21/char-cyclades-fix-deadlock.patch | 30 +++++++ .../fuse-fix-mknod-of-regular-file.patch | 35 ++++++++ ...66-don-t-check-enablebits-for-hpt36x.patch | 42 ++++++++++ ...x-k8-core2-oprofile-on-multiple-cpus.patch | 51 ++++++++++++ ...ore-bogus-acpi-info-for-offline-cpus.patch | 51 ++++++++++++ ...e-freezeable-workqueues-singlethread.patch | 37 +++++++++ ...d0-calculation-with-large-components.patch | 45 ++++++++++ ...equired-of-the-last-page-of-a-bitmap.patch | 82 +++++++++++++++++++ ...local-softirq-pending-warning-output.patch | 43 ++++++++++ ...vent-going-idle-with-softirq-pending.patch | 57 +++++++++++++ queue-2.6.21/series | 12 +++ 13 files changed, 607 insertions(+) create mode 100644 queue-2.6.21/alsa-hda-intel-fix-detection-of-audio-codec-on-toshiba-a100.patch create mode 100644 queue-2.6.21/alsa-hda-intel-probe-additional-slots-only-if-necessary.patch create mode 100644 queue-2.6.21/char-cyclades-fix-deadlock.patch create mode 100644 queue-2.6.21/fuse-fix-mknod-of-regular-file.patch create mode 100644 queue-2.6.21/hpt366-don-t-check-enablebits-for-hpt36x.patch create mode 100644 queue-2.6.21/i386-fix-k8-core2-oprofile-on-multiple-cpus.patch create mode 100644 queue-2.6.21/ignore-bogus-acpi-info-for-offline-cpus.patch create mode 100644 queue-2.6.21/make-freezeable-workqueues-singlethread.patch create mode 100644 queue-2.6.21/md-avoid-overflow-in-raid0-calculation-with-large-components.patch create mode 100644 queue-2.6.21/md-don-t-write-more-than-is-required-of-the-last-page-of-a-bitmap.patch create mode 100644 queue-2.6.21/nohz-rate-limit-the-local-softirq-pending-warning-output.patch create mode 100644 queue-2.6.21/prevent-going-idle-with-softirq-pending.patch diff --git a/queue-2.6.21/alsa-hda-intel-fix-detection-of-audio-codec-on-toshiba-a100.patch b/queue-2.6.21/alsa-hda-intel-fix-detection-of-audio-codec-on-toshiba-a100.patch new file mode 100644 index 00000000000..a03c3fbcb4e --- /dev/null +++ b/queue-2.6.21/alsa-hda-intel-fix-detection-of-audio-codec-on-toshiba-a100.patch @@ -0,0 +1,57 @@ +From stable-bounces@linux.kernel.org Wed May 23 13:46:07 2007 +Message-ID: <4654A7B4.4080309@redhat.com> +Date: Wed, 23 May 2007 16:44:36 -0400 +From: Chuck Ebbert +To: stable@kernel.org, Dave Jones +Cc: Takashi Iwai +Subject: ALSA: hda-intel - Fix detection of audio codec on Toshiba A100 + +From: Takashi Iwai + +Some boards have the audio codec on slot #3 while the modem codec +on slot #0. The driver should continue to probe the slots when +no audio codec is found. +This fixes the problem of no device on Toshiba A100 (and some other +ATI SB450 devices). + +Signed-off-by: Takashi Iwai +Signed-off-by: Jaroslav Kysela +Signed-off-by: Chris Wright +--- + sound/pci/hda/hda_intel.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- linux-2.6.21.2.orig/sound/pci/hda/hda_intel.c ++++ linux-2.6.21.2/sound/pci/hda/hda_intel.c +@@ -979,7 +979,7 @@ static unsigned int azx_max_codecs[] __d + static int __devinit azx_codec_create(struct azx *chip, const char *model) + { + struct hda_bus_template bus_temp; +- int c, codecs, err; ++ int c, codecs, audio_codecs, err; + + memset(&bus_temp, 0, sizeof(bus_temp)); + bus_temp.private_data = chip; +@@ -991,16 +991,19 @@ static int __devinit azx_codec_create(st + if ((err = snd_hda_bus_new(chip->card, &bus_temp, &chip->bus)) < 0) + return err; + +- codecs = 0; ++ codecs = audio_codecs = 0; + for (c = 0; c < AZX_MAX_CODECS; c++) { + if ((chip->codec_mask & (1 << c)) & probe_mask) { +- err = snd_hda_codec_new(chip->bus, c, NULL); ++ struct hda_codec *codec; ++ err = snd_hda_codec_new(chip->bus, c, &codec); + if (err < 0) + continue; + codecs++; ++ if (codec->afg) ++ audio_codecs++; + } + } +- if (!codecs) { ++ if (!audio_codecs) { + /* probe additional slots if no codec is found */ + for (; c < azx_max_codecs[chip->driver_type]; c++) { + if ((chip->codec_mask & (1 << c)) & probe_mask) { diff --git a/queue-2.6.21/alsa-hda-intel-probe-additional-slots-only-if-necessary.patch b/queue-2.6.21/alsa-hda-intel-probe-additional-slots-only-if-necessary.patch new file mode 100644 index 00000000000..6a2b935d6a8 --- /dev/null +++ b/queue-2.6.21/alsa-hda-intel-probe-additional-slots-only-if-necessary.patch @@ -0,0 +1,65 @@ +From stable-bounces@linux.kernel.org Wed May 23 13:44:40 2007 +Message-ID: <4654A765.6060902@redhat.com> +Date: Wed, 23 May 2007 16:43:17 -0400 +From: Chuck Ebbert +To: stable@kernel.org +Cc: Takashi Iwai , Dave Jones +Subject: ALSA: hda-intel - Probe additional slots only if necessary + +From: Takashi Iwai + +Probing the codec slots on ATI controller causes problems on some +devices like Acer laptops. On these devices, reading from codec +slot 3 results in the communication failure with the codec chip. +Meanwhile, some laptops (e.g. Gateway) have the codec connection +only on slot 3, and probing this slot is mandatory for them. +The patch improves the probing robustness. The additional slots +are now checked only when no codecs are found in the primary three +slots. + +Signed-off-by: Takashi Iwai +Signed-off-by: Jaroslav Kysela +Signed-off-by: Chris Wright +--- + sound/pci/hda/hda_intel.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +--- linux-2.6.21.2.orig/sound/pci/hda/hda_intel.c ++++ linux-2.6.21.2/sound/pci/hda/hda_intel.c +@@ -198,6 +198,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO + #define RIRB_INT_MASK 0x05 + + /* STATESTS int mask: SD2,SD1,SD0 */ ++#define AZX_MAX_CODECS 3 + #define STATESTS_INT_MASK 0x07 + + /* SD_CTL bits */ +@@ -991,7 +992,7 @@ static int __devinit azx_codec_create(st + return err; + + codecs = 0; +- for (c = 0; c < azx_max_codecs[chip->driver_type]; c++) { ++ for (c = 0; c < AZX_MAX_CODECS; c++) { + if ((chip->codec_mask & (1 << c)) & probe_mask) { + err = snd_hda_codec_new(chip->bus, c, NULL); + if (err < 0) +@@ -999,7 +1000,18 @@ static int __devinit azx_codec_create(st + codecs++; + } + } +- if (! codecs) { ++ if (!codecs) { ++ /* probe additional slots if no codec is found */ ++ for (; c < azx_max_codecs[chip->driver_type]; c++) { ++ if ((chip->codec_mask & (1 << c)) & probe_mask) { ++ err = snd_hda_codec_new(chip->bus, c, NULL); ++ if (err < 0) ++ continue; ++ codecs++; ++ } ++ } ++ } ++ if (!codecs) { + snd_printk(KERN_ERR SFX "no codecs initialized\n"); + return -ENXIO; + } diff --git a/queue-2.6.21/char-cyclades-fix-deadlock.patch b/queue-2.6.21/char-cyclades-fix-deadlock.patch new file mode 100644 index 00000000000..3255483f161 --- /dev/null +++ b/queue-2.6.21/char-cyclades-fix-deadlock.patch @@ -0,0 +1,30 @@ +From stable-bounces@linux.kernel.org Wed May 23 14:00:00 2007 +Message-Id: <200705232057.l4NKvvko031767@shell0.pdx.osdl.net> +To: torvalds@linux-foundation.org +From: akpm@linux-foundation.org +Date: Wed, 23 May 2007 13:57:56 -0700 +Cc: akpm@linux-foundation.org, jirislaby@gmail.com, stable@kernel.org +Subject: Char: cyclades, fix deadlock + +From: Jiri Slaby + +An omitted unlock. + +Signed-off-by: Jiri Slaby +Signed-off-by: Andrew Morton +Signed-off-by: Chris Wright +--- + + drivers/char/cyclades.c | 1 + + 1 file changed, 1 insertion(+) + +--- linux-2.6.21.2.orig/drivers/char/cyclades.c ++++ linux-2.6.21.2/drivers/char/cyclades.c +@@ -1103,6 +1103,7 @@ static void cyy_intr_chip(struct cyclade + + if (data & info->ignore_status_mask) { + info->icount.rx++; ++ spin_unlock(&cinfo->card_lock); + return; + } + if (tty_buffer_request_room(tty, 1)) { diff --git a/queue-2.6.21/fuse-fix-mknod-of-regular-file.patch b/queue-2.6.21/fuse-fix-mknod-of-regular-file.patch new file mode 100644 index 00000000000..cdd3ab2b78b --- /dev/null +++ b/queue-2.6.21/fuse-fix-mknod-of-regular-file.patch @@ -0,0 +1,35 @@ +From stable-bounces@linux.kernel.org Mon May 21 02:42:28 2007 +To: akpm@linux-foundation.org, stable@kernel.org +Message-Id: +From: Miklos Szeredi +Date: Mon, 21 May 2007 11:39:58 +0200 +Cc: linux-kernel@vger.kernel.org +Subject: fuse: fix mknod of regular file + +From: Miklos Szeredi + +The wrong lookup flag was tested in ->create() causing havoc (error or +Oops) when a regular file was created with mknod() in a fuse +filesystem. + +Thanks to J. Cameijo Cerdeira for the report. + +Kernels 2.6.18 onward are affected. Please apply to -stable as well. + +Signed-off-by: Miklos Szeredi +Signed-off-by: Chris Wright +--- + fs/fuse/dir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- linux-2.6.21.2.orig/fs/fuse/dir.c ++++ linux-2.6.21.2/fs/fuse/dir.c +@@ -485,7 +485,7 @@ static int fuse_mknod(struct inode *dir, + static int fuse_create(struct inode *dir, struct dentry *entry, int mode, + struct nameidata *nd) + { +- if (nd && (nd->flags & LOOKUP_CREATE)) { ++ if (nd && (nd->flags & LOOKUP_OPEN)) { + int err = fuse_create_open(dir, entry, mode, nd); + if (err != -ENOSYS) + return err; diff --git a/queue-2.6.21/hpt366-don-t-check-enablebits-for-hpt36x.patch b/queue-2.6.21/hpt366-don-t-check-enablebits-for-hpt36x.patch new file mode 100644 index 00000000000..0833e0a37e2 --- /dev/null +++ b/queue-2.6.21/hpt366-don-t-check-enablebits-for-hpt36x.patch @@ -0,0 +1,42 @@ +From sshtylyov@ru.mvista.com Wed May 23 14:08:13 2007 +Date: Thu, 24 May 2007 01:09:40 +0400 +Message-Id: <200705240109.40516.sshtylyov@ru.mvista.com> +From: Sergei Shtylyov +To: stable@kernel.org +Cc: bzolnier@gmail.com, chrisw@sous-sol.org +Subject: hpt366: don't check enablebits for HPT36x + +HPT36x chip don't seem to have the channel enable bits, so prevent the IDE core +from checking them... + +Signed-off-by: Sergei Shtylyov +Cc: +Signed-off-by: Chris Wright +--- +This has been an issue since 2.6.21-rc1... + + drivers/ide/pci/hpt366.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- linux-2.6.21.2.orig/drivers/ide/pci/hpt366.c ++++ linux-2.6.21.2/drivers/ide/pci/hpt366.c +@@ -1,5 +1,5 @@ + /* +- * linux/drivers/ide/pci/hpt366.c Version 1.02 Apr 18, 2007 ++ * linux/drivers/ide/pci/hpt366.c Version 1.03 May 4, 2007 + * + * Copyright (C) 1999-2003 Andre Hedrick + * Portions Copyright (C) 2001 Sun Microsystems, Inc. +@@ -1527,7 +1527,12 @@ static int __devinit init_setup_hpt366(s + if (rev > 2) + goto init_single; + ++ /* ++ * HPT36x chips are single channel and ++ * do not seem to have the channel enable bit... ++ */ + d->channels = 1; ++ d->enablebits[0].reg = 0; + + if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) { + u8 pin1 = 0, pin2 = 0; diff --git a/queue-2.6.21/i386-fix-k8-core2-oprofile-on-multiple-cpus.patch b/queue-2.6.21/i386-fix-k8-core2-oprofile-on-multiple-cpus.patch new file mode 100644 index 00000000000..1e5b3854c24 --- /dev/null +++ b/queue-2.6.21/i386-fix-k8-core2-oprofile-on-multiple-cpus.patch @@ -0,0 +1,51 @@ +From 6c977aad03a18019015035958c65b6729cd0574c Mon Sep 17 00:00:00 2001 +From: Andi Kleen +Date: Mon, 21 May 2007 14:31:45 +0200 +Cc: Chuck Ebbert , Dave Jones +Subject: i386: Fix K8/core2 oprofile on multiple CPUs + +Only try to allocate MSRs once instead of for every CPU. + +This assumes the MSRs are the same on all CPUs which is currently +true. P4-HT is a special case for different SMT threads, but the code +always saves/restores all MSRs so it works identical. + +Signed-off-by: Andi Kleen +Signed-off-by: Linus Torvalds +Signed-off-by: Chris Wright +--- + arch/i386/oprofile/nmi_int.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- linux-2.6.21.2.orig/arch/i386/oprofile/nmi_int.c ++++ linux-2.6.21.2/arch/i386/oprofile/nmi_int.c +@@ -131,7 +131,6 @@ static void nmi_save_registers(void * du + { + int cpu = smp_processor_id(); + struct op_msrs * msrs = &cpu_msrs[cpu]; +- model->fill_in_addresses(msrs); + nmi_cpu_save_registers(msrs); + } + +@@ -195,6 +194,7 @@ static struct notifier_block profile_exc + static int nmi_setup(void) + { + int err=0; ++ int cpu; + + if (!allocate_msrs()) + return -ENOMEM; +@@ -207,6 +207,13 @@ static int nmi_setup(void) + /* We need to serialize save and setup for HT because the subset + * of msrs are distinct for save and setup operations + */ ++ ++ /* Assume saved/restored counters are the same on all CPUs */ ++ model->fill_in_addresses(&cpu_msrs[0]); ++ for_each_possible_cpu (cpu) { ++ if (cpu != 0) ++ cpu_msrs[cpu] = cpu_msrs[0]; ++ } + on_each_cpu(nmi_save_registers, NULL, 0, 1); + on_each_cpu(nmi_cpu_setup, NULL, 0, 1); + nmi_enabled = 1; diff --git a/queue-2.6.21/ignore-bogus-acpi-info-for-offline-cpus.patch b/queue-2.6.21/ignore-bogus-acpi-info-for-offline-cpus.patch new file mode 100644 index 00000000000..a50d79e14d4 --- /dev/null +++ b/queue-2.6.21/ignore-bogus-acpi-info-for-offline-cpus.patch @@ -0,0 +1,51 @@ +From stable-bounces@linux.kernel.org Sat May 19 07:19:01 2007 +From: Thomas Gleixner +To: linux-kernel@vger.kernel.org +Date: Sat, 19 May 2007 16:22:50 +0200 +Message-Id: <1179584570.12981.123.camel@chaos> +Cc: Andrew Morton , Ingo Molnar , Darren Hart , stable@kernel.org, Len Brown +Subject: Ignore bogus ACPI info for offline CPUs + +Booting a SMP kernel with maxcpus=1 on a SMP system leads to a hard +hang, because ACPI ignores the maxcpus setting and sends timer broadcast +info for the offline CPUs. This results in a stuck for ever call to +smp_call_function_single() on an offline CPU. + +Ignore the bogus information and print a kernel error to remind ACPI +folks to fix it. + +Affects 2.6.21 / 2.6.22-rc + +Signed-off-by: Thomas Gleixner +Signed-off-by: Chris Wright + +--- + kernel/time/tick-broadcast.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +--- linux-2.6.21.2.orig/kernel/time/tick-broadcast.c ++++ linux-2.6.21.2/kernel/time/tick-broadcast.c +@@ -243,11 +243,18 @@ void tick_broadcast_on_off(unsigned long + { + int cpu = get_cpu(); + +- if (cpu == *oncpu) +- tick_do_broadcast_on_off(&reason); +- else +- smp_call_function_single(*oncpu, tick_do_broadcast_on_off, +- &reason, 1, 1); ++ if (!cpu_isset(*oncpu, cpu_online_map)) { ++ printk(KERN_ERR "tick-braodcast: ignoring broadcast for " ++ "offline CPU #%d\n", *oncpu); ++ } else { ++ ++ if (cpu == *oncpu) ++ tick_do_broadcast_on_off(&reason); ++ else ++ smp_call_function_single(*oncpu, ++ tick_do_broadcast_on_off, ++ &reason, 1, 1); ++ } + put_cpu(); + } + diff --git a/queue-2.6.21/make-freezeable-workqueues-singlethread.patch b/queue-2.6.21/make-freezeable-workqueues-singlethread.patch new file mode 100644 index 00000000000..882ef187e2b --- /dev/null +++ b/queue-2.6.21/make-freezeable-workqueues-singlethread.patch @@ -0,0 +1,37 @@ +From stable-bounces@linux.kernel.org Mon May 21 13:53:38 2007 +Message-ID: <46520651.3060003@redhat.com> +Date: Mon, 21 May 2007 16:51:29 -0400 +From: Chuck Ebbert +To: stable@kernel.org +Cc: "Rafael J. Wysocki" +Subject: make freezeable workqueues singlethread + +From: Oleg Nesterov + +It is a known fact that freezeable multithreaded workqueues doesn't like +CPU_DEAD. We keep them only for the incoming CPU-hotplug rework. + +Sadly, we can't just kill create_freezeable_workqueue() right now, make +them singlethread. + +Signed-off-by: Oleg Nesterov +Cc: "Rafael J. Wysocki" +Cc: Gautham R Shenoy +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Chris Wright +--- + include/linux/workqueue.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- linux-2.6.21.2.orig/include/linux/workqueue.h ++++ linux-2.6.21.2/include/linux/workqueue.h +@@ -162,7 +162,7 @@ extern struct workqueue_struct *__create + int singlethread, + int freezeable); + #define create_workqueue(name) __create_workqueue((name), 0, 0) +-#define create_freezeable_workqueue(name) __create_workqueue((name), 0, 1) ++#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) + #define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) + + extern void destroy_workqueue(struct workqueue_struct *wq); diff --git a/queue-2.6.21/md-avoid-overflow-in-raid0-calculation-with-large-components.patch b/queue-2.6.21/md-avoid-overflow-in-raid0-calculation-with-large-components.patch new file mode 100644 index 00000000000..3a7b5f451f8 --- /dev/null +++ b/queue-2.6.21/md-avoid-overflow-in-raid0-calculation-with-large-components.patch @@ -0,0 +1,45 @@ +From stable-bounces@linux.kernel.org Sun May 20 18:35:24 2007 +From: NeilBrown +To: akpm@linux-foundation.org +Date: Mon, 21 May 2007 11:33:03 +1000 +Message-Id: <1070521013303.6655@suse.de> +Cc: linux-raid@vger.kernel.org, Jeff Zheng , Neil Brown , linux-kernel@vger.kernel.org, stable@kernel.org +Subject: md: Avoid overflow in raid0 calculation with large components. + +If a raid0 has a component device larger than 4TB, and is accessed on +a 32bit machines, then as 'chunk' is unsigned lock, + chunk << chunksize_bits +can overflow (this can be as high as the size of the device in KB). +chunk itself will not overflow (without triggering a BUG). + +So change 'chunk' to be 'sector_t, and get rid of the 'BUG' as it becomes +impossible to hit. + +Cc: "Jeff Zheng" +Signed-off-by: Neil Brown +Signed-off-by: Chris Wright +--- + + drivers/md/raid0.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff .prev/drivers/md/raid0.c ./drivers/md/raid0.c +--- linux-2.6.21.2.orig/drivers/md/raid0.c ++++ linux-2.6.21.2/drivers/md/raid0.c +@@ -415,7 +415,7 @@ static int raid0_make_request (request_q + raid0_conf_t *conf = mddev_to_conf(mddev); + struct strip_zone *zone; + mdk_rdev_t *tmp_dev; +- unsigned long chunk; ++ sector_t chunk; + sector_t block, rsect; + const int rw = bio_data_dir(bio); + +@@ -470,7 +470,6 @@ static int raid0_make_request (request_q + + sector_div(x, zone->nb_dev); + chunk = x; +- BUG_ON(x != (sector_t)chunk); + + x = block >> chunksize_bits; + tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; diff --git a/queue-2.6.21/md-don-t-write-more-than-is-required-of-the-last-page-of-a-bitmap.patch b/queue-2.6.21/md-don-t-write-more-than-is-required-of-the-last-page-of-a-bitmap.patch new file mode 100644 index 00000000000..90e64c74263 --- /dev/null +++ b/queue-2.6.21/md-don-t-write-more-than-is-required-of-the-last-page-of-a-bitmap.patch @@ -0,0 +1,82 @@ +From stable-bounces@linux.kernel.org Sun May 20 18:35:20 2007 +From: NeilBrown +To: akpm@linux-foundation.org +Date: Mon, 21 May 2007 11:33:10 +1000 +Message-Id: <1070521013310.6687@suse.de> +Cc: linux-raid@vger.kernel.org, Neil Brown , linux-kernel@vger.kernel.org, stable@kernel.org +Subject: md: Don't write more than is required of the last page of a bitmap + + +It is possible that real data or metadata follows the bitmap +without full page alignment. +So limit the last write to be only the required number of bytes, +rounded up to the hard sector size of the device. + +Signed-off-by: Neil Brown +Signed-off-by: Chris Wright +--- + + drivers/md/bitmap.c | 17 ++++++++++++----- + include/linux/raid/bitmap.h | 1 + + 2 files changed, 13 insertions(+), 5 deletions(-) + +diff .prev/drivers/md/bitmap.c ./drivers/md/bitmap.c +--- linux-2.6.21.2.orig/drivers/md/bitmap.c ++++ linux-2.6.21.2/drivers/md/bitmap.c +@@ -255,19 +255,25 @@ static struct page *read_sb_page(mddev_t + + } + +-static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait) ++static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) + { + mdk_rdev_t *rdev; + struct list_head *tmp; ++ mddev_t *mddev = bitmap->mddev; + + ITERATE_RDEV(mddev, rdev, tmp) + if (test_bit(In_sync, &rdev->flags) +- && !test_bit(Faulty, &rdev->flags)) ++ && !test_bit(Faulty, &rdev->flags)) { ++ int size = PAGE_SIZE; ++ if (page->index == bitmap->file_pages-1) ++ size = roundup(bitmap->last_page_size, ++ bdev_hardsect_size(rdev->bdev)); + md_super_write(mddev, rdev, +- (rdev->sb_offset<<1) + offset ++ (rdev->sb_offset<<1) + bitmap->offset + + page->index * (PAGE_SIZE/512), +- PAGE_SIZE, ++ size, + page); ++ } + + if (wait) + md_super_wait(mddev); +@@ -282,7 +288,7 @@ static int write_page(struct bitmap *bit + struct buffer_head *bh; + + if (bitmap->file == NULL) +- return write_sb_page(bitmap->mddev, bitmap->offset, page, wait); ++ return write_sb_page(bitmap, page, wait); + + bh = page_buffers(page); + +@@ -923,6 +929,7 @@ static int bitmap_init_from_disk(struct + } + + bitmap->filemap[bitmap->file_pages++] = page; ++ bitmap->last_page_size = count; + } + paddr = kmap_atomic(page, KM_USER0); + if (bitmap->flags & BITMAP_HOSTENDIAN) +--- linux-2.6.21.2.orig/include/linux/raid/bitmap.h ++++ linux-2.6.21.2/include/linux/raid/bitmap.h +@@ -232,6 +232,7 @@ struct bitmap { + struct page **filemap; /* list of cache pages for the file */ + unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ + unsigned long file_pages; /* number of pages in the file */ ++ int last_page_size; /* bytes in the last page */ + + unsigned long flags; + diff --git a/queue-2.6.21/nohz-rate-limit-the-local-softirq-pending-warning-output.patch b/queue-2.6.21/nohz-rate-limit-the-local-softirq-pending-warning-output.patch new file mode 100644 index 00000000000..0c597ebed44 --- /dev/null +++ b/queue-2.6.21/nohz-rate-limit-the-local-softirq-pending-warning-output.patch @@ -0,0 +1,43 @@ +From stable-bounces@linux.kernel.org Wed May 23 14:07:58 2007 +Message-Id: <200705232057.l4NKvbN3031655@shell0.pdx.osdl.net> +To: torvalds@linux-foundation.org +From: akpm@linux-foundation.org +Date: Wed, 23 May 2007 13:57:37 -0700 +Cc: akpm@linux-foundation.org, tglx@linutronix.de, stable@kernel.org +Subject: NOHZ: Rate limit the local softirq pending warning output + +From: Thomas Gleixner + +The warning in the NOHZ code, which triggers when a CPU goes idle with +softirqs pending can fill up the logs quite quickly. Rate limit the output +until we found the root cause of that problem. + +Signed-off-by: Thomas Gleixner +Signed-off-by: Andrew Morton +Signed-off-by: Chris Wright +--- + + kernel/time/tick-sched.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- linux-2.6.21.2.orig/kernel/time/tick-sched.c ++++ linux-2.6.21.2/kernel/time/tick-sched.c +@@ -167,9 +167,15 @@ void tick_nohz_stop_sched_tick(void) + goto end; + + cpu = smp_processor_id(); +- if (unlikely(local_softirq_pending())) +- printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n", +- local_softirq_pending()); ++ if (unlikely(local_softirq_pending())) { ++ static int ratelimit; ++ ++ if (ratelimit < 10) { ++ printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n", ++ local_softirq_pending()); ++ ratelimit++; ++ } ++ } + + now = ktime_get(); + /* diff --git a/queue-2.6.21/prevent-going-idle-with-softirq-pending.patch b/queue-2.6.21/prevent-going-idle-with-softirq-pending.patch new file mode 100644 index 00000000000..ae0c1b03bfe --- /dev/null +++ b/queue-2.6.21/prevent-going-idle-with-softirq-pending.patch @@ -0,0 +1,57 @@ +From stable-bounces@linux.kernel.org Mon May 21 23:40:14 2007 +Date: Tue, 22 May 2007 08:38:50 +0200 +From: Ingo Molnar +To: akpm@linux-foundation.org +Message-ID: <20070522063850.GA23854@elte.hu> +Cc: linux-kernel@vger.kernel.org, davem@davemloft.net, kernel@prachanda.info, tglx@linutronix.de, torvalds@linux-foundation.org, stable@kernel.org +Subject: Prevent going idle with softirq pending + +From: Thomas Gleixner + +The NOHZ patch contains a check for softirqs pending when a CPU goes +idle. The BUG is unrelated to NOHZ, it just was made visible by the NOHZ +patch. The BUG showed up mainly on P4 / hyperthreading enabled machines +which lead the investigations into the wrong direction in the first +place. The real cause is in cond_resched_softirq(): + +cond_resched_softirq() is enabling softirqs without invoking the softirq +daemon when softirqs are pending. This leads to the warning message in +the NOHZ idle code: + +t1 runs softirq disabled code on CPU#0 +interrupt happens, softirq is raised, but deferred (softirqs disabled) +t1 calls cond_resched_softirq() + enables softirqs via _local_bh_enable() + calls schedule() +t2 runs +t1 is migrated to CPU#1 +t2 is done and invokes idle() +NOHZ detects the pending softirq + +Fix: change _local_bh_enable() to local_bh_enable() so the softirq +daemon is invoked. + +Thanks to Anant Nitya for debugging this with great patience ! + +Signed-off-by: Thomas Gleixner +Signed-off-by: Ingo Molnar +Signed-off-by: Andrew Morton +Cc: Anant Nitya +Signed-off-by: Chris Wright +--- + kernel/sched.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- linux-2.6.21.2.orig/kernel/sched.c ++++ linux-2.6.21.2/kernel/sched.c +@@ -4545,9 +4545,7 @@ int __sched cond_resched_softirq(void) + BUG_ON(!in_softirq()); + + if (need_resched() && system_state == SYSTEM_RUNNING) { +- raw_local_irq_disable(); +- _local_bh_enable(); +- raw_local_irq_enable(); ++ local_bh_enable(); + __cond_resched(); + local_bh_disable(); + return 1; diff --git a/queue-2.6.21/series b/queue-2.6.21/series index 11d92783c40..b964c54078a 100644 --- a/queue-2.6.21/series +++ b/queue-2.6.21/series @@ -1 +1,13 @@ i386-hpet-check-if-the-counter-works.patch +ignore-bogus-acpi-info-for-offline-cpus.patch +nohz-rate-limit-the-local-softirq-pending-warning-output.patch +i386-fix-k8-core2-oprofile-on-multiple-cpus.patch +md-avoid-overflow-in-raid0-calculation-with-large-components.patch +md-don-t-write-more-than-is-required-of-the-last-page-of-a-bitmap.patch +fuse-fix-mknod-of-regular-file.patch +make-freezeable-workqueues-singlethread.patch +prevent-going-idle-with-softirq-pending.patch +alsa-hda-intel-probe-additional-slots-only-if-necessary.patch +alsa-hda-intel-fix-detection-of-audio-codec-on-toshiba-a100.patch +char-cyclades-fix-deadlock.patch +hpt366-don-t-check-enablebits-for-hpt36x.patch -- 2.47.3