From: Greg Kroah-Hartman Date: Wed, 11 Aug 2010 20:03:21 +0000 (-0700) Subject: .27 patches X-Git-Tag: v2.6.32.19~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e25e3cb49cade13b8c2fa2fe6db51616c198864c;p=thirdparty%2Fkernel%2Fstable-queue.git .27 patches --- diff --git a/queue-2.6.27/bdi-register-sysfs-bdi-device-only-once-per-queue.patch b/queue-2.6.27/bdi-register-sysfs-bdi-device-only-once-per-queue.patch new file mode 100644 index 00000000000..3aea1a87a95 --- /dev/null +++ b/queue-2.6.27/bdi-register-sysfs-bdi-device-only-once-per-queue.patch @@ -0,0 +1,46 @@ +From f1d0b063d993527754f062c589b73f125024d216 Mon Sep 17 00:00:00 2001 +From: Kay Sievers +Date: Tue, 2 Dec 2008 10:31:50 -0800 +Subject: bdi: register sysfs bdi device only once per queue + +From: Kay Sievers + +commit f1d0b063d993527754f062c589b73f125024d216 upstream. + +Devices which share the same queue, like floppies and mtd devices, get +registered multiple times in the bdi interface, but bdi accounts only the +last registered device of the devices sharing one queue. + +On remove, all earlier registered devices leak, stay around in sysfs, and +cause "duplicate filename" errors if the devices are re-created. + +This prevents the creation of multiple bdi interfaces per queue, and the +bdi device will carry the dev_t name of the block device which is the +first one registered, of the pool of devices using the same queue. + +[akpm@linux-foundation.org: add a WARN_ON so we know which drivers are misbehaving] +Tested-by: Peter Korsgaard +Acked-by: Peter Zijlstra +Signed-off-by: Kay Sievers +Cc: David Woodhouse +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman + +--- + mm/backing-dev.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -176,6 +176,9 @@ int bdi_register(struct backing_dev_info + int ret = 0; + struct device *dev; + ++ if (WARN_ON(bdi->dev)) ++ goto exit; ++ + va_start(args, fmt); + dev = device_create_vargs(bdi_class, parent, MKDEV(0, 0), bdi, fmt, args); + va_end(args); diff --git a/queue-2.6.27/ecryptfs-handle-ioctl-calls-with-unlocked-and-compat-functions.patch b/queue-2.6.27/ecryptfs-handle-ioctl-calls-with-unlocked-and-compat-functions.patch new file mode 100644 index 00000000000..327ec7f0501 --- /dev/null +++ b/queue-2.6.27/ecryptfs-handle-ioctl-calls-with-unlocked-and-compat-functions.patch @@ -0,0 +1,107 @@ +From c43f7b8fb03be8bcc579bfc4e6ab70eac887ab55 Mon Sep 17 00:00:00 2001 +From: Tyler Hicks +Date: Tue, 3 Nov 2009 11:45:11 -0600 +Subject: eCryptfs: Handle ioctl calls with unlocked and compat functions + +From: Tyler Hicks + +commit c43f7b8fb03be8bcc579bfc4e6ab70eac887ab55 upstream. + +Lower filesystems that only implemented unlocked_ioctl weren't being +passed ioctl calls because eCryptfs only checked for +lower_file->f_op->ioctl and returned -ENOTTY if it was NULL. + +eCryptfs shouldn't implement ioctl(), since it doesn't require the BKL. +This patch introduces ecryptfs_unlocked_ioctl() and +ecryptfs_compat_ioctl(), which passes the calls on to the lower file +system. + +https://bugs.launchpad.net/ecryptfs/+bug/469664 + +Reported-by: James Dupin +Signed-off-by: Tyler Hicks +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ecryptfs/file.c | 56 +++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 35 insertions(+), 21 deletions(-) + +--- a/fs/ecryptfs/file.c ++++ b/fs/ecryptfs/file.c +@@ -303,12 +303,40 @@ static int ecryptfs_fasync(int fd, struc + return rc; + } + +-static int ecryptfs_ioctl(struct inode *inode, struct file *file, +- unsigned int cmd, unsigned long arg); ++static long ++ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ struct file *lower_file = NULL; ++ long rc = -ENOTTY; ++ ++ if (ecryptfs_file_to_private(file)) ++ lower_file = ecryptfs_file_to_lower(file); ++ if (lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl) ++ rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); ++ return rc; ++} ++ ++#ifdef CONFIG_COMPAT ++static long ++ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ struct file *lower_file = NULL; ++ long rc = -ENOIOCTLCMD; ++ ++ if (ecryptfs_file_to_private(file)) ++ lower_file = ecryptfs_file_to_lower(file); ++ if (lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl) ++ rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); ++ return rc; ++} ++#endif + + const struct file_operations ecryptfs_dir_fops = { + .readdir = ecryptfs_readdir, +- .ioctl = ecryptfs_ioctl, ++ .unlocked_ioctl = ecryptfs_unlocked_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = ecryptfs_compat_ioctl, ++#endif + .mmap = generic_file_mmap, + .open = ecryptfs_open, + .flush = ecryptfs_flush, +@@ -325,7 +353,10 @@ const struct file_operations ecryptfs_ma + .write = do_sync_write, + .aio_write = generic_file_aio_write, + .readdir = ecryptfs_readdir, +- .ioctl = ecryptfs_ioctl, ++ .unlocked_ioctl = ecryptfs_unlocked_ioctl, ++#ifdef CONFIG_COMPAT ++ .compat_ioctl = ecryptfs_compat_ioctl, ++#endif + .mmap = generic_file_mmap, + .open = ecryptfs_open, + .flush = ecryptfs_flush, +@@ -334,20 +365,3 @@ const struct file_operations ecryptfs_ma + .fasync = ecryptfs_fasync, + .splice_read = generic_file_splice_read, + }; +- +-static int +-ecryptfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, +- unsigned long arg) +-{ +- int rc = 0; +- struct file *lower_file = NULL; +- +- if (ecryptfs_file_to_private(file)) +- lower_file = ecryptfs_file_to_lower(file); +- if (lower_file && lower_file->f_op && lower_file->f_op->ioctl) +- rc = lower_file->f_op->ioctl(ecryptfs_inode_to_lower(inode), +- lower_file, cmd, arg); +- else +- rc = -ENOTTY; +- return rc; +-} diff --git a/queue-2.6.27/fs-ecryptfs-file.c-introduce-missing-free.patch b/queue-2.6.27/fs-ecryptfs-file.c-introduce-missing-free.patch new file mode 100644 index 00000000000..0f4c2e9a481 --- /dev/null +++ b/queue-2.6.27/fs-ecryptfs-file.c-introduce-missing-free.patch @@ -0,0 +1,80 @@ +From ceeab92971e8af05c1e81a4ff2c271124b55bb9b Mon Sep 17 00:00:00 2001 +From: Julia Lawall +Date: Fri, 6 Aug 2010 22:58:49 +0200 +Subject: fs/ecryptfs/file.c: introduce missing free + +From: Julia Lawall + +commit ceeab92971e8af05c1e81a4ff2c271124b55bb9b upstream. + +The comments in the code indicate that file_info should be released if the +function fails. This releasing is done at the label out_free, not out. + +The semantic match that finds this problem is as follows: +(http://www.emn.fr/x-info/coccinelle/) + +// +@r exists@ +local idexpression x; +statement S; +expression E; +identifier f,f1,l; +position p1,p2; +expression *ptr != NULL; +@@ + +x@p1 = kmem_cache_zalloc(...); +... +if (x == NULL) S +<... when != x + when != if (...) { <+...x...+> } +( +x->f1 = E +| + (x->f1 == NULL || ...) +| + f(...,x->f1,...) +) +...> +( + return <+...x...+>; +| + return@p2 ...; +) + +@script:python@ +p1 << r.p1; +p2 << r.p2; +@@ + +print "* file: %s kmem_cache_zalloc %s" % (p1[0].file,p1[0].line) +// + +Signed-off-by: Julia Lawall +Signed-off-by: Tyler Hicks +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ecryptfs/file.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/ecryptfs/file.c ++++ b/fs/ecryptfs/file.c +@@ -199,7 +199,7 @@ static int ecryptfs_open(struct inode *i + "the persistent file for the dentry with name " + "[%s]; rc = [%d]\n", __func__, + ecryptfs_dentry->d_name.name, rc); +- goto out; ++ goto out_free; + } + } + if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY) +@@ -207,7 +207,7 @@ static int ecryptfs_open(struct inode *i + rc = -EPERM; + printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs " + "file must hence be opened RO\n", __func__); +- goto out; ++ goto out_free; + } + ecryptfs_set_file_lower( + file, ecryptfs_inode_to_private(inode)->lower_file); diff --git a/queue-2.6.27/jfs-don-t-allow-os2-xattr-namespace-overlap-with-others.patch b/queue-2.6.27/jfs-don-t-allow-os2-xattr-namespace-overlap-with-others.patch new file mode 100644 index 00000000000..0b0ea74a4ca --- /dev/null +++ b/queue-2.6.27/jfs-don-t-allow-os2-xattr-namespace-overlap-with-others.patch @@ -0,0 +1,162 @@ +From aca0fa34bdaba39bfddddba8ca70dba4782e8fe6 Mon Sep 17 00:00:00 2001 +From: Dave Kleikamp +Date: Mon, 9 Aug 2010 15:57:38 -0500 +Subject: jfs: don't allow os2 xattr namespace overlap with others + +From: Dave Kleikamp + +commit aca0fa34bdaba39bfddddba8ca70dba4782e8fe6 upstream. + +It's currently possible to bypass xattr namespace access rules by +prefixing valid xattr names with "os2.", since the os2 namespace stores +extended attributes in a legacy format with no prefix. + +This patch adds checking to deny access to any valid namespace prefix +following "os2.". + +Signed-off-by: Dave Kleikamp +Reported-by: Sergey Vlasov +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/jfs/xattr.c | 87 ++++++++++++++++++++++++--------------------------------- + 1 file changed, 38 insertions(+), 49 deletions(-) + +--- a/fs/jfs/xattr.c ++++ b/fs/jfs/xattr.c +@@ -85,46 +85,25 @@ struct ea_buffer { + #define EA_MALLOC 0x0008 + + ++static int is_known_namespace(const char *name) ++{ ++ if (strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) && ++ strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && ++ strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) && ++ strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN)) ++ return false; ++ ++ return true; ++} ++ + /* + * These three routines are used to recognize on-disk extended attributes + * that are in a recognized namespace. If the attribute is not recognized, + * "os2." is prepended to the name + */ +-static inline int is_os2_xattr(struct jfs_ea *ea) ++static int is_os2_xattr(struct jfs_ea *ea) + { +- /* +- * Check for "system." +- */ +- if ((ea->namelen >= XATTR_SYSTEM_PREFIX_LEN) && +- !strncmp(ea->name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) +- return false; +- /* +- * Check for "user." +- */ +- if ((ea->namelen >= XATTR_USER_PREFIX_LEN) && +- !strncmp(ea->name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) +- return false; +- /* +- * Check for "security." +- */ +- if ((ea->namelen >= XATTR_SECURITY_PREFIX_LEN) && +- !strncmp(ea->name, XATTR_SECURITY_PREFIX, +- XATTR_SECURITY_PREFIX_LEN)) +- return false; +- /* +- * Check for "trusted." +- */ +- if ((ea->namelen >= XATTR_TRUSTED_PREFIX_LEN) && +- !strncmp(ea->name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN)) +- return false; +- /* +- * Add any other valid namespace prefixes here +- */ +- +- /* +- * We assume it's OS/2's flat namespace +- */ +- return true; ++ return !is_known_namespace(ea->name); + } + + static inline int name_size(struct jfs_ea *ea) +@@ -768,13 +747,23 @@ static int can_set_xattr(struct inode *i + if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) + return can_set_system_xattr(inode, name, value, value_len); + ++ if (!strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)) { ++ /* ++ * This makes sure that we aren't trying to set an ++ * attribute in a different namespace by prefixing it ++ * with "os2." ++ */ ++ if (is_known_namespace(name + XATTR_OS2_PREFIX_LEN)) ++ return -EOPNOTSUPP; ++ return 0; ++ } ++ + /* + * Don't allow setting an attribute in an unknown namespace. + */ + if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) && + strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) && +- strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && +- strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)) ++ strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) + return -EOPNOTSUPP; + + return 0; +@@ -956,19 +945,8 @@ ssize_t __jfs_getxattr(struct inode *ino + int xattr_size; + ssize_t size; + int namelen = strlen(name); +- char *os2name = NULL; + char *value; + +- if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { +- os2name = kmalloc(namelen - XATTR_OS2_PREFIX_LEN + 1, +- GFP_KERNEL); +- if (!os2name) +- return -ENOMEM; +- strcpy(os2name, name + XATTR_OS2_PREFIX_LEN); +- name = os2name; +- namelen -= XATTR_OS2_PREFIX_LEN; +- } +- + down_read(&JFS_IP(inode)->xattr_sem); + + xattr_size = ea_get(inode, &ea_buf, 0); +@@ -1006,8 +984,6 @@ ssize_t __jfs_getxattr(struct inode *ino + out: + up_read(&JFS_IP(inode)->xattr_sem); + +- kfree(os2name); +- + return size; + } + +@@ -1016,6 +992,19 @@ ssize_t jfs_getxattr(struct dentry *dent + { + int err; + ++ if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { ++ /* ++ * skip past "os2." prefix ++ */ ++ name += XATTR_OS2_PREFIX_LEN; ++ /* ++ * Don't allow retrieving properly prefixed attributes ++ * by prepending them with "os2." ++ */ ++ if (is_known_namespace(name)) ++ return -EOPNOTSUPP; ++ } ++ + err = __jfs_getxattr(dentry->d_inode, name, data, buf_size); + + return err; diff --git a/queue-2.6.27/mm-backing-dev.c-remove-recently-added-warn_on.patch b/queue-2.6.27/mm-backing-dev.c-remove-recently-added-warn_on.patch new file mode 100644 index 00000000000..9be73413d12 --- /dev/null +++ b/queue-2.6.27/mm-backing-dev.c-remove-recently-added-warn_on.patch @@ -0,0 +1,36 @@ +From 69fc208be5b7eb18d22d1eca185b201400fd5ffc Mon Sep 17 00:00:00 2001 +From: Andrew Morton +Date: Tue, 9 Dec 2008 13:14:06 -0800 +Subject: mm/backing-dev.c: remove recently-added WARN_ON() + +From: Andrew Morton + +commit 69fc208be5b7eb18d22d1eca185b201400fd5ffc upstream. + +On second thoughts, this is just going to disturb people while telling us +things which we already knew. + +Cc: Peter Korsgaard +Cc: Peter Zijlstra +Cc: Kay Sievers +Cc: David Woodhouse +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Cc: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman + +--- + mm/backing-dev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/backing-dev.c ++++ b/mm/backing-dev.c +@@ -176,7 +176,7 @@ int bdi_register(struct backing_dev_info + int ret = 0; + struct device *dev; + +- if (WARN_ON(bdi->dev)) ++ if (bdi->dev) /* The driver needs to use separate queues per device */ + goto exit; + + va_start(args, fmt); diff --git a/queue-2.6.27/series b/queue-2.6.27/series index 70a4190175f..b343909af22 100644 --- a/queue-2.6.27/series +++ b/queue-2.6.27/series @@ -2,3 +2,10 @@ nvram-fix-write-beyond-end-condition-prove-to-gcc-copy-is-safe.patch splice-fix-misuse-of-splice_f_nonblock.patch pci-disable-msi-on-via-k8m800.patch md-raid10-fix-deadlock-with-unaligned-read-during-resync.patch +ecryptfs-handle-ioctl-calls-with-unlocked-and-compat-functions.patch +fs-ecryptfs-file.c-introduce-missing-free.patch +signalfd-fill-in-ssi_int-for-posix-timers-and-message-queues.patch +jfs-don-t-allow-os2-xattr-namespace-overlap-with-others.patch +xen-drop-xen_sched_clock-in-favour-of-using-plain-wallclock-time.patch +bdi-register-sysfs-bdi-device-only-once-per-queue.patch +mm-backing-dev.c-remove-recently-added-warn_on.patch diff --git a/queue-2.6.27/signalfd-fill-in-ssi_int-for-posix-timers-and-message-queues.patch b/queue-2.6.27/signalfd-fill-in-ssi_int-for-posix-timers-and-message-queues.patch new file mode 100644 index 00000000000..644e5f09ef0 --- /dev/null +++ b/queue-2.6.27/signalfd-fill-in-ssi_int-for-posix-timers-and-message-queues.patch @@ -0,0 +1,53 @@ +From a2a20c412c86e0bb46a9ab0dd31bcfe6d201b913 Mon Sep 17 00:00:00 2001 +From: Nathan Lynch +Date: Tue, 10 Aug 2010 18:03:08 -0700 +Subject: signalfd: fill in ssi_int for posix timers and message queues + +From: Nathan Lynch + +commit a2a20c412c86e0bb46a9ab0dd31bcfe6d201b913 upstream. + +If signalfd is used to consume a signal generated by a POSIX interval +timer or POSIX message queue, the ssi_int field does not reflect the data +(sigevent->sigev_value) supplied to timer_create(2) or mq_notify(3). (The +ssi_ptr field, however, is filled in.) + +This behavior differs from signalfd's treatment of sigqueue-generated +signals -- see the default case in signalfd_copyinfo. It also gives +results that differ from the case when a signal is handled conventionally +via a sigaction-registered handler. + +So, set signalfd_siginfo->ssi_int in the remaining cases (__SI_TIMER, +__SI_MESGQ) where ssi_ptr is set. + +akpm: a non-back-compatible change. Merge into -stable to minimise the +number of kernels which are in the field and which miss this feature. + +Signed-off-by: Nathan Lynch +Acked-by: Davide Libenzi +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/signalfd.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/signalfd.c ++++ b/fs/signalfd.c +@@ -87,6 +87,7 @@ static int signalfd_copyinfo(struct sign + err |= __put_user(kinfo->si_tid, &uinfo->ssi_tid); + err |= __put_user(kinfo->si_overrun, &uinfo->ssi_overrun); + err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr); ++ err |= __put_user(kinfo->si_int, &uinfo->ssi_int); + break; + case __SI_POLL: + err |= __put_user(kinfo->si_band, &uinfo->ssi_band); +@@ -110,6 +111,7 @@ static int signalfd_copyinfo(struct sign + err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid); + err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid); + err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr); ++ err |= __put_user(kinfo->si_int, &uinfo->ssi_int); + break; + default: + /* diff --git a/queue-2.6.27/xen-drop-xen_sched_clock-in-favour-of-using-plain-wallclock-time.patch b/queue-2.6.27/xen-drop-xen_sched_clock-in-favour-of-using-plain-wallclock-time.patch new file mode 100644 index 00000000000..dfcd265e426 --- /dev/null +++ b/queue-2.6.27/xen-drop-xen_sched_clock-in-favour-of-using-plain-wallclock-time.patch @@ -0,0 +1,124 @@ +From 8a22b9996b001c88f2bfb54c6de6a05fc39e177a Mon Sep 17 00:00:00 2001 +From: Jeremy Fitzhardinge +Date: Mon, 12 Jul 2010 11:49:59 -0700 +Subject: xen: drop xen_sched_clock in favour of using plain wallclock time + +From: Jeremy Fitzhardinge + +commit 8a22b9996b001c88f2bfb54c6de6a05fc39e177a upstream. + +xen_sched_clock only counts unstolen time. In principle this should +be useful to the Linux scheduler so that it knows how much time a process +actually consumed. But in practice this doesn't work very well as the +scheduler expects the sched_clock time to be synchronized between +cpus. It also uses sched_clock to measure the time a task spends +sleeping, in which case "unstolen time" isn't meaningful. + +So just use plain xen_clocksource_read to return wallclock nanoseconds +for sched_clock. + +Signed-off-by: Jeremy Fitzhardinge +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/xen/enlighten.c | 2 +- + arch/x86/xen/time.c | 43 +------------------------------------------ + arch/x86/xen/xen-ops.h | 3 ++- + 3 files changed, 4 insertions(+), 44 deletions(-) + +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -1179,7 +1179,7 @@ static const struct pv_time_ops xen_time + .set_wallclock = xen_set_wallclock, + .get_wallclock = xen_get_wallclock, + .get_tsc_khz = xen_tsc_khz, +- .sched_clock = xen_sched_clock, ++ .sched_clock = xen_clocksource_read, + }; + + static const struct pv_cpu_ops xen_cpu_ops __initdata = { +--- a/arch/x86/xen/time.c ++++ b/arch/x86/xen/time.c +@@ -30,8 +30,6 @@ + #define TIMER_SLOP 100000 + #define NS_PER_TICK (1000000000LL / HZ) + +-static cycle_t xen_clocksource_read(void); +- + /* runstate info updated by Xen */ + static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate); + +@@ -158,45 +156,6 @@ static void do_stolen_accounting(void) + account_steal_time(idle_task(smp_processor_id()), ticks); + } + +-/* +- * Xen sched_clock implementation. Returns the number of unstolen +- * nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED +- * states. +- */ +-unsigned long long xen_sched_clock(void) +-{ +- struct vcpu_runstate_info state; +- cycle_t now; +- u64 ret; +- s64 offset; +- +- /* +- * Ideally sched_clock should be called on a per-cpu basis +- * anyway, so preempt should already be disabled, but that's +- * not current practice at the moment. +- */ +- preempt_disable(); +- +- now = xen_clocksource_read(); +- +- get_runstate_snapshot(&state); +- +- WARN_ON(state.state != RUNSTATE_running); +- +- offset = now - state.state_entry_time; +- if (offset < 0) +- offset = 0; +- +- ret = state.time[RUNSTATE_blocked] + +- state.time[RUNSTATE_running] + +- offset; +- +- preempt_enable(); +- +- return ret; +-} +- +- + /* Get the TSC speed from Xen */ + unsigned long xen_tsc_khz(void) + { +@@ -213,7 +172,7 @@ unsigned long xen_tsc_khz(void) + return xen_khz; + } + +-static cycle_t xen_clocksource_read(void) ++cycle_t xen_clocksource_read(void) + { + struct pvclock_vcpu_time_info *src; + cycle_t ret; +--- a/arch/x86/xen/xen-ops.h ++++ b/arch/x86/xen/xen-ops.h +@@ -3,6 +3,7 @@ + + #include + #include ++#include + #include + + /* These are code, but not functions. Defined in entry.S */ +@@ -37,7 +38,7 @@ unsigned long xen_tsc_khz(void); + void __init xen_time_init(void); + unsigned long xen_get_wallclock(void); + int xen_set_wallclock(unsigned long time); +-unsigned long long xen_sched_clock(void); ++cycle_t xen_clocksource_read(void); + + irqreturn_t xen_debug_interrupt(int irq, void *dev_id); +