diff options
-rw-r--r-- | Documentation/lguest/lguest.c | 8 | ||||
-rw-r--r-- | drivers/lguest/lguest_device.c | 8 | ||||
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 2 | ||||
-rw-r--r-- | drivers/xen/manage.c | 2 | ||||
-rw-r--r-- | include/linux/stop_machine.h | 19 | ||||
-rw-r--r-- | kernel/module.c | 2 |
6 files changed, 20 insertions, 21 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 655414821ed..7228369d101 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -895,6 +895,9 @@ static void handle_console_output(int fd, struct virtqueue *vq, bool timeout) | |||
895 | } | 895 | } |
896 | } | 896 | } |
897 | 897 | ||
898 | /* This is called when we no longer want to hear about Guest changes to a | ||
899 | * virtqueue. This is more efficient in high-traffic cases, but it means we | ||
900 | * have to set a timer to check if any more changes have occurred. */ | ||
898 | static void block_vq(struct virtqueue *vq) | 901 | static void block_vq(struct virtqueue *vq) |
899 | { | 902 | { |
900 | struct itimerval itm; | 903 | struct itimerval itm; |
@@ -939,6 +942,11 @@ static void handle_net_output(int fd, struct virtqueue *vq, bool timeout) | |||
939 | if (!timeout && num) | 942 | if (!timeout && num) |
940 | block_vq(vq); | 943 | block_vq(vq); |
941 | 944 | ||
945 | /* We never quite know how long should we wait before we check the | ||
946 | * queue again for more packets. We start at 500 microseconds, and if | ||
947 | * we get fewer packets than last time, we assume we made the timeout | ||
948 | * too small and increase it by 10 microseconds. Otherwise, we drop it | ||
949 | * by one microsecond every time. It seems to work well enough. */ | ||
942 | if (timeout) { | 950 | if (timeout) { |
943 | if (num < last_timeout_num) | 951 | if (num < last_timeout_num) |
944 | timeout_usec += 10; | 952 | timeout_usec += 10; |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 37344aaee22..a661bbdae3d 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -98,6 +98,10 @@ static u32 lg_get_features(struct virtio_device *vdev) | |||
98 | return features; | 98 | return features; |
99 | } | 99 | } |
100 | 100 | ||
101 | /* The virtio core takes the features the Host offers, and copies the | ||
102 | * ones supported by the driver into the vdev->features array. Once | ||
103 | * that's all sorted out, this routine is called so we can tell the | ||
104 | * Host which features we understand and accept. */ | ||
101 | static void lg_finalize_features(struct virtio_device *vdev) | 105 | static void lg_finalize_features(struct virtio_device *vdev) |
102 | { | 106 | { |
103 | unsigned int i, bits; | 107 | unsigned int i, bits; |
@@ -108,6 +112,10 @@ static void lg_finalize_features(struct virtio_device *vdev) | |||
108 | /* Give virtio_ring a chance to accept features. */ | 112 | /* Give virtio_ring a chance to accept features. */ |
109 | vring_transport_features(vdev); | 113 | vring_transport_features(vdev); |
110 | 114 | ||
115 | /* The vdev->feature array is a Linux bitmask: this isn't the | ||
116 | * same as a the simple array of bits used by lguest devices | ||
117 | * for features. So we do this slow, manual conversion which is | ||
118 | * completely general. */ | ||
111 | memset(out_features, 0, desc->feature_len); | 119 | memset(out_features, 0, desc->feature_len); |
112 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; | 120 | bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; |
113 | for (i = 0; i < bits; i++) { | 121 | for (i = 0; i < bits; i++) { |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index bfef604160d..62eab43152d 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -158,7 +158,7 @@ static inline s64 towards_target(struct virtio_balloon *vb) | |||
158 | vb->vdev->config->get(vb->vdev, | 158 | vb->vdev->config->get(vb->vdev, |
159 | offsetof(struct virtio_balloon_config, num_pages), | 159 | offsetof(struct virtio_balloon_config, num_pages), |
160 | &v, sizeof(v)); | 160 | &v, sizeof(v)); |
161 | return v - vb->num_pages; | 161 | return (s64)v - vb->num_pages; |
162 | } | 162 | } |
163 | 163 | ||
164 | static void update_balloon_size(struct virtio_balloon *vb) | 164 | static void update_balloon_size(struct virtio_balloon *vb) |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index a5bc91ae6ff..d0e87cbe157 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -102,7 +102,7 @@ static void do_suspend(void) | |||
102 | /* XXX use normal device tree? */ | 102 | /* XXX use normal device tree? */ |
103 | xenbus_suspend(); | 103 | xenbus_suspend(); |
104 | 104 | ||
105 | err = stop_machine_run(xen_suspend, &cancelled, 0); | 105 | err = stop_machine(xen_suspend, &cancelled, &cpumask_of_cpu(0)); |
106 | if (err) { | 106 | if (err) { |
107 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); | 107 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); |
108 | goto out; | 108 | goto out; |
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index f1cb0ba6d71..faf1519b5ad 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h | |||
@@ -3,16 +3,13 @@ | |||
3 | /* "Bogolock": stop the entire machine, disable interrupts. This is a | 3 | /* "Bogolock": stop the entire machine, disable interrupts. This is a |
4 | very heavy lock, which is equivalent to grabbing every spinlock | 4 | very heavy lock, which is equivalent to grabbing every spinlock |
5 | (and more). So the "read" side to such a lock is anything which | 5 | (and more). So the "read" side to such a lock is anything which |
6 | diables preeempt. */ | 6 | disables preeempt. */ |
7 | #include <linux/cpu.h> | 7 | #include <linux/cpu.h> |
8 | #include <linux/cpumask.h> | 8 | #include <linux/cpumask.h> |
9 | #include <asm/system.h> | 9 | #include <asm/system.h> |
10 | 10 | ||
11 | #if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) | 11 | #if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) |
12 | 12 | ||
13 | /* Deprecated, but useful for transition. */ | ||
14 | #define ALL_CPUS ~0U | ||
15 | |||
16 | /** | 13 | /** |
17 | * stop_machine: freeze the machine on all CPUs and run this function | 14 | * stop_machine: freeze the machine on all CPUs and run this function |
18 | * @fn: the function to run | 15 | * @fn: the function to run |
@@ -50,18 +47,4 @@ static inline int stop_machine(int (*fn)(void *), void *data, | |||
50 | return ret; | 47 | return ret; |
51 | } | 48 | } |
52 | #endif /* CONFIG_SMP */ | 49 | #endif /* CONFIG_SMP */ |
53 | |||
54 | static inline int __deprecated stop_machine_run(int (*fn)(void *), void *data, | ||
55 | unsigned int cpu) | ||
56 | { | ||
57 | /* If they don't care which cpu fn runs on, just pick one. */ | ||
58 | if (cpu == NR_CPUS) | ||
59 | return stop_machine(fn, data, NULL); | ||
60 | else if (cpu == ~0U) | ||
61 | return stop_machine(fn, data, &cpu_possible_map); | ||
62 | else { | ||
63 | cpumask_t cpus = cpumask_of_cpu(cpu); | ||
64 | return stop_machine(fn, data, &cpus); | ||
65 | } | ||
66 | } | ||
67 | #endif /* _LINUX_STOP_MACHINE */ | 50 | #endif /* _LINUX_STOP_MACHINE */ |
diff --git a/kernel/module.c b/kernel/module.c index 08864d257eb..9db11911e04 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1799,7 +1799,7 @@ static void *module_alloc_update_bounds(unsigned long size) | |||
1799 | 1799 | ||
1800 | /* Allocate and load the module: note that size of section 0 is always | 1800 | /* Allocate and load the module: note that size of section 0 is always |
1801 | zero, and we rely on this for optional sections. */ | 1801 | zero, and we rely on this for optional sections. */ |
1802 | static struct module *load_module(void __user *umod, | 1802 | static noinline struct module *load_module(void __user *umod, |
1803 | unsigned long len, | 1803 | unsigned long len, |
1804 | const char __user *uargs) | 1804 | const char __user *uargs) |
1805 | { | 1805 | { |