From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org, greg@kroah.com
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
"Serge E. Hallyn" <serge.hallyn@canonical.com>,
Zachary Amsden <zamsden@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
avi@redhat.com
Subject: [141/143] x86: pvclock: Move scale_delta into common header
Date: Thu, 05 May 2011 17:22:06 -0700 [thread overview]
Message-ID: <20110506002219.104537530@clark.kroah.org> (raw)
In-Reply-To: <20110506002311.GA15354@kroah.com>
2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Zachary Amsden <zamsden@redhat.com>
(cherry-picked from commit 347bb4448c2155eb2310923ccaa4be5677649003)
The scale_delta function for shift / multiply with 31-bit
precision moves to a common header so it can be used by both
kernel and kvm module.
Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
BugLink: http://bugs.launchpad.net/bugs/714335
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
arch/x86/include/asm/pvclock.h | 38 ++++++++++++++++++++++++++++++++++++++
arch/x86/kernel/pvclock.c | 3 ++-
2 files changed, 40 insertions(+), 1 deletion(-)
--- a/arch/x86/include/asm/pvclock.h
+++ b/arch/x86/include/asm/pvclock.h
@@ -12,4 +12,42 @@ void pvclock_read_wallclock(struct pvclo
struct timespec *ts);
void pvclock_resume(void);
+/*
+ * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
+ * yielding a 64-bit result.
+ */
+static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
+{
+ u64 product;
+#ifdef __i386__
+ u32 tmp1, tmp2;
+#endif
+
+ if (shift < 0)
+ delta >>= -shift;
+ else
+ delta <<= shift;
+
+#ifdef __i386__
+ __asm__ (
+ "mul %5 ; "
+ "mov %4,%%eax ; "
+ "mov %%edx,%4 ; "
+ "mul %5 ; "
+ "xor %5,%5 ; "
+ "add %4,%%eax ; "
+ "adc %5,%%edx ; "
+ : "=A" (product), "=r" (tmp1), "=r" (tmp2)
+ : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
+#elif defined(__x86_64__)
+ __asm__ (
+ "mul %%rdx ; shrd $32,%%rdx,%%rax"
+ : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
+#else
+#error implement me!
+#endif
+
+ return product;
+}
+
#endif /* _ASM_X86_PVCLOCK_H */
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -74,7 +74,8 @@ static inline u64 scale_delta(u64 delta,
static u64 pvclock_get_nsec_offset(struct pvclock_shadow_time *shadow)
{
u64 delta = native_read_tsc() - shadow->tsc_timestamp;
- return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift);
+ return pvclock_scale_delta(delta, shadow->tsc_to_nsec_mul,
+ shadow->tsc_shift);
}
/*
next prev parent reply other threads:[~2011-05-06 0:26 UTC|newest]
Thread overview: 144+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 0:23 [000/143] 2.6.32.40-longterm review Greg KH
2011-05-06 0:19 ` [001/143] ath: add missing regdomain pair 0x5c mapping Greg KH
2011-05-06 0:19 ` [002/143] block, blk-sysfs: Fix an err return path in blk_register_queue() Greg KH
2011-05-06 0:19 ` [003/143] p54: Initialize extra_len in p54_tx_80211 Greg KH
2011-05-06 0:19 ` [004/143] intel-iommu: Unlink domain from iommu Greg KH
2011-05-06 0:19 ` [005/143] intel-iommu: Fix get_domain_for_dev() error path Greg KH
2011-05-06 0:19 ` [006/143] drm/radeon/kms: fix bad shift in atom iio table parser Greg KH
2011-05-06 0:19 ` [007/143] NFS: nfs_wcc_update_inode() should set nfsi->attr_gencount Greg KH
2011-05-06 0:19 ` [008/143] serial/imx: read cts state only after acking cts change irq Greg KH
2011-05-06 0:19 ` [009/143] ASoC: Fix output PGA enabling in wm_hubs CODECs Greg KH
2011-05-06 0:19 ` [010/143] kconfig: Avoid buffer underrun in choice input Greg KH
2011-05-06 0:19 ` [011/143] UBIFS: fix master node recovery Greg KH
2011-05-06 0:19 ` [012/143] Remove extra struct page member from the buffer info structure Greg KH
2011-05-06 0:19 ` [013/143] [S390] dasd: correct device table Greg KH
2011-05-06 0:19 ` [014/143] iwlagn: Support new 5000 microcode Greg KH
2011-05-06 0:20 ` [015/143] atl1c: duplicate atl1c_get_tpd Greg KH
2011-05-06 0:20 ` [016/143] udp: Fix bogus UFO packet generation Greg KH
2011-05-06 0:20 ` [017/143] [PARISC] slub: fix panic with DISCONTIGMEM Greg KH
2011-05-06 0:20 ` [018/143] [PARISC] set memory ranges in N_NORMAL_MEMORY when onlined Greg KH
2011-05-06 0:20 ` [019/143] [media] FLEXCOP-PCI: fix __xlate_proc_name-warning for flexcop-pci Greg KH
2011-05-06 0:20 ` [020/143] m68k/mm: Set all online nodes in N_NORMAL_MEMORY Greg KH
2011-05-06 0:20 ` [021/143] nfs: dont lose MS_SYNCHRONOUS on remount of noac mount Greg KH
2011-05-06 0:20 ` [022/143] NFSv4.1: Ensure state manager thread dies on last umount Greg KH
2011-05-06 0:20 ` [023/143] agp: fix arbitrary kernel memory writes Greg KH
2011-05-06 0:20 ` [024/143] agp: fix OOM and buffer overflow Greg KH
2011-05-06 0:20 ` [025/143] Input: xen-kbdfront - fix mouse getting stuck after save/restore Greg KH
2011-05-06 0:20 ` [026/143] [SCSI] pmcraid: reject negative request size Greg KH
2011-05-06 0:20 ` [027/143] [SCSI] mpt2sas: prevent heap overflows and unchecked reads Greg KH
2011-05-06 0:20 ` [028/143] [SCSI] put stricter guards on queue dead checks Greg KH
2011-05-06 0:20 ` [029/143] mmc: sdhci-pci: Fix error case in sdhci_pci_probe_slot() Greg KH
2011-05-06 0:20 ` [030/143] mmc: sdhci: Check mrq->cmd in sdhci_tasklet_finish Greg KH
2011-05-06 0:20 ` [031/143] mmc: sdhci: Check mrq != NULL " Greg KH
2011-05-06 0:20 ` [032/143] USB: fix regression in usbip by setting has_tt flag Greg KH
2011-05-06 0:20 ` [033/143] x86, AMD: Fix APIC timer erratum 400 affecting K8 Rev.A-E processors Greg KH
2011-05-06 0:20 ` [034/143] af_unix: Only allow recv on connected seqpacket sockets Greg KH
2011-05-06 0:20 ` [035/143] ARM: 6891/1: prevent heap corruption in OABI semtimedop Greg KH
2011-05-06 0:20 ` [036/143] i8k: Tell gcc that *regs gets clobbered Greg KH
2011-05-06 0:20 ` [037/143] Fix gcc 4.5.1 miscompiling drivers/char/i8k.c (again) Greg KH
2011-05-06 0:20 ` [038/143] Open with O_CREAT flag set fails to open existing files on non writable directories Greg KH
2011-05-06 0:20 ` [039/143] can: Add missing socket check in can/bcm release Greg KH
2011-05-06 0:20 ` [040/143] fs/partitions/ldm.c: fix oops caused by corrupted partition table Greg KH
2011-05-06 0:20 ` [041/143] netxen: module firmware hints Greg KH
2011-05-06 0:20 ` [042/143] bnx2x: declare MODULE_FIRMWARE Greg KH
2011-05-06 0:20 ` [043/143] cxgb3: " Greg KH
2011-05-06 0:20 ` [044/143] myri10ge: " Greg KH
2011-05-06 0:20 ` [045/143] netx: " Greg KH
2011-05-06 0:20 ` [046/143] pcnet-cs: " Greg KH
2011-05-06 0:20 ` [047/143] spider-net: " Greg KH
2011-05-06 0:20 ` [048/143] tms380tr: " Greg KH
2011-05-06 0:20 ` [049/143] Input: Add support of Synaptics Clickpad device Greg KH
2011-05-06 0:20 ` [050/143] Input: elantech - do not advertise relative events Greg KH
2011-05-06 0:20 ` [051/143] Input: elantech - fix firmware version check Greg KH
2011-05-06 0:20 ` [052/143] Input: elantech - allow forcing Elantech protocol Greg KH
2011-05-06 0:20 ` [053/143] Input: elantech - ignore high bits in the position coordinates Greg KH
2011-05-06 0:20 ` [054/143] Input: elantech - use all 3 bytes when checking version Greg KH
2011-05-06 0:20 ` [055/143] Input: elantech - relax signature checks Greg KH
2011-05-06 0:20 ` [056/143] Input: elantech - discard the first 2 positions on some firmwares Greg KH
2011-05-06 0:20 ` [057/143] Staging: rtl8192su: check for skb == NULL Greg KH
2011-05-06 0:20 ` [058/143] Staging: rtl8192su: Clean up in case of an error in module initialisation Greg KH
2011-05-06 0:20 ` [059/143] Staging: rtl8192su: Fix procfs code for interfaces not named wlan0 Greg KH
2011-05-06 0:20 ` [060/143] Staging: rtl8192su: remove device ids Greg KH
2011-05-06 0:20 ` [061/143] Staging: rtl8192su: add " Greg KH
2011-05-06 0:20 ` [062/143] USB: retain USB device power/wakeup setting across reconfiguration Greg KH
2011-05-06 0:20 ` [063/143] USB: dont enable remote wakeup by default Greg KH
2011-05-06 0:20 ` [064/143] USB: teach "devices" file about Wireless and SuperSpeed USB Greg KH
2011-05-06 0:20 ` [065/143] GFS2: Clean up gfs2_adjust_quota() and do_glock() Greg KH
2011-05-06 0:20 ` [066/143] GFS2: Fix writing to non-page aligned gfs2_quota structures Greg KH
2011-05-06 0:20 ` [067/143] GFS2: BUG in gfs2_adjust_quota Greg KH
2011-05-06 0:20 ` [068/143] SUNRPC: fix NFS client over TCP hangs due to packet loss (Bug 16494) Greg KH
2011-05-06 0:20 ` [069/143] nfs4: Ensure that ACL pages sent over NFS were not allocated from the slab (v3) Greg KH
2011-05-06 0:20 ` [070/143] nfs: fix compilation warning Greg KH
2011-05-06 0:20 ` [071/143] Fix corrupted OSF partition table parsing Greg KH
2011-05-06 0:20 ` [072/143] Increase OSF partition limit from 8 to 18 Greg KH
2011-05-06 0:20 ` [073/143] Please add support for Microsoft MN-120 PCMCIA network card Greg KH
2011-05-06 0:20 ` [074/143] hwmon: (applesmc) Add iMac9,1 and MacBookPro2,2 support Greg KH
2011-05-06 0:21 ` [075/143] hwmon: (applesmc) Add support for MacBook Pro 5,3 and 5,4 Greg KH
2011-05-06 0:21 ` [076/143] hwmon: (applesmc) Add generic support for MacBook Pro 6 Greg KH
2011-05-06 0:21 ` [077/143] hwmon: (applesmc) Add generic support for MacBook Pro 7 Greg KH
2011-05-06 0:21 ` [078/143] hwmon: (applesmc) Add MacBookAir3,1(3,2) support Greg KH
2011-05-06 0:21 ` [079/143] ALSA: emux: Add trivial compat ioctl handler Greg KH
2011-05-06 0:21 ` [080/143] ALSA: powermac - Reverse HP detection on G4 DA Greg KH
2011-05-06 0:21 ` [081/143] ALSA: powermac - Lineout " Greg KH
2011-05-06 0:21 ` [082/143] ALSA: hda - Add support for the new 27 inch IMacs Greg KH
2011-05-06 0:21 ` [083/143] ALSA: hda - MacBookPro 5,3 line-in support Greg KH
2011-05-06 0:21 ` [084/143] ALSA: hda - Add model=mbp55 entry for MacBookPro 7,1 Greg KH
2011-05-06 0:21 ` [085/143] ALSA: hda - MacBookAir3,1(3,2) alsa support Greg KH
2011-05-06 0:21 ` [086/143] virtio_net: Add schedule check to napi_enable call Greg KH
2011-05-06 0:21 ` [087/143] virtio_net: fix oom handling on tx Greg KH
2011-05-06 0:21 ` [088/143] mac80211: Add define for TX headroom reserved by mac80211 itself Greg KH
2011-05-06 0:21 ` [089/143] rt2x00: Centralize setting of extra TX headroom requested by rt2x00 Greg KH
2011-05-06 0:21 ` [090/143] rt2x00: Properly request tx headroom for alignment operations Greg KH
2011-05-06 0:21 ` [091/143] rt2x00: use correct headroom for transmission Greg KH
2011-05-06 0:21 ` [092/143] Bluetooth: Add support Bluetooth controller of MacbookPro 6,2 Greg KH
2011-05-06 0:21 ` [093/143] Bluetooth: Add support Bluetooth controller of MacbookPro 7,1 Greg KH
2011-05-06 0:21 ` [094/143] Bluetooth: Add MacBookAir3,1(2) support Greg KH
2011-05-06 0:21 ` [095/143] perf tools: Display better error messages on missing packages Greg KH
2011-05-06 0:21 ` [096/143] perf tools: Add make DEBUG=1 to remove the -O6 cflag Greg KH
2011-05-06 0:21 ` [097/143] perf tools: Test -fstack-protector-all compiler option for inclusion in CFLAGS Greg KH
2011-05-06 0:21 ` [098/143] perf tools: Support static build Greg KH
2011-05-06 0:21 ` [099/143] perf tools: Add V=2 option to help debug config issues Greg KH
2011-05-06 0:21 ` [100/143] perf tools: Suggest static libraries as well Greg KH
2011-05-06 0:21 ` [101/143] perf: Use default compiler mode by default Greg KH
2011-05-06 0:21 ` [102/143] perf tools: Move QUIET_STDERR def to before first use Greg KH
2011-05-06 0:21 ` [103/143] perf tools: Check if /dev/null can be used as the -o gcc argument Greg KH
2011-05-06 0:21 ` [104/143] perf symbols: allow forcing use of cplus_demangle Greg KH
2011-05-06 0:21 ` [105/143] V4L/DVB: Add Elgato EyeTV Diversity to dibcom driver Greg KH
2011-05-06 0:21 ` [106/143] mmc: fix all hangs related to mmc/sd card insert/removal during suspend/resume Greg KH
2011-05-06 0:21 ` [107/143] mmc: build fix: mmc_pm_notify is only available with CONFIG_PM=y Greg KH
2011-05-06 0:21 ` [108/143] b43: Fix warning at drivers/mmc/core/core.c:237 in mmc_wait_for_cmd Greg KH
2011-05-06 0:21 ` [109/143] econet: Fix redeclaration of symbol len Greg KH
2011-05-06 0:21 ` [110/143] econet: fix CVE-2010-3848 Greg KH
2011-05-06 0:21 ` [111/143] dell-laptop: Add another Dell laptop to the DMI whitelist Greg KH
2011-05-06 0:21 ` [112/143] dell-laptop: Add another Dell laptop family " Greg KH
2011-05-06 0:21 ` [113/143] scsi_dh_emc: fix mode select request setup Greg KH
2011-05-06 0:21 ` [114/143] scsi_dh_emc: request flag cleanup Greg KH
2011-05-06 0:21 ` [115/143] cifs: fix another memleak, in cifs_root_iget Greg KH
2011-05-06 0:21 ` [116/143] e1000e: Reset 82577/82578 PHY before first PHY register read Greg KH
2011-05-06 0:21 ` [117/143] e1000: fix Tx hangs by disabling 64-bit DMA Greg KH
2011-05-06 0:21 ` [118/143] btrfs: Require CAP_SYS_ADMIN for filesystem rebalance Greg KH
2011-05-06 0:21 ` [119/143] af_unix: limit recursion level Greg KH
2011-05-06 0:21 ` [120/143] af_unix: limit unix_tot_inflight Greg KH
2011-05-06 0:21 ` [121/143] init, sched: Fix race between init and kthreadd Greg KH
2011-05-06 0:21 ` [122/143] backlight: MacBookAir3,1(3,2) mbp-nvidia-bl support Greg KH
2011-05-06 0:21 ` [123/143] bonding: Ensure that we unshare skbs prior to calling pskb_may_pull Greg KH
2011-05-06 0:21 ` [124/143] HID: add MacBookAir 3,1 and 3,2 support Greg KH
2011-05-06 0:21 ` [125/143] intel-iommu: Force-disable IOMMU for iGFX on broken Cantiga revisions Greg KH
2011-05-06 0:21 ` [126/143] ipg: Remove device claimed by dl2k from pci id table Greg KH
2011-05-06 0:21 ` [127/143] ipv6: Silence privacy extensions initialization Greg KH
2011-05-06 0:21 ` [128/143] l2tp: Fix UDP socket reference count bugs in the pppol2tp driver Greg KH
2011-05-06 0:21 ` [129/143] MIPS: DMA: Fix computation of DMA flags from devices coherent_dma_mask Greg KH
2011-05-06 0:21 ` [130/143] mpt2sas: fix the incorrect scsi_dma_map error checking Greg KH
2011-05-06 0:21 ` [131/143] niu: Fix kernel buffer overflow for ETHTOOL_GRXCLSRLALL Greg KH
2011-05-06 0:21 ` [132/143] Phonet: device notifier only runs on initial namespace Greg KH
2011-05-06 0:21 ` [133/143] powerpc/boot/dts: Install dts from the right directory Greg KH
2011-05-06 0:21 ` [134/143] rt2500usb: fallback to SW encryption for TKIP+AES Greg KH
2011-05-06 0:22 ` [135/143] sata_via: Delay on vt6420 when starting ATAPI DMA write Greg KH
2011-05-06 0:22 ` [136/143] tehuti: Firmware filename is tehuti/bdx.bin Greg KH
2011-05-06 0:22 ` [137/143] wireless: b43: fix error path in SDIO Greg KH
2011-05-06 0:22 ` [138/143] libata: set queue DMA alignment to sector size for ATAPI too Greg KH
2011-05-06 0:22 ` [139/143] usb: musb: core: set has_tt flag Greg KH
2011-05-06 0:22 ` [140/143] iwlwifi: fix skb usage after free Greg KH
2011-05-06 0:22 ` Greg KH [this message]
2011-05-06 0:22 ` [142/143] KVM: x86: Fix a possible backwards warp of kvmclock Greg KH
2011-05-06 0:22 ` [143/143] KVM: x86: Fix kvmclock bug Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110506002219.104537530@clark.kroah.org \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=avi@redhat.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=serge.hallyn@canonical.com \
--cc=stable-review@kernel.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=zamsden@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox