diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | drivers/cpuidle/cpuidle.c | 4 | ||||
-rw-r--r-- | drivers/mmc/core/bus.c | 3 | ||||
-rw-r--r-- | drivers/mmc/core/core.c | 6 | ||||
-rw-r--r-- | drivers/mmc/core/host.c | 5 | ||||
-rw-r--r-- | drivers/mmc/core/sdio_bus.c | 3 | ||||
-rw-r--r-- | drivers/mmc/host/mmc_spi.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/tifm_sd.c | 16 | ||||
-rw-r--r-- | drivers/regulator/Kconfig | 15 | ||||
-rw-r--r-- | drivers/staging/Kconfig | 2 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 5 | ||||
-rw-r--r-- | include/linux/cnt32_to_63.h | 22 | ||||
-rw-r--r-- | include/linux/cpumask.h | 559 | ||||
-rw-r--r-- | include/linux/mmc/card.h | 2 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 2 | ||||
-rw-r--r-- | include/linux/mmc/sdio_func.h | 2 | ||||
-rw-r--r-- | include/linux/smp.h | 9 | ||||
-rw-r--r-- | include/linux/workqueue.h | 8 | ||||
-rw-r--r-- | include/net/af_unix.h | 1 | ||||
-rw-r--r-- | kernel/cpu.c | 3 | ||||
-rw-r--r-- | kernel/workqueue.c | 45 | ||||
-rw-r--r-- | lib/cpumask.c | 79 | ||||
-rw-r--r-- | net/unix/af_unix.c | 31 | ||||
-rw-r--r-- | net/unix/garbage.c | 49 | ||||
-rw-r--r-- | scripts/package/builddeb | 24 |
26 files changed, 833 insertions, 68 deletions
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 28 | 3 | SUBLEVEL = 28 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Killer Bat of Doom | 5 | NAME = Killer Bat of Doom |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 5bed73329ef8..8504a2108557 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -65,12 +65,14 @@ static void cpuidle_idle_call(void) | |||
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | 67 | ||
68 | #if 0 | ||
69 | /* shows regressions, re-enable for 2.6.29 */ | ||
68 | /* | 70 | /* |
69 | * run any timers that can be run now, at this point | 71 | * run any timers that can be run now, at this point |
70 | * before calculating the idle duration etc. | 72 | * before calculating the idle duration etc. |
71 | */ | 73 | */ |
72 | hrtimer_peek_ahead_timers(); | 74 | hrtimer_peek_ahead_timers(); |
73 | 75 | #endif | |
74 | /* ask the governor for the next state */ | 76 | /* ask the governor for the next state */ |
75 | next_state = cpuidle_curr_governor->select(dev); | 77 | next_state = cpuidle_curr_governor->select(dev); |
76 | if (need_resched()) | 78 | if (need_resched()) |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 0d9b2d6f9ebf..f210a8ee6861 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -216,8 +216,7 @@ int mmc_add_card(struct mmc_card *card) | |||
216 | int ret; | 216 | int ret; |
217 | const char *type; | 217 | const char *type; |
218 | 218 | ||
219 | snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), | 219 | dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca); |
220 | "%s:%04x", mmc_hostname(card->host), card->rca); | ||
221 | 220 | ||
222 | switch (card->type) { | 221 | switch (card->type) { |
223 | case MMC_TYPE_MMC: | 222 | case MMC_TYPE_MMC: |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 044d84eeed7c..f7284b905eb3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -280,7 +280,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) | |||
280 | (card->host->ios.clock / 1000); | 280 | (card->host->ios.clock / 1000); |
281 | 281 | ||
282 | if (data->flags & MMC_DATA_WRITE) | 282 | if (data->flags & MMC_DATA_WRITE) |
283 | limit_us = 250000; | 283 | /* |
284 | * The limit is really 250 ms, but that is | ||
285 | * insufficient for some crappy cards. | ||
286 | */ | ||
287 | limit_us = 300000; | ||
284 | else | 288 | else |
285 | limit_us = 100000; | 289 | limit_us = 100000; |
286 | 290 | ||
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 6da80fd4d974..5e945e64ead7 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -73,8 +73,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) | |||
73 | if (err) | 73 | if (err) |
74 | goto free; | 74 | goto free; |
75 | 75 | ||
76 | snprintf(host->class_dev.bus_id, BUS_ID_SIZE, | 76 | dev_set_name(&host->class_dev, "mmc%d", host->index); |
77 | "mmc%d", host->index); | ||
78 | 77 | ||
79 | host->parent = dev; | 78 | host->parent = dev; |
80 | host->class_dev.parent = dev; | 79 | host->class_dev.parent = dev; |
@@ -121,7 +120,7 @@ int mmc_add_host(struct mmc_host *host) | |||
121 | WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && | 120 | WARN_ON((host->caps & MMC_CAP_SDIO_IRQ) && |
122 | !host->ops->enable_sdio_irq); | 121 | !host->ops->enable_sdio_irq); |
123 | 122 | ||
124 | led_trigger_register_simple(host->class_dev.bus_id, &host->led); | 123 | led_trigger_register_simple(dev_name(&host->class_dev), &host->led); |
125 | 124 | ||
126 | err = device_add(&host->class_dev); | 125 | err = device_add(&host->class_dev); |
127 | if (err) | 126 | if (err) |
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 233d0f9b3c4b..46284b527397 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
@@ -239,8 +239,7 @@ int sdio_add_func(struct sdio_func *func) | |||
239 | { | 239 | { |
240 | int ret; | 240 | int ret; |
241 | 241 | ||
242 | snprintf(func->dev.bus_id, sizeof(func->dev.bus_id), | 242 | dev_set_name(&func->dev, "%s:%d", mmc_card_id(func->card), func->num); |
243 | "%s:%d", mmc_card_id(func->card), func->num); | ||
244 | 243 | ||
245 | ret = device_add(&func->dev); | 244 | ret = device_add(&func->dev); |
246 | if (ret == 0) | 245 | if (ret == 0) |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 07faf5412a1f..ad00e1632317 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -1348,7 +1348,7 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
1348 | goto fail_add_host; | 1348 | goto fail_add_host; |
1349 | 1349 | ||
1350 | dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", | 1350 | dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", |
1351 | mmc->class_dev.bus_id, | 1351 | dev_name(&mmc->class_dev), |
1352 | host->dma_dev ? "" : ", no DMA", | 1352 | host->dma_dev ? "" : ", no DMA", |
1353 | (host->pdata && host->pdata->get_ro) | 1353 | (host->pdata && host->pdata->get_ro) |
1354 | ? "" : ", no WP", | 1354 | ? "" : ", no WP", |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 30f64b1f2354..4d010a984bed 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1733,7 +1733,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
1733 | mmc_add_host(mmc); | 1733 | mmc_add_host(mmc); |
1734 | 1734 | ||
1735 | printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n", | 1735 | printk(KERN_INFO "%s: SDHCI controller on %s [%s] using %s%s\n", |
1736 | mmc_hostname(mmc), host->hw_name, mmc_dev(mmc)->bus_id, | 1736 | mmc_hostname(mmc), host->hw_name, dev_name(mmc_dev(mmc)), |
1737 | (host->flags & SDHCI_USE_ADMA)?"A":"", | 1737 | (host->flags & SDHCI_USE_ADMA)?"A":"", |
1738 | (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); | 1738 | (host->flags & SDHCI_USE_DMA)?"DMA":"PIO"); |
1739 | 1739 | ||
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 13844843e8de..82554ddec6b3 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -632,7 +632,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
632 | 632 | ||
633 | if (host->req) { | 633 | if (host->req) { |
634 | printk(KERN_ERR "%s : unfinished request detected\n", | 634 | printk(KERN_ERR "%s : unfinished request detected\n", |
635 | sock->dev.bus_id); | 635 | dev_name(&sock->dev)); |
636 | mrq->cmd->error = -ETIMEDOUT; | 636 | mrq->cmd->error = -ETIMEDOUT; |
637 | goto err_out; | 637 | goto err_out; |
638 | } | 638 | } |
@@ -672,7 +672,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
672 | ? PCI_DMA_TODEVICE | 672 | ? PCI_DMA_TODEVICE |
673 | : PCI_DMA_FROMDEVICE)) { | 673 | : PCI_DMA_FROMDEVICE)) { |
674 | printk(KERN_ERR "%s : scatterlist map failed\n", | 674 | printk(KERN_ERR "%s : scatterlist map failed\n", |
675 | sock->dev.bus_id); | 675 | dev_name(&sock->dev)); |
676 | mrq->cmd->error = -ENOMEM; | 676 | mrq->cmd->error = -ENOMEM; |
677 | goto err_out; | 677 | goto err_out; |
678 | } | 678 | } |
@@ -684,7 +684,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
684 | : PCI_DMA_FROMDEVICE); | 684 | : PCI_DMA_FROMDEVICE); |
685 | if (host->sg_len < 1) { | 685 | if (host->sg_len < 1) { |
686 | printk(KERN_ERR "%s : scatterlist map failed\n", | 686 | printk(KERN_ERR "%s : scatterlist map failed\n", |
687 | sock->dev.bus_id); | 687 | dev_name(&sock->dev)); |
688 | tifm_unmap_sg(sock, &host->bounce_buf, 1, | 688 | tifm_unmap_sg(sock, &host->bounce_buf, 1, |
689 | r_data->flags & MMC_DATA_WRITE | 689 | r_data->flags & MMC_DATA_WRITE |
690 | ? PCI_DMA_TODEVICE | 690 | ? PCI_DMA_TODEVICE |
@@ -748,7 +748,7 @@ static void tifm_sd_end_cmd(unsigned long data) | |||
748 | 748 | ||
749 | if (!mrq) { | 749 | if (!mrq) { |
750 | printk(KERN_ERR " %s : no request to complete?\n", | 750 | printk(KERN_ERR " %s : no request to complete?\n", |
751 | sock->dev.bus_id); | 751 | dev_name(&sock->dev)); |
752 | spin_unlock_irqrestore(&sock->lock, flags); | 752 | spin_unlock_irqrestore(&sock->lock, flags); |
753 | return; | 753 | return; |
754 | } | 754 | } |
@@ -789,7 +789,7 @@ static void tifm_sd_abort(unsigned long data) | |||
789 | printk(KERN_ERR | 789 | printk(KERN_ERR |
790 | "%s : card failed to respond for a long period of time " | 790 | "%s : card failed to respond for a long period of time " |
791 | "(%x, %x)\n", | 791 | "(%x, %x)\n", |
792 | host->dev->dev.bus_id, host->req->cmd->opcode, host->cmd_flags); | 792 | dev_name(&host->dev->dev), host->req->cmd->opcode, host->cmd_flags); |
793 | 793 | ||
794 | tifm_eject(host->dev); | 794 | tifm_eject(host->dev); |
795 | } | 795 | } |
@@ -906,7 +906,7 @@ static int tifm_sd_initialize_host(struct tifm_sd *host) | |||
906 | 906 | ||
907 | if (rc) { | 907 | if (rc) { |
908 | printk(KERN_ERR "%s : controller failed to reset\n", | 908 | printk(KERN_ERR "%s : controller failed to reset\n", |
909 | sock->dev.bus_id); | 909 | dev_name(&sock->dev)); |
910 | return -ENODEV; | 910 | return -ENODEV; |
911 | } | 911 | } |
912 | 912 | ||
@@ -933,7 +933,7 @@ static int tifm_sd_initialize_host(struct tifm_sd *host) | |||
933 | if (rc) { | 933 | if (rc) { |
934 | printk(KERN_ERR | 934 | printk(KERN_ERR |
935 | "%s : card not ready - probe failed on initialization\n", | 935 | "%s : card not ready - probe failed on initialization\n", |
936 | sock->dev.bus_id); | 936 | dev_name(&sock->dev)); |
937 | return -ENODEV; | 937 | return -ENODEV; |
938 | } | 938 | } |
939 | 939 | ||
@@ -954,7 +954,7 @@ static int tifm_sd_probe(struct tifm_dev *sock) | |||
954 | if (!(TIFM_SOCK_STATE_OCCUPIED | 954 | if (!(TIFM_SOCK_STATE_OCCUPIED |
955 | & readl(sock->addr + SOCK_PRESENT_STATE))) { | 955 | & readl(sock->addr + SOCK_PRESENT_STATE))) { |
956 | printk(KERN_WARNING "%s : card gone, unexpectedly\n", | 956 | printk(KERN_WARNING "%s : card gone, unexpectedly\n", |
957 | sock->dev.bus_id); | 957 | dev_name(&sock->dev)); |
958 | return rc; | 958 | return rc; |
959 | } | 959 | } |
960 | 960 | ||
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 4dada6ee1119..39360e2a4540 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -1,6 +1,4 @@ | |||
1 | menu "Voltage and Current regulators" | 1 | menuconfig REGULATOR |
2 | |||
3 | config REGULATOR | ||
4 | bool "Voltage and Current Regulator Support" | 2 | bool "Voltage and Current Regulator Support" |
5 | default n | 3 | default n |
6 | help | 4 | help |
@@ -23,21 +21,20 @@ config REGULATOR | |||
23 | 21 | ||
24 | If unsure, say no. | 22 | If unsure, say no. |
25 | 23 | ||
24 | if REGULATOR | ||
25 | |||
26 | config REGULATOR_DEBUG | 26 | config REGULATOR_DEBUG |
27 | bool "Regulator debug support" | 27 | bool "Regulator debug support" |
28 | depends on REGULATOR | ||
29 | help | 28 | help |
30 | Say yes here to enable debugging support. | 29 | Say yes here to enable debugging support. |
31 | 30 | ||
32 | config REGULATOR_FIXED_VOLTAGE | 31 | config REGULATOR_FIXED_VOLTAGE |
33 | tristate | 32 | tristate |
34 | default n | 33 | default n |
35 | select REGULATOR | ||
36 | 34 | ||
37 | config REGULATOR_VIRTUAL_CONSUMER | 35 | config REGULATOR_VIRTUAL_CONSUMER |
38 | tristate "Virtual regulator consumer support" | 36 | tristate "Virtual regulator consumer support" |
39 | default n | 37 | default n |
40 | select REGULATOR | ||
41 | help | 38 | help |
42 | This driver provides a virtual consumer for the voltage and | 39 | This driver provides a virtual consumer for the voltage and |
43 | current regulator API which provides sysfs controls for | 40 | current regulator API which provides sysfs controls for |
@@ -49,7 +46,6 @@ config REGULATOR_VIRTUAL_CONSUMER | |||
49 | config REGULATOR_BQ24022 | 46 | config REGULATOR_BQ24022 |
50 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" | 47 | tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" |
51 | default n | 48 | default n |
52 | select REGULATOR | ||
53 | help | 49 | help |
54 | This driver controls a TI bq24022 Charger attached via | 50 | This driver controls a TI bq24022 Charger attached via |
55 | GPIOs. The provided current regulator can enable/disable | 51 | GPIOs. The provided current regulator can enable/disable |
@@ -59,7 +55,6 @@ config REGULATOR_BQ24022 | |||
59 | config REGULATOR_WM8350 | 55 | config REGULATOR_WM8350 |
60 | tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" | 56 | tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" |
61 | depends on MFD_WM8350 | 57 | depends on MFD_WM8350 |
62 | select REGULATOR | ||
63 | help | 58 | help |
64 | This driver provides support for the voltage and current regulators | 59 | This driver provides support for the voltage and current regulators |
65 | of the WM8350 AudioPlus PMIC. | 60 | of the WM8350 AudioPlus PMIC. |
@@ -67,7 +62,6 @@ config REGULATOR_WM8350 | |||
67 | config REGULATOR_WM8400 | 62 | config REGULATOR_WM8400 |
68 | tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC" | 63 | tristate "Wolfson Microelectroncis WM8400 AudioPlus PMIC" |
69 | depends on MFD_WM8400 | 64 | depends on MFD_WM8400 |
70 | select REGULATOR | ||
71 | help | 65 | help |
72 | This driver provides support for the voltage regulators of the | 66 | This driver provides support for the voltage regulators of the |
73 | WM8400 AudioPlus PMIC. | 67 | WM8400 AudioPlus PMIC. |
@@ -75,9 +69,8 @@ config REGULATOR_WM8400 | |||
75 | config REGULATOR_DA903X | 69 | config REGULATOR_DA903X |
76 | tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC" | 70 | tristate "Support regulators on Dialog Semiconductor DA9030/DA9034 PMIC" |
77 | depends on PMIC_DA903X | 71 | depends on PMIC_DA903X |
78 | select REGULATOR | ||
79 | help | 72 | help |
80 | Say y here to support the BUCKs and LDOs regulators found on | 73 | Say y here to support the BUCKs and LDOs regulators found on |
81 | Dialog Semiconductor DA9030/DA9034 PMIC. | 74 | Dialog Semiconductor DA9030/DA9034 PMIC. |
82 | 75 | ||
83 | endmenu | 76 | endif |
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 0a49cd788a75..c95b286a1239 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -23,7 +23,7 @@ menuconfig STAGING | |||
23 | 23 | ||
24 | 24 | ||
25 | config STAGING_EXCLUDE_BUILD | 25 | config STAGING_EXCLUDE_BUILD |
26 | bool "Exclude Staging drivers from being built" | 26 | bool "Exclude Staging drivers from being built" if STAGING |
27 | default y | 27 | default y |
28 | ---help--- | 28 | ---help--- |
29 | Are you sure you really want to build the staging drivers? | 29 | Are you sure you really want to build the staging drivers? |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 848a03e83a42..4433c8f00163 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1875,11 +1875,11 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1875 | return -ENOMEM; | 1875 | return -ENOMEM; |
1876 | 1876 | ||
1877 | offset = *offsetp; | 1877 | offset = *offsetp; |
1878 | cdp->err = nfserr_eof; /* will be cleared on successful read */ | ||
1879 | 1878 | ||
1880 | while (1) { | 1879 | while (1) { |
1881 | unsigned int reclen; | 1880 | unsigned int reclen; |
1882 | 1881 | ||
1882 | cdp->err = nfserr_eof; /* will be cleared on successful read */ | ||
1883 | buf.used = 0; | 1883 | buf.used = 0; |
1884 | buf.full = 0; | 1884 | buf.full = 0; |
1885 | 1885 | ||
@@ -1912,9 +1912,6 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1912 | de = (struct buffered_dirent *)((char *)de + reclen); | 1912 | de = (struct buffered_dirent *)((char *)de + reclen); |
1913 | } | 1913 | } |
1914 | offset = vfs_llseek(file, 0, SEEK_CUR); | 1914 | offset = vfs_llseek(file, 0, SEEK_CUR); |
1915 | cdp->err = nfserr_eof; | ||
1916 | if (!buf.full) | ||
1917 | break; | ||
1918 | } | 1915 | } |
1919 | 1916 | ||
1920 | done: | 1917 | done: |
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h index 8c0f9505b48c..7605fdd1eb65 100644 --- a/include/linux/cnt32_to_63.h +++ b/include/linux/cnt32_to_63.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/compiler.h> | 16 | #include <linux/compiler.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <asm/byteorder.h> | 18 | #include <asm/byteorder.h> |
19 | #include <asm/system.h> | ||
19 | 20 | ||
20 | /* this is used only to give gcc a clue about good code generation */ | 21 | /* this is used only to give gcc a clue about good code generation */ |
21 | union cnt32_to_63 { | 22 | union cnt32_to_63 { |
@@ -53,11 +54,19 @@ union cnt32_to_63 { | |||
53 | * needed increment. And any race in updating the value in memory is harmless | 54 | * needed increment. And any race in updating the value in memory is harmless |
54 | * as the same value would simply be stored more than once. | 55 | * as the same value would simply be stored more than once. |
55 | * | 56 | * |
56 | * The only restriction for the algorithm to work properly is that this | 57 | * The restrictions for the algorithm to work properly are: |
57 | * code must be executed at least once per each half period of the 32-bit | 58 | * |
58 | * counter to properly update the state bit in memory. This is usually not a | 59 | * 1) this code must be called at least once per each half period of the |
59 | * problem in practice, but if it is then a kernel timer could be scheduled | 60 | * 32-bit counter; |
60 | * to manage for this code to be executed often enough. | 61 | * |
62 | * 2) this code must not be preempted for a duration longer than the | ||
63 | * 32-bit counter half period minus the longest period between two | ||
64 | * calls to this code. | ||
65 | * | ||
66 | * Those requirements ensure proper update to the state bit in memory. | ||
67 | * This is usually not a problem in practice, but if it is then a kernel | ||
68 | * timer should be scheduled to manage for this code to be executed often | ||
69 | * enough. | ||
61 | * | 70 | * |
62 | * Note that the top bit (bit 63) in the returned value should be considered | 71 | * Note that the top bit (bit 63) in the returned value should be considered |
63 | * as garbage. It is not cleared here because callers are likely to use a | 72 | * as garbage. It is not cleared here because callers are likely to use a |
@@ -68,9 +77,10 @@ union cnt32_to_63 { | |||
68 | */ | 77 | */ |
69 | #define cnt32_to_63(cnt_lo) \ | 78 | #define cnt32_to_63(cnt_lo) \ |
70 | ({ \ | 79 | ({ \ |
71 | static volatile u32 __m_cnt_hi; \ | 80 | static u32 __m_cnt_hi; \ |
72 | union cnt32_to_63 __x; \ | 81 | union cnt32_to_63 __x; \ |
73 | __x.hi = __m_cnt_hi; \ | 82 | __x.hi = __m_cnt_hi; \ |
83 | smp_rmb(); \ | ||
74 | __x.lo = (cnt_lo); \ | 84 | __x.lo = (cnt_lo); \ |
75 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ | 85 | if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ |
76 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ | 86 | __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index d3219d73f8e6..21e1dd43e52a 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -5,6 +5,9 @@ | |||
5 | * Cpumasks provide a bitmap suitable for representing the | 5 | * Cpumasks provide a bitmap suitable for representing the |
6 | * set of CPU's in a system, one bit position per CPU number. | 6 | * set of CPU's in a system, one bit position per CPU number. |
7 | * | 7 | * |
8 | * The new cpumask_ ops take a "struct cpumask *"; the old ones | ||
9 | * use cpumask_t. | ||
10 | * | ||
8 | * See detailed comments in the file linux/bitmap.h describing the | 11 | * See detailed comments in the file linux/bitmap.h describing the |
9 | * data type on which these cpumasks are based. | 12 | * data type on which these cpumasks are based. |
10 | * | 13 | * |
@@ -31,7 +34,7 @@ | |||
31 | * will span the entire range of NR_CPUS. | 34 | * will span the entire range of NR_CPUS. |
32 | * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . | 35 | * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
33 | * | 36 | * |
34 | * The available cpumask operations are: | 37 | * The obsolescent cpumask operations are: |
35 | * | 38 | * |
36 | * void cpu_set(cpu, mask) turn on bit 'cpu' in mask | 39 | * void cpu_set(cpu, mask) turn on bit 'cpu' in mask |
37 | * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask | 40 | * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask |
@@ -138,7 +141,7 @@ | |||
138 | #include <linux/threads.h> | 141 | #include <linux/threads.h> |
139 | #include <linux/bitmap.h> | 142 | #include <linux/bitmap.h> |
140 | 143 | ||
141 | typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; | 144 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; |
142 | extern cpumask_t _unused_cpumask_arg_; | 145 | extern cpumask_t _unused_cpumask_arg_; |
143 | 146 | ||
144 | #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) | 147 | #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) |
@@ -527,4 +530,556 @@ extern cpumask_t cpu_active_map; | |||
527 | #define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map) | 530 | #define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map) |
528 | #define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map) | 531 | #define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map) |
529 | 532 | ||
533 | /* These are the new versions of the cpumask operators: passed by pointer. | ||
534 | * The older versions will be implemented in terms of these, then deleted. */ | ||
535 | #define cpumask_bits(maskp) ((maskp)->bits) | ||
536 | |||
537 | #if NR_CPUS <= BITS_PER_LONG | ||
538 | #define CPU_BITS_ALL \ | ||
539 | { \ | ||
540 | [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ | ||
541 | } | ||
542 | |||
543 | /* This produces more efficient code. */ | ||
544 | #define nr_cpumask_bits NR_CPUS | ||
545 | |||
546 | #else /* NR_CPUS > BITS_PER_LONG */ | ||
547 | |||
548 | #define CPU_BITS_ALL \ | ||
549 | { \ | ||
550 | [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \ | ||
551 | [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \ | ||
552 | } | ||
553 | |||
554 | #define nr_cpumask_bits nr_cpu_ids | ||
555 | #endif /* NR_CPUS > BITS_PER_LONG */ | ||
556 | |||
557 | /* verify cpu argument to cpumask_* operators */ | ||
558 | static inline unsigned int cpumask_check(unsigned int cpu) | ||
559 | { | ||
560 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
561 | WARN_ON_ONCE(cpu >= nr_cpumask_bits); | ||
562 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | ||
563 | return cpu; | ||
564 | } | ||
565 | |||
566 | #if NR_CPUS == 1 | ||
567 | /* Uniprocessor. Assume all masks are "1". */ | ||
568 | static inline unsigned int cpumask_first(const struct cpumask *srcp) | ||
569 | { | ||
570 | return 0; | ||
571 | } | ||
572 | |||
573 | /* Valid inputs for n are -1 and 0. */ | ||
574 | static inline unsigned int cpumask_next(int n, const struct cpumask *srcp) | ||
575 | { | ||
576 | return n+1; | ||
577 | } | ||
578 | |||
579 | static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) | ||
580 | { | ||
581 | return n+1; | ||
582 | } | ||
583 | |||
584 | static inline unsigned int cpumask_next_and(int n, | ||
585 | const struct cpumask *srcp, | ||
586 | const struct cpumask *andp) | ||
587 | { | ||
588 | return n+1; | ||
589 | } | ||
590 | |||
591 | /* cpu must be a valid cpu, ie 0, so there's no other choice. */ | ||
592 | static inline unsigned int cpumask_any_but(const struct cpumask *mask, | ||
593 | unsigned int cpu) | ||
594 | { | ||
595 | return 1; | ||
596 | } | ||
597 | |||
598 | #define for_each_cpu(cpu, mask) \ | ||
599 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) | ||
600 | #define for_each_cpu_and(cpu, mask, and) \ | ||
601 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask, (void)and) | ||
602 | #else | ||
603 | /** | ||
604 | * cpumask_first - get the first cpu in a cpumask | ||
605 | * @srcp: the cpumask pointer | ||
606 | * | ||
607 | * Returns >= nr_cpu_ids if no cpus set. | ||
608 | */ | ||
609 | static inline unsigned int cpumask_first(const struct cpumask *srcp) | ||
610 | { | ||
611 | return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits); | ||
612 | } | ||
613 | |||
614 | /** | ||
615 | * cpumask_next - get the next cpu in a cpumask | ||
616 | * @n: the cpu prior to the place to search (ie. return will be > @n) | ||
617 | * @srcp: the cpumask pointer | ||
618 | * | ||
619 | * Returns >= nr_cpu_ids if no further cpus set. | ||
620 | */ | ||
621 | static inline unsigned int cpumask_next(int n, const struct cpumask *srcp) | ||
622 | { | ||
623 | /* -1 is a legal arg here. */ | ||
624 | if (n != -1) | ||
625 | cpumask_check(n); | ||
626 | return find_next_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1); | ||
627 | } | ||
628 | |||
629 | /** | ||
630 | * cpumask_next_zero - get the next unset cpu in a cpumask | ||
631 | * @n: the cpu prior to the place to search (ie. return will be > @n) | ||
632 | * @srcp: the cpumask pointer | ||
633 | * | ||
634 | * Returns >= nr_cpu_ids if no further cpus unset. | ||
635 | */ | ||
636 | static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) | ||
637 | { | ||
638 | /* -1 is a legal arg here. */ | ||
639 | if (n != -1) | ||
640 | cpumask_check(n); | ||
641 | return find_next_zero_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1); | ||
642 | } | ||
643 | |||
644 | int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); | ||
645 | int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); | ||
646 | |||
647 | /** | ||
648 | * for_each_cpu - iterate over every cpu in a mask | ||
649 | * @cpu: the (optionally unsigned) integer iterator | ||
650 | * @mask: the cpumask pointer | ||
651 | * | ||
652 | * After the loop, cpu is >= nr_cpu_ids. | ||
653 | */ | ||
654 | #define for_each_cpu(cpu, mask) \ | ||
655 | for ((cpu) = -1; \ | ||
656 | (cpu) = cpumask_next((cpu), (mask)), \ | ||
657 | (cpu) < nr_cpu_ids;) | ||
658 | |||
659 | /** | ||
660 | * for_each_cpu_and - iterate over every cpu in both masks | ||
661 | * @cpu: the (optionally unsigned) integer iterator | ||
662 | * @mask: the first cpumask pointer | ||
663 | * @and: the second cpumask pointer | ||
664 | * | ||
665 | * This saves a temporary CPU mask in many places. It is equivalent to: | ||
666 | * struct cpumask tmp; | ||
667 | * cpumask_and(&tmp, &mask, &and); | ||
668 | * for_each_cpu(cpu, &tmp) | ||
669 | * ... | ||
670 | * | ||
671 | * After the loop, cpu is >= nr_cpu_ids. | ||
672 | */ | ||
673 | #define for_each_cpu_and(cpu, mask, and) \ | ||
674 | for ((cpu) = -1; \ | ||
675 | (cpu) = cpumask_next_and((cpu), (mask), (and)), \ | ||
676 | (cpu) < nr_cpu_ids;) | ||
677 | #endif /* SMP */ | ||
678 | |||
679 | #define CPU_BITS_NONE \ | ||
680 | { \ | ||
681 | [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \ | ||
682 | } | ||
683 | |||
684 | #define CPU_BITS_CPU0 \ | ||
685 | { \ | ||
686 | [0] = 1UL \ | ||
687 | } | ||
688 | |||
689 | /** | ||
690 | * cpumask_set_cpu - set a cpu in a cpumask | ||
691 | * @cpu: cpu number (< nr_cpu_ids) | ||
692 | * @dstp: the cpumask pointer | ||
693 | */ | ||
694 | static inline void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp) | ||
695 | { | ||
696 | set_bit(cpumask_check(cpu), cpumask_bits(dstp)); | ||
697 | } | ||
698 | |||
699 | /** | ||
700 | * cpumask_clear_cpu - clear a cpu in a cpumask | ||
701 | * @cpu: cpu number (< nr_cpu_ids) | ||
702 | * @dstp: the cpumask pointer | ||
703 | */ | ||
704 | static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp) | ||
705 | { | ||
706 | clear_bit(cpumask_check(cpu), cpumask_bits(dstp)); | ||
707 | } | ||
708 | |||
709 | /** | ||
710 | * cpumask_test_cpu - test for a cpu in a cpumask | ||
711 | * @cpu: cpu number (< nr_cpu_ids) | ||
712 | * @cpumask: the cpumask pointer | ||
713 | * | ||
714 | * No static inline type checking - see Subtlety (1) above. | ||
715 | */ | ||
716 | #define cpumask_test_cpu(cpu, cpumask) \ | ||
717 | test_bit(cpumask_check(cpu), (cpumask)->bits) | ||
718 | |||
719 | /** | ||
720 | * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask | ||
721 | * @cpu: cpu number (< nr_cpu_ids) | ||
722 | * @cpumask: the cpumask pointer | ||
723 | * | ||
724 | * test_and_set_bit wrapper for cpumasks. | ||
725 | */ | ||
726 | static inline int cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask) | ||
727 | { | ||
728 | return test_and_set_bit(cpumask_check(cpu), cpumask_bits(cpumask)); | ||
729 | } | ||
730 | |||
731 | /** | ||
732 | * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask | ||
733 | * @dstp: the cpumask pointer | ||
734 | */ | ||
735 | static inline void cpumask_setall(struct cpumask *dstp) | ||
736 | { | ||
737 | bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits); | ||
738 | } | ||
739 | |||
740 | /** | ||
741 | * cpumask_clear - clear all cpus (< nr_cpu_ids) in a cpumask | ||
742 | * @dstp: the cpumask pointer | ||
743 | */ | ||
744 | static inline void cpumask_clear(struct cpumask *dstp) | ||
745 | { | ||
746 | bitmap_zero(cpumask_bits(dstp), nr_cpumask_bits); | ||
747 | } | ||
748 | |||
749 | /** | ||
750 | * cpumask_and - *dstp = *src1p & *src2p | ||
751 | * @dstp: the cpumask result | ||
752 | * @src1p: the first input | ||
753 | * @src2p: the second input | ||
754 | */ | ||
755 | static inline void cpumask_and(struct cpumask *dstp, | ||
756 | const struct cpumask *src1p, | ||
757 | const struct cpumask *src2p) | ||
758 | { | ||
759 | bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p), | ||
760 | cpumask_bits(src2p), nr_cpumask_bits); | ||
761 | } | ||
762 | |||
763 | /** | ||
764 | * cpumask_or - *dstp = *src1p | *src2p | ||
765 | * @dstp: the cpumask result | ||
766 | * @src1p: the first input | ||
767 | * @src2p: the second input | ||
768 | */ | ||
769 | static inline void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p, | ||
770 | const struct cpumask *src2p) | ||
771 | { | ||
772 | bitmap_or(cpumask_bits(dstp), cpumask_bits(src1p), | ||
773 | cpumask_bits(src2p), nr_cpumask_bits); | ||
774 | } | ||
775 | |||
776 | /** | ||
777 | * cpumask_xor - *dstp = *src1p ^ *src2p | ||
778 | * @dstp: the cpumask result | ||
779 | * @src1p: the first input | ||
780 | * @src2p: the second input | ||
781 | */ | ||
782 | static inline void cpumask_xor(struct cpumask *dstp, | ||
783 | const struct cpumask *src1p, | ||
784 | const struct cpumask *src2p) | ||
785 | { | ||
786 | bitmap_xor(cpumask_bits(dstp), cpumask_bits(src1p), | ||
787 | cpumask_bits(src2p), nr_cpumask_bits); | ||
788 | } | ||
789 | |||
790 | /** | ||
791 | * cpumask_andnot - *dstp = *src1p & ~*src2p | ||
792 | * @dstp: the cpumask result | ||
793 | * @src1p: the first input | ||
794 | * @src2p: the second input | ||
795 | */ | ||
796 | static inline void cpumask_andnot(struct cpumask *dstp, | ||
797 | const struct cpumask *src1p, | ||
798 | const struct cpumask *src2p) | ||
799 | { | ||
800 | bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p), | ||
801 | cpumask_bits(src2p), nr_cpumask_bits); | ||
802 | } | ||
803 | |||
804 | /** | ||
805 | * cpumask_complement - *dstp = ~*srcp | ||
806 | * @dstp: the cpumask result | ||
807 | * @srcp: the input to invert | ||
808 | */ | ||
809 | static inline void cpumask_complement(struct cpumask *dstp, | ||
810 | const struct cpumask *srcp) | ||
811 | { | ||
812 | bitmap_complement(cpumask_bits(dstp), cpumask_bits(srcp), | ||
813 | nr_cpumask_bits); | ||
814 | } | ||
815 | |||
816 | /** | ||
817 | * cpumask_equal - *src1p == *src2p | ||
818 | * @src1p: the first input | ||
819 | * @src2p: the second input | ||
820 | */ | ||
821 | static inline bool cpumask_equal(const struct cpumask *src1p, | ||
822 | const struct cpumask *src2p) | ||
823 | { | ||
824 | return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p), | ||
825 | nr_cpumask_bits); | ||
826 | } | ||
827 | |||
828 | /** | ||
829 | * cpumask_intersects - (*src1p & *src2p) != 0 | ||
830 | * @src1p: the first input | ||
831 | * @src2p: the second input | ||
832 | */ | ||
833 | static inline bool cpumask_intersects(const struct cpumask *src1p, | ||
834 | const struct cpumask *src2p) | ||
835 | { | ||
836 | return bitmap_intersects(cpumask_bits(src1p), cpumask_bits(src2p), | ||
837 | nr_cpumask_bits); | ||
838 | } | ||
839 | |||
840 | /** | ||
841 | * cpumask_subset - (*src1p & ~*src2p) == 0 | ||
842 | * @src1p: the first input | ||
843 | * @src2p: the second input | ||
844 | */ | ||
845 | static inline int cpumask_subset(const struct cpumask *src1p, | ||
846 | const struct cpumask *src2p) | ||
847 | { | ||
848 | return bitmap_subset(cpumask_bits(src1p), cpumask_bits(src2p), | ||
849 | nr_cpumask_bits); | ||
850 | } | ||
851 | |||
852 | /** | ||
853 | * cpumask_empty - *srcp == 0 | ||
854 | * @srcp: the cpumask to that all cpus < nr_cpu_ids are clear. | ||
855 | */ | ||
856 | static inline bool cpumask_empty(const struct cpumask *srcp) | ||
857 | { | ||
858 | return bitmap_empty(cpumask_bits(srcp), nr_cpumask_bits); | ||
859 | } | ||
860 | |||
861 | /** | ||
862 | * cpumask_full - *srcp == 0xFFFFFFFF... | ||
863 | * @srcp: the cpumask to that all cpus < nr_cpu_ids are set. | ||
864 | */ | ||
865 | static inline bool cpumask_full(const struct cpumask *srcp) | ||
866 | { | ||
867 | return bitmap_full(cpumask_bits(srcp), nr_cpumask_bits); | ||
868 | } | ||
869 | |||
870 | /** | ||
871 | * cpumask_weight - Count of bits in *srcp | ||
872 | * @srcp: the cpumask to count bits (< nr_cpu_ids) in. | ||
873 | */ | ||
874 | static inline unsigned int cpumask_weight(const struct cpumask *srcp) | ||
875 | { | ||
876 | return bitmap_weight(cpumask_bits(srcp), nr_cpumask_bits); | ||
877 | } | ||
878 | |||
879 | /** | ||
880 | * cpumask_shift_right - *dstp = *srcp >> n | ||
881 | * @dstp: the cpumask result | ||
882 | * @srcp: the input to shift | ||
883 | * @n: the number of bits to shift by | ||
884 | */ | ||
885 | static inline void cpumask_shift_right(struct cpumask *dstp, | ||
886 | const struct cpumask *srcp, int n) | ||
887 | { | ||
888 | bitmap_shift_right(cpumask_bits(dstp), cpumask_bits(srcp), n, | ||
889 | nr_cpumask_bits); | ||
890 | } | ||
891 | |||
892 | /** | ||
893 | * cpumask_shift_left - *dstp = *srcp << n | ||
894 | * @dstp: the cpumask result | ||
895 | * @srcp: the input to shift | ||
896 | * @n: the number of bits to shift by | ||
897 | */ | ||
898 | static inline void cpumask_shift_left(struct cpumask *dstp, | ||
899 | const struct cpumask *srcp, int n) | ||
900 | { | ||
901 | bitmap_shift_left(cpumask_bits(dstp), cpumask_bits(srcp), n, | ||
902 | nr_cpumask_bits); | ||
903 | } | ||
904 | |||
905 | /** | ||
906 | * cpumask_copy - *dstp = *srcp | ||
907 | * @dstp: the result | ||
908 | * @srcp: the input cpumask | ||
909 | */ | ||
910 | static inline void cpumask_copy(struct cpumask *dstp, | ||
911 | const struct cpumask *srcp) | ||
912 | { | ||
913 | bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits); | ||
914 | } | ||
915 | |||
916 | /** | ||
917 | * cpumask_any - pick a "random" cpu from *srcp | ||
918 | * @srcp: the input cpumask | ||
919 | * | ||
920 | * Returns >= nr_cpu_ids if no cpus set. | ||
921 | */ | ||
922 | #define cpumask_any(srcp) cpumask_first(srcp) | ||
923 | |||
924 | /** | ||
925 | * cpumask_first_and - return the first cpu from *srcp1 & *srcp2 | ||
926 | * @src1p: the first input | ||
927 | * @src2p: the second input | ||
928 | * | ||
929 | * Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and(). | ||
930 | */ | ||
931 | #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p)) | ||
932 | |||
933 | /** | ||
934 | * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2 | ||
935 | * @mask1: the first input cpumask | ||
936 | * @mask2: the second input cpumask | ||
937 | * | ||
938 | * Returns >= nr_cpu_ids if no cpus set. | ||
939 | */ | ||
940 | #define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2)) | ||
941 | |||
942 | /** | ||
943 | * cpumask_of - the cpumask containing just a given cpu | ||
944 | * @cpu: the cpu (<= nr_cpu_ids) | ||
945 | */ | ||
946 | #define cpumask_of(cpu) (get_cpu_mask(cpu)) | ||
947 | |||
948 | /** | ||
949 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * | ||
950 | * @bitmap: the bitmap | ||
951 | * | ||
952 | * There are a few places where cpumask_var_t isn't appropriate and | ||
953 | * static cpumasks must be used (eg. very early boot), yet we don't | ||
954 | * expose the definition of 'struct cpumask'. | ||
955 | * | ||
956 | * This does the conversion, and can be used as a constant initializer. | ||
957 | */ | ||
958 | #define to_cpumask(bitmap) \ | ||
959 | ((struct cpumask *)(1 ? (bitmap) \ | ||
960 | : (void *)sizeof(__check_is_bitmap(bitmap)))) | ||
961 | |||
962 | static inline int __check_is_bitmap(const unsigned long *bitmap) | ||
963 | { | ||
964 | return 1; | ||
965 | } | ||
966 | |||
967 | /** | ||
968 | * cpumask_size - size to allocate for a 'struct cpumask' in bytes | ||
969 | * | ||
970 | * This will eventually be a runtime variable, depending on nr_cpu_ids. | ||
971 | */ | ||
972 | static inline size_t cpumask_size(void) | ||
973 | { | ||
974 | /* FIXME: Once all cpumask assignments are eliminated, this | ||
975 | * can be nr_cpumask_bits */ | ||
976 | return BITS_TO_LONGS(NR_CPUS) * sizeof(long); | ||
977 | } | ||
978 | |||
979 | /* | ||
980 | * cpumask_var_t: struct cpumask for stack usage. | ||
981 | * | ||
982 | * Oh, the wicked games we play! In order to make kernel coding a | ||
983 | * little more difficult, we typedef cpumask_var_t to an array or a | ||
984 | * pointer: doing &mask on an array is a noop, so it still works. | ||
985 | * | ||
986 | * ie. | ||
987 | * cpumask_var_t tmpmask; | ||
988 | * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL)) | ||
989 | * return -ENOMEM; | ||
990 | * | ||
991 | * ... use 'tmpmask' like a normal struct cpumask * ... | ||
992 | * | ||
993 | * free_cpumask_var(tmpmask); | ||
994 | */ | ||
995 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
996 | typedef struct cpumask *cpumask_var_t; | ||
997 | |||
998 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | ||
999 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); | ||
1000 | void free_cpumask_var(cpumask_var_t mask); | ||
1001 | void free_bootmem_cpumask_var(cpumask_var_t mask); | ||
1002 | |||
1003 | #else | ||
1004 | typedef struct cpumask cpumask_var_t[1]; | ||
1005 | |||
1006 | static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | ||
1007 | { | ||
1008 | return true; | ||
1009 | } | ||
1010 | |||
1011 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) | ||
1012 | { | ||
1013 | } | ||
1014 | |||
1015 | static inline void free_cpumask_var(cpumask_var_t mask) | ||
1016 | { | ||
1017 | } | ||
1018 | |||
1019 | static inline void free_bootmem_cpumask_var(cpumask_var_t mask) | ||
1020 | { | ||
1021 | } | ||
1022 | #endif /* CONFIG_CPUMASK_OFFSTACK */ | ||
1023 | |||
1024 | /* The pointer versions of the maps, these will become the primary versions. */ | ||
1025 | #define cpu_possible_mask ((const struct cpumask *)&cpu_possible_map) | ||
1026 | #define cpu_online_mask ((const struct cpumask *)&cpu_online_map) | ||
1027 | #define cpu_present_mask ((const struct cpumask *)&cpu_present_map) | ||
1028 | #define cpu_active_mask ((const struct cpumask *)&cpu_active_map) | ||
1029 | |||
1030 | /* It's common to want to use cpu_all_mask in struct member initializers, | ||
1031 | * so it has to refer to an address rather than a pointer. */ | ||
1032 | extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); | ||
1033 | #define cpu_all_mask to_cpumask(cpu_all_bits) | ||
1034 | |||
1035 | /* First bits of cpu_bit_bitmap are in fact unset. */ | ||
1036 | #define cpu_none_mask to_cpumask(cpu_bit_bitmap[0]) | ||
1037 | |||
1038 | /* Wrappers for arch boot code to manipulate normally-constant masks */ | ||
1039 | static inline void set_cpu_possible(unsigned int cpu, bool possible) | ||
1040 | { | ||
1041 | if (possible) | ||
1042 | cpumask_set_cpu(cpu, &cpu_possible_map); | ||
1043 | else | ||
1044 | cpumask_clear_cpu(cpu, &cpu_possible_map); | ||
1045 | } | ||
1046 | |||
1047 | static inline void set_cpu_present(unsigned int cpu, bool present) | ||
1048 | { | ||
1049 | if (present) | ||
1050 | cpumask_set_cpu(cpu, &cpu_present_map); | ||
1051 | else | ||
1052 | cpumask_clear_cpu(cpu, &cpu_present_map); | ||
1053 | } | ||
1054 | |||
1055 | static inline void set_cpu_online(unsigned int cpu, bool online) | ||
1056 | { | ||
1057 | if (online) | ||
1058 | cpumask_set_cpu(cpu, &cpu_online_map); | ||
1059 | else | ||
1060 | cpumask_clear_cpu(cpu, &cpu_online_map); | ||
1061 | } | ||
1062 | |||
1063 | static inline void set_cpu_active(unsigned int cpu, bool active) | ||
1064 | { | ||
1065 | if (active) | ||
1066 | cpumask_set_cpu(cpu, &cpu_active_map); | ||
1067 | else | ||
1068 | cpumask_clear_cpu(cpu, &cpu_active_map); | ||
1069 | } | ||
1070 | |||
1071 | static inline void init_cpu_present(const struct cpumask *src) | ||
1072 | { | ||
1073 | cpumask_copy(&cpu_present_map, src); | ||
1074 | } | ||
1075 | |||
1076 | static inline void init_cpu_possible(const struct cpumask *src) | ||
1077 | { | ||
1078 | cpumask_copy(&cpu_possible_map, src); | ||
1079 | } | ||
1080 | |||
1081 | static inline void init_cpu_online(const struct cpumask *src) | ||
1082 | { | ||
1083 | cpumask_copy(&cpu_online_map, src); | ||
1084 | } | ||
530 | #endif /* __LINUX_CPUMASK_H */ | 1085 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index ee6e822d5994..403aa505f27e 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -130,7 +130,7 @@ struct mmc_card { | |||
130 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) | 130 | #define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) |
131 | 131 | ||
132 | #define mmc_card_name(c) ((c)->cid.prod_name) | 132 | #define mmc_card_name(c) ((c)->cid.prod_name) |
133 | #define mmc_card_id(c) ((c)->dev.bus_id) | 133 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
134 | 134 | ||
135 | #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) | 135 | #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) |
136 | #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) | 136 | #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index bde891f64591..f842f234e44f 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -176,7 +176,7 @@ static inline void *mmc_priv(struct mmc_host *host) | |||
176 | 176 | ||
177 | #define mmc_dev(x) ((x)->parent) | 177 | #define mmc_dev(x) ((x)->parent) |
178 | #define mmc_classdev(x) (&(x)->class_dev) | 178 | #define mmc_classdev(x) (&(x)->class_dev) |
179 | #define mmc_hostname(x) ((x)->class_dev.bus_id) | 179 | #define mmc_hostname(x) (dev_name(&(x)->class_dev)) |
180 | 180 | ||
181 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); | 181 | extern int mmc_suspend_host(struct mmc_host *, pm_message_t); |
182 | extern int mmc_resume_host(struct mmc_host *); | 182 | extern int mmc_resume_host(struct mmc_host *); |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 07bee4a0d457..451bdfc85830 100644 --- a/include/linux/mmc/sdio_func.h +++ b/include/linux/mmc/sdio_func.h | |||
@@ -63,7 +63,7 @@ struct sdio_func { | |||
63 | 63 | ||
64 | #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT) | 64 | #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT) |
65 | 65 | ||
66 | #define sdio_func_id(f) ((f)->dev.bus_id) | 66 | #define sdio_func_id(f) (dev_name(&(f)->dev)) |
67 | 67 | ||
68 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) | 68 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) |
69 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) | 69 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 2e4d58b26c06..3f9a60043a97 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -64,8 +64,17 @@ extern void smp_cpus_done(unsigned int max_cpus); | |||
64 | * Call a function on all other processors | 64 | * Call a function on all other processors |
65 | */ | 65 | */ |
66 | int smp_call_function(void(*func)(void *info), void *info, int wait); | 66 | int smp_call_function(void(*func)(void *info), void *info, int wait); |
67 | /* Deprecated: use smp_call_function_many() which uses a cpumask ptr. */ | ||
67 | int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, | 68 | int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, |
68 | int wait); | 69 | int wait); |
70 | |||
71 | static inline void smp_call_function_many(const struct cpumask *mask, | ||
72 | void (*func)(void *info), void *info, | ||
73 | int wait) | ||
74 | { | ||
75 | smp_call_function_mask(*mask, func, info, wait); | ||
76 | } | ||
77 | |||
69 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | 78 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, |
70 | int wait); | 79 | int wait); |
71 | void __smp_call_function_single(int cpuid, struct call_single_data *data); | 80 | void __smp_call_function_single(int cpuid, struct call_single_data *data); |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 89a5a1231ffb..b36291130f22 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -240,4 +240,12 @@ void cancel_rearming_delayed_work(struct delayed_work *work) | |||
240 | cancel_delayed_work_sync(work); | 240 | cancel_delayed_work_sync(work); |
241 | } | 241 | } |
242 | 242 | ||
243 | #ifndef CONFIG_SMP | ||
244 | static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | ||
245 | { | ||
246 | return fn(arg); | ||
247 | } | ||
248 | #else | ||
249 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); | ||
250 | #endif /* CONFIG_SMP */ | ||
243 | #endif | 251 | #endif |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 7dd29b7e461d..c29ff1da8a18 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -54,6 +54,7 @@ struct unix_sock { | |||
54 | atomic_long_t inflight; | 54 | atomic_long_t inflight; |
55 | spinlock_t lock; | 55 | spinlock_t lock; |
56 | unsigned int gc_candidate : 1; | 56 | unsigned int gc_candidate : 1; |
57 | unsigned int gc_maybe_cycle : 1; | ||
57 | wait_queue_head_t peer_wait; | 58 | wait_queue_head_t peer_wait; |
58 | }; | 59 | }; |
59 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 60 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 86d49045daed..5a732c5ef08b 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -499,3 +499,6 @@ const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = { | |||
499 | #endif | 499 | #endif |
500 | }; | 500 | }; |
501 | EXPORT_SYMBOL_GPL(cpu_bit_bitmap); | 501 | EXPORT_SYMBOL_GPL(cpu_bit_bitmap); |
502 | |||
503 | const DECLARE_BITMAP(cpu_all_bits, NR_CPUS) = CPU_BITS_ALL; | ||
504 | EXPORT_SYMBOL(cpu_all_bits); | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index f928f2a87b9b..d4dc69ddebd7 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -970,6 +970,51 @@ undo: | |||
970 | return ret; | 970 | return ret; |
971 | } | 971 | } |
972 | 972 | ||
973 | #ifdef CONFIG_SMP | ||
974 | struct work_for_cpu { | ||
975 | struct work_struct work; | ||
976 | long (*fn)(void *); | ||
977 | void *arg; | ||
978 | long ret; | ||
979 | }; | ||
980 | |||
981 | static void do_work_for_cpu(struct work_struct *w) | ||
982 | { | ||
983 | struct work_for_cpu *wfc = container_of(w, struct work_for_cpu, work); | ||
984 | |||
985 | wfc->ret = wfc->fn(wfc->arg); | ||
986 | } | ||
987 | |||
988 | /** | ||
989 | * work_on_cpu - run a function in user context on a particular cpu | ||
990 | * @cpu: the cpu to run on | ||
991 | * @fn: the function to run | ||
992 | * @arg: the function arg | ||
993 | * | ||
994 | * This will return -EINVAL in the cpu is not online, or the return value | ||
995 | * of @fn otherwise. | ||
996 | */ | ||
997 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | ||
998 | { | ||
999 | struct work_for_cpu wfc; | ||
1000 | |||
1001 | INIT_WORK(&wfc.work, do_work_for_cpu); | ||
1002 | wfc.fn = fn; | ||
1003 | wfc.arg = arg; | ||
1004 | get_online_cpus(); | ||
1005 | if (unlikely(!cpu_online(cpu))) | ||
1006 | wfc.ret = -EINVAL; | ||
1007 | else { | ||
1008 | schedule_work_on(cpu, &wfc.work); | ||
1009 | flush_work(&wfc.work); | ||
1010 | } | ||
1011 | put_online_cpus(); | ||
1012 | |||
1013 | return wfc.ret; | ||
1014 | } | ||
1015 | EXPORT_SYMBOL_GPL(work_on_cpu); | ||
1016 | #endif /* CONFIG_SMP */ | ||
1017 | |||
973 | void __init init_workqueues(void) | 1018 | void __init init_workqueues(void) |
974 | { | 1019 | { |
975 | cpu_populated_map = cpu_online_map; | 1020 | cpu_populated_map = cpu_online_map; |
diff --git a/lib/cpumask.c b/lib/cpumask.c index 5f97dc25ef9c..8d03f22c6ced 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/bitops.h> | 2 | #include <linux/bitops.h> |
3 | #include <linux/cpumask.h> | 3 | #include <linux/cpumask.h> |
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/bootmem.h> | ||
5 | 6 | ||
6 | int __first_cpu(const cpumask_t *srcp) | 7 | int __first_cpu(const cpumask_t *srcp) |
7 | { | 8 | { |
@@ -35,3 +36,81 @@ int __any_online_cpu(const cpumask_t *mask) | |||
35 | return cpu; | 36 | return cpu; |
36 | } | 37 | } |
37 | EXPORT_SYMBOL(__any_online_cpu); | 38 | EXPORT_SYMBOL(__any_online_cpu); |
39 | |||
40 | /** | ||
41 | * cpumask_next_and - get the next cpu in *src1p & *src2p | ||
42 | * @n: the cpu prior to the place to search (ie. return will be > @n) | ||
43 | * @src1p: the first cpumask pointer | ||
44 | * @src2p: the second cpumask pointer | ||
45 | * | ||
46 | * Returns >= nr_cpu_ids if no further cpus set in both. | ||
47 | */ | ||
48 | int cpumask_next_and(int n, const struct cpumask *src1p, | ||
49 | const struct cpumask *src2p) | ||
50 | { | ||
51 | while ((n = cpumask_next(n, src1p)) < nr_cpu_ids) | ||
52 | if (cpumask_test_cpu(n, src2p)) | ||
53 | break; | ||
54 | return n; | ||
55 | } | ||
56 | EXPORT_SYMBOL(cpumask_next_and); | ||
57 | |||
58 | /** | ||
59 | * cpumask_any_but - return a "random" in a cpumask, but not this one. | ||
60 | * @mask: the cpumask to search | ||
61 | * @cpu: the cpu to ignore. | ||
62 | * | ||
63 | * Often used to find any cpu but smp_processor_id() in a mask. | ||
64 | * Returns >= nr_cpu_ids if no cpus set. | ||
65 | */ | ||
66 | int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) | ||
67 | { | ||
68 | unsigned int i; | ||
69 | |||
70 | cpumask_check(cpu); | ||
71 | for_each_cpu(i, mask) | ||
72 | if (i != cpu) | ||
73 | break; | ||
74 | return i; | ||
75 | } | ||
76 | |||
77 | /* These are not inline because of header tangles. */ | ||
78 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
79 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | ||
80 | { | ||
81 | if (likely(slab_is_available())) | ||
82 | *mask = kmalloc(cpumask_size(), flags); | ||
83 | else { | ||
84 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
85 | printk(KERN_ERR | ||
86 | "=> alloc_cpumask_var: kmalloc not available!\n"); | ||
87 | dump_stack(); | ||
88 | #endif | ||
89 | *mask = NULL; | ||
90 | } | ||
91 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
92 | if (!*mask) { | ||
93 | printk(KERN_ERR "=> alloc_cpumask_var: failed!\n"); | ||
94 | dump_stack(); | ||
95 | } | ||
96 | #endif | ||
97 | return *mask != NULL; | ||
98 | } | ||
99 | EXPORT_SYMBOL(alloc_cpumask_var); | ||
100 | |||
101 | void __init alloc_bootmem_cpumask_var(cpumask_var_t *mask) | ||
102 | { | ||
103 | *mask = alloc_bootmem(cpumask_size()); | ||
104 | } | ||
105 | |||
106 | void free_cpumask_var(cpumask_var_t mask) | ||
107 | { | ||
108 | kfree(mask); | ||
109 | } | ||
110 | EXPORT_SYMBOL(free_cpumask_var); | ||
111 | |||
112 | void __init free_bootmem_cpumask_var(cpumask_var_t mask) | ||
113 | { | ||
114 | free_bootmem((unsigned long)mask, cpumask_size()); | ||
115 | } | ||
116 | #endif | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 4d3c6071b9a4..eb90f77bb0e2 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1302,14 +1302,23 @@ static void unix_destruct_fds(struct sk_buff *skb) | |||
1302 | sock_wfree(skb); | 1302 | sock_wfree(skb); |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | static void unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) | 1305 | static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) |
1306 | { | 1306 | { |
1307 | int i; | 1307 | int i; |
1308 | |||
1309 | /* | ||
1310 | * Need to duplicate file references for the sake of garbage | ||
1311 | * collection. Otherwise a socket in the fps might become a | ||
1312 | * candidate for GC while the skb is not yet queued. | ||
1313 | */ | ||
1314 | UNIXCB(skb).fp = scm_fp_dup(scm->fp); | ||
1315 | if (!UNIXCB(skb).fp) | ||
1316 | return -ENOMEM; | ||
1317 | |||
1308 | for (i=scm->fp->count-1; i>=0; i--) | 1318 | for (i=scm->fp->count-1; i>=0; i--) |
1309 | unix_inflight(scm->fp->fp[i]); | 1319 | unix_inflight(scm->fp->fp[i]); |
1310 | UNIXCB(skb).fp = scm->fp; | ||
1311 | skb->destructor = unix_destruct_fds; | 1320 | skb->destructor = unix_destruct_fds; |
1312 | scm->fp = NULL; | 1321 | return 0; |
1313 | } | 1322 | } |
1314 | 1323 | ||
1315 | /* | 1324 | /* |
@@ -1368,8 +1377,11 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1368 | goto out; | 1377 | goto out; |
1369 | 1378 | ||
1370 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); | 1379 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); |
1371 | if (siocb->scm->fp) | 1380 | if (siocb->scm->fp) { |
1372 | unix_attach_fds(siocb->scm, skb); | 1381 | err = unix_attach_fds(siocb->scm, skb); |
1382 | if (err) | ||
1383 | goto out_free; | ||
1384 | } | ||
1373 | unix_get_secdata(siocb->scm, skb); | 1385 | unix_get_secdata(siocb->scm, skb); |
1374 | 1386 | ||
1375 | skb_reset_transport_header(skb); | 1387 | skb_reset_transport_header(skb); |
@@ -1538,8 +1550,13 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1538 | size = min_t(int, size, skb_tailroom(skb)); | 1550 | size = min_t(int, size, skb_tailroom(skb)); |
1539 | 1551 | ||
1540 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); | 1552 | memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); |
1541 | if (siocb->scm->fp) | 1553 | if (siocb->scm->fp) { |
1542 | unix_attach_fds(siocb->scm, skb); | 1554 | err = unix_attach_fds(siocb->scm, skb); |
1555 | if (err) { | ||
1556 | kfree_skb(skb); | ||
1557 | goto out_err; | ||
1558 | } | ||
1559 | } | ||
1543 | 1560 | ||
1544 | if ((err = memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) != 0) { | 1561 | if ((err = memcpy_fromiovec(skb_put(skb,size), msg->msg_iov, size)) != 0) { |
1545 | kfree_skb(skb); | 1562 | kfree_skb(skb); |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 2a27b84f740b..6d4a9a8de5ef 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -186,8 +186,17 @@ static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), | |||
186 | */ | 186 | */ |
187 | struct sock *sk = unix_get_socket(*fp++); | 187 | struct sock *sk = unix_get_socket(*fp++); |
188 | if (sk) { | 188 | if (sk) { |
189 | hit = true; | 189 | struct unix_sock *u = unix_sk(sk); |
190 | func(unix_sk(sk)); | 190 | |
191 | /* | ||
192 | * Ignore non-candidates, they could | ||
193 | * have been added to the queues after | ||
194 | * starting the garbage collection | ||
195 | */ | ||
196 | if (u->gc_candidate) { | ||
197 | hit = true; | ||
198 | func(u); | ||
199 | } | ||
191 | } | 200 | } |
192 | } | 201 | } |
193 | if (hit && hitlist != NULL) { | 202 | if (hit && hitlist != NULL) { |
@@ -249,11 +258,11 @@ static void inc_inflight_move_tail(struct unix_sock *u) | |||
249 | { | 258 | { |
250 | atomic_long_inc(&u->inflight); | 259 | atomic_long_inc(&u->inflight); |
251 | /* | 260 | /* |
252 | * If this is still a candidate, move it to the end of the | 261 | * If this still might be part of a cycle, move it to the end |
253 | * list, so that it's checked even if it was already passed | 262 | * of the list, so that it's checked even if it was already |
254 | * over | 263 | * passed over |
255 | */ | 264 | */ |
256 | if (u->gc_candidate) | 265 | if (u->gc_maybe_cycle) |
257 | list_move_tail(&u->link, &gc_candidates); | 266 | list_move_tail(&u->link, &gc_candidates); |
258 | } | 267 | } |
259 | 268 | ||
@@ -267,6 +276,7 @@ void unix_gc(void) | |||
267 | struct unix_sock *next; | 276 | struct unix_sock *next; |
268 | struct sk_buff_head hitlist; | 277 | struct sk_buff_head hitlist; |
269 | struct list_head cursor; | 278 | struct list_head cursor; |
279 | LIST_HEAD(not_cycle_list); | ||
270 | 280 | ||
271 | spin_lock(&unix_gc_lock); | 281 | spin_lock(&unix_gc_lock); |
272 | 282 | ||
@@ -282,10 +292,14 @@ void unix_gc(void) | |||
282 | * | 292 | * |
283 | * Holding unix_gc_lock will protect these candidates from | 293 | * Holding unix_gc_lock will protect these candidates from |
284 | * being detached, and hence from gaining an external | 294 | * being detached, and hence from gaining an external |
285 | * reference. This also means, that since there are no | 295 | * reference. Since there are no possible receivers, all |
286 | * possible receivers, the receive queues of these sockets are | 296 | * buffers currently on the candidates' queues stay there |
287 | * static during the GC, even though the dequeue is done | 297 | * during the garbage collection. |
288 | * before the detach without atomicity guarantees. | 298 | * |
299 | * We also know that no new candidate can be added onto the | ||
300 | * receive queues. Other, non candidate sockets _can_ be | ||
301 | * added to queue, so we must make sure only to touch | ||
302 | * candidates. | ||
289 | */ | 303 | */ |
290 | list_for_each_entry_safe(u, next, &gc_inflight_list, link) { | 304 | list_for_each_entry_safe(u, next, &gc_inflight_list, link) { |
291 | long total_refs; | 305 | long total_refs; |
@@ -299,6 +313,7 @@ void unix_gc(void) | |||
299 | if (total_refs == inflight_refs) { | 313 | if (total_refs == inflight_refs) { |
300 | list_move_tail(&u->link, &gc_candidates); | 314 | list_move_tail(&u->link, &gc_candidates); |
301 | u->gc_candidate = 1; | 315 | u->gc_candidate = 1; |
316 | u->gc_maybe_cycle = 1; | ||
302 | } | 317 | } |
303 | } | 318 | } |
304 | 319 | ||
@@ -325,14 +340,24 @@ void unix_gc(void) | |||
325 | list_move(&cursor, &u->link); | 340 | list_move(&cursor, &u->link); |
326 | 341 | ||
327 | if (atomic_long_read(&u->inflight) > 0) { | 342 | if (atomic_long_read(&u->inflight) > 0) { |
328 | list_move_tail(&u->link, &gc_inflight_list); | 343 | list_move_tail(&u->link, ¬_cycle_list); |
329 | u->gc_candidate = 0; | 344 | u->gc_maybe_cycle = 0; |
330 | scan_children(&u->sk, inc_inflight_move_tail, NULL); | 345 | scan_children(&u->sk, inc_inflight_move_tail, NULL); |
331 | } | 346 | } |
332 | } | 347 | } |
333 | list_del(&cursor); | 348 | list_del(&cursor); |
334 | 349 | ||
335 | /* | 350 | /* |
351 | * not_cycle_list contains those sockets which do not make up a | ||
352 | * cycle. Restore these to the inflight list. | ||
353 | */ | ||
354 | while (!list_empty(¬_cycle_list)) { | ||
355 | u = list_entry(not_cycle_list.next, struct unix_sock, link); | ||
356 | u->gc_candidate = 0; | ||
357 | list_move_tail(&u->link, &gc_inflight_list); | ||
358 | } | ||
359 | |||
360 | /* | ||
336 | * Now gc_candidates contains only garbage. Restore original | 361 | * Now gc_candidates contains only garbage. Restore original |
337 | * inflight counters for these as well, and remove the skbuffs | 362 | * inflight counters for these as well, and remove the skbuffs |
338 | * which are creating the cycle(s). | 363 | * which are creating the cycle(s). |
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index ba6bf5d5abf9..1264b8e2829d 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -15,15 +15,18 @@ set -e | |||
15 | version=$KERNELRELEASE | 15 | version=$KERNELRELEASE |
16 | revision=`cat .version` | 16 | revision=`cat .version` |
17 | tmpdir="$objtree/debian/tmp" | 17 | tmpdir="$objtree/debian/tmp" |
18 | fwdir="$objtree/debian/fwtmp" | ||
18 | packagename=linux-$version | 19 | packagename=linux-$version |
20 | fwpackagename=linux-firmware-image | ||
19 | 21 | ||
20 | if [ "$ARCH" == "um" ] ; then | 22 | if [ "$ARCH" == "um" ] ; then |
21 | packagename=user-mode-linux-$version | 23 | packagename=user-mode-linux-$version |
22 | fi | 24 | fi |
23 | 25 | ||
24 | # Setup the directory structure | 26 | # Setup the directory structure |
25 | rm -rf "$tmpdir" | 27 | rm -rf "$tmpdir" "$fwdir" |
26 | mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" | 28 | mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" |
29 | mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" | ||
27 | if [ "$ARCH" == "um" ] ; then | 30 | if [ "$ARCH" == "um" ] ; then |
28 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" | 31 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" |
29 | fi | 32 | fi |
@@ -107,6 +110,7 @@ Standards-Version: 3.6.1 | |||
107 | 110 | ||
108 | Package: $packagename | 111 | Package: $packagename |
109 | Provides: kernel-image-$version, linux-image-$version | 112 | Provides: kernel-image-$version, linux-image-$version |
113 | Suggests: $fwpackagename | ||
110 | Architecture: any | 114 | Architecture: any |
111 | Description: Linux kernel, version $version | 115 | Description: Linux kernel, version $version |
112 | This package contains the Linux kernel, modules and corresponding other | 116 | This package contains the Linux kernel, modules and corresponding other |
@@ -118,8 +122,24 @@ fi | |||
118 | chown -R root:root "$tmpdir" | 122 | chown -R root:root "$tmpdir" |
119 | chmod -R go-w "$tmpdir" | 123 | chmod -R go-w "$tmpdir" |
120 | 124 | ||
125 | # Do we have firmware? Move it out of the way and build it into a package. | ||
126 | if [ -e "$tmpdir/lib/firmware" ]; then | ||
127 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" | ||
128 | |||
129 | cat <<EOF >> debian/control | ||
130 | |||
131 | Package: $fwpackagename | ||
132 | Architecture: all | ||
133 | Description: Linux kernel firmware, version $version | ||
134 | This package contains firmware from the Linux kernel, version $version | ||
135 | EOF | ||
136 | |||
137 | dpkg-gencontrol -isp -p$fwpackagename -P"$fwdir" | ||
138 | dpkg --build "$fwdir" .. | ||
139 | fi | ||
140 | |||
121 | # Perform the final magic | 141 | # Perform the final magic |
122 | dpkg-gencontrol -isp | 142 | dpkg-gencontrol -isp -p$packagename |
123 | dpkg --build "$tmpdir" .. | 143 | dpkg --build "$tmpdir" .. |
124 | 144 | ||
125 | exit 0 | 145 | exit 0 |