[Devel] vdso/ia32: Revert monotonic time virtualization for ia32

Submitted by Dmitry Safonov on July 7, 2017, 5:47 p.m.

Details

Message ID 20170707174734.23646-1-dsafonov@virtuozzo.com
State New
Series "vdso/ia32: Revert monotonic time virtualization for ia32"
Headers show

Commit Message

Dmitry Safonov July 7, 2017, 5:47 p.m.
As vz-kernel is based on v3.10 kernel and __vdso_gettimeofday()
was added to vdso page laterly, we don't need to virtualize
clocks in case of ia32 clock_gettime()/vdso_gettimeofday().

So, they are present in ms, but our kernel yet have poorer
vdso32.lds.S:
VERSION
{
	LINUX_2.5 {
	global:
		__kernel_vsyscall;
		__kernel_sigreturn;
		__kernel_rt_sigreturn;
	local: *;
	};
}

https://jira.sw.ru/browse/PSBM-68050

Fixes: commit 25960eecc77e ("ve/vdso: virtualized monotonic gettime
through vdso") and commit 481382a5f63e ("vdso32: Fix monotonic time
virtualization for ia32)".
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
---
 arch/x86/vdso/vclock_gettime.c |  2 --
 arch/x86/vdso/vdso32-setup.c   | 11 ++++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index e3f80badc5ac..7c218ce347a3 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -28,8 +28,6 @@ 
 #define gtod (&VVAR(vsyscall_gtod_data))
 
 struct timespec VDSO64_ve_start_timespec;
-extern struct timespec VDSO32_ve_start_timespec
-	__attribute__((weak, alias("VDSO64_ve_start_timespec")));
 
 notrace static cycle_t vread_tsc(void)
 {
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 70e1cc45a17c..81a16c803f11 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -344,8 +344,10 @@  static struct page **uts_prep_vdso_pages_locked(int map)
 		 * preallocated one.
 		 */
 		new_version = KERNEL_VERSION(n1, n2, n3);
+		if (new_version == LINUX_VERSION_CODE)
+			goto out;
 #ifdef CONFIG_X86_32
-		{
+		else {
 			/*
 			 * Native x86-32 mode requires vDSO runtime
 			 * relocations applied which is not supported
@@ -368,8 +370,8 @@  static struct page **uts_prep_vdso_pages_locked(int map)
 		 * better than walk out with error.
 		 */
 		pr_warn_once("Wrong release uts name format detected."
-			     " Using host's uts name.\n");
-		new_version = LINUX_VERSION_CODE;
+			     " Ignoring vDSO virtualization.\n");
+		goto out;
 	}
 
 	mutex_lock(&vdso32_mutex);
@@ -399,9 +401,7 @@  static struct page **uts_prep_vdso_pages_locked(int map)
 	copy_page(page_address(new_pages[0]), page_address(vdso32_pages[0]));
 
 	addr = page_address(new_pages[0]);
-	uts_ns->vdso32.addr = addr;
 	*((int *)(addr + uts_ns->vdso32.version_off)) = new_version;
-	*((struct timespec*)(VDSO32_SYMBOL(uts_ns->vdso32.addr, ve_start_timespec))) = ve->start_timespec;
 	smp_wmb();
 
 	pages = uts_ns->vdso32.pages = new_pages;
@@ -411,6 +411,7 @@  static struct page **uts_prep_vdso_pages_locked(int map)
 
 out_unlock:
 	mutex_unlock(&vdso32_mutex);
+out:
 	down_write(&mm->mmap_sem);
 	return pages;
 }

Comments

Andrey Ryabinin July 10, 2017, 10 a.m.
On 07/07/2017 08:47 PM, Dmitry Safonov wrote:
> As vz-kernel is based on v3.10 kernel and __vdso_gettimeofday()
> was added to vdso page laterly, we don't need to virtualize
> clocks in case of ia32 clock_gettime()/vdso_gettimeofday().
> 
> So, they are present in ms, but our kernel yet have poorer
> vdso32.lds.S:
> VERSION
> {
> 	LINUX_2.5 {
> 	global:
> 		__kernel_vsyscall;
> 		__kernel_sigreturn;
> 		__kernel_rt_sigreturn;
> 	local: *;
> 	};
> }
> 
> https://jira.sw.ru/browse/PSBM-68050
> 
> Fixes: commit 25960eecc77e ("ve/vdso: virtualized monotonic gettime
> through vdso") and commit 481382a5f63e ("vdso32: Fix monotonic time
> virtualization for ia32)".
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>

Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>