Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2140780imm; Thu, 19 Jul 2018 14:01:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdfnjtnFaWXe8gpUYwEh/lNNNw1gfxMUM0K9vwBH4ISsUXvl42CSvi0zXztw1MEH1WAIQiK X-Received: by 2002:a63:be05:: with SMTP id l5-v6mr11337377pgf.330.1532034081320; Thu, 19 Jul 2018 14:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532034081; cv=none; d=google.com; s=arc-20160816; b=V7fVC2tWNK9BNo8wikhOW9c/3MjvUF1tI5qeL87gTKW4Wl63W/PNplqnkZXjrOAJzM 7mrMEKwehzy6NoGL4vPrmruhGrAY5MaAM2E0/TXWdR02UIIuiIipRiuUR4VqegxqBfXc 2S/+1JpX8HrNHpXQyLjk3I21swS35lMX4EbG29DAA0OgxpG5YwPgYl0xD9GAInlkj6jt jZ9emV6NSpL1cXnjMXT/v10JkvrI+85e4SAR2XHgUpYDWaL36GKgeX+4lTtutdGiOM0o 1PRjdGoWINH9CUnb14zwGSSd0hjX4qLCx/w6YApJ0xsWJ/95upFMPz3zPoAqWe1xJDCk VqTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:arc-authentication-results; bh=QeUHvVLGmEXmkb7sdlc/RqkjsCsXIiQCq3KGHCgprYE=; b=syG81/Nql2Rb58FFv6i7SH0/66Dbq+Cw+DBb0Jsr9DXu/tsqeip9W7RKy5rOBQZlns kzxXNvWy4lFkIMrXdWyFlZdUY9waI2+uF6fVfgBDLgO6U8Cjdyy678jWxHeZZFn3Ml4y kNNunrLpiWLvH9KPy/np2vHHZL1kj8JyNC/dRI+tGkJBs+sccWPirx9q0XBG157OzLY1 m8p+p3xCl2ZtWFlpxwQfOo3NU0Yz0sVzW/JfPLFzTxeNWcRZpv0Az0hwY8h+OJ3bE/TR W2cr0rxF0T3Fe0BNki2BQKVLPypg99ePDJCFqvBqimA3vLEmt4Q8SQa4cyqz53rYfGwl 8e7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=RaBOdkTV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1-v6si164242pgf.146.2018.07.19.14.01.06; Thu, 19 Jul 2018 14:01:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=RaBOdkTV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731397AbeGSVoK (ORCPT + 99 others); Thu, 19 Jul 2018 17:44:10 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50856 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730828AbeGSVmC (ORCPT ); Thu, 19 Jul 2018 17:42:02 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6JKs58m156716; Thu, 19 Jul 2018 20:56:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=QeUHvVLGmEXmkb7sdlc/RqkjsCsXIiQCq3KGHCgprYE=; b=RaBOdkTVTVW6ITecs1qIk7evTSoC4GKBhGg1lmcdLi+cukYNu79ilA4+UJOpNQzji3DR ApIHRVEzHD5w78HF3eRlx2SPK4NhXGDM02sjDSYF6w4Ssnl1S6ShjAJttgbChulTx711 mMC7THFR9o6r5ZDO5ZqxldU9POwolJ7IKJFEM9Cbpu1paVM+c0FnHx9+NKhaxJTDY7U8 LnscQ2yAufxlXOZyC8lZWxwHs5ynEV5e/MGElu9yhl1XCSujhA2UMgOjo6sMCCRqj6Ln zJGISzFXHa9q9M33ygQPBqw9Lk5CxXkoDf6BhMDJS38GDFFj5ELIXfw6zhKluFpS7t1f zg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2k9yjx8uu4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jul 2018 20:56:19 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6JKuHad000392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jul 2018 20:56:18 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6JKuGKv027430; Thu, 19 Jul 2018 20:56:16 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 19 Jul 2018 20:56:16 +0000 From: Pavel Tatashin To: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux@armlinux.org.uk, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, john.stultz@linaro.org, sboyd@codeaurora.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, douly.fnst@cn.fujitsu.com, peterz@infradead.org, prarit@redhat.com, feng.tang@intel.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk, linux-s390@vger.kernel.org, pasha.tatashin@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, pbonzini@redhat.com Subject: [PATCH v15 03/26] x86/kvmclock: Decrapify kvm_register_clock() Date: Thu, 19 Jul 2018 16:55:22 -0400 Message-Id: <20180719205545.16512-4-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180719205545.16512-1-pasha.tatashin@oracle.com> References: <20180719205545.16512-1-pasha.tatashin@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8959 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=961 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807190218 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner The return value is pointless because the wrmsr cannot fail if KVM_FEATURE_CLOCKSOURCE or KVM_FEATURE_CLOCKSOURCE2 are set. kvm_register_clock() is only called locally so wants to be static. Signed-off-by: Thomas Gleixner Signed-off-by: Pavel Tatashin Acked-by: Paolo Bonzini --- arch/x86/include/asm/kvm_para.h | 1 - arch/x86/kernel/kvmclock.c | 33 ++++++++++----------------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index 3aea2658323a..4c723632c036 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h @@ -7,7 +7,6 @@ #include extern void kvmclock_init(void); -extern int kvm_register_clock(char *txt); #ifdef CONFIG_KVM_GUEST bool kvm_check_and_clear_guest_paused(void); diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index a995d7d7164c..f0a0aef5e9fa 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c @@ -187,23 +187,19 @@ struct clocksource kvm_clock = { }; EXPORT_SYMBOL_GPL(kvm_clock); -int kvm_register_clock(char *txt) +static void kvm_register_clock(char *txt) { - int cpu = smp_processor_id(); - int low, high, ret; struct pvclock_vcpu_time_info *src; + int cpu = smp_processor_id(); + u64 pa; if (!hv_clock) - return 0; + return; src = &hv_clock[cpu].pvti; - low = (int)slow_virt_to_phys(src) | 1; - high = ((u64)slow_virt_to_phys(src) >> 32); - ret = native_write_msr_safe(msr_kvm_system_time, low, high); - printk(KERN_INFO "kvm-clock: cpu %d, msr %x:%x, %s\n", - cpu, high, low, txt); - - return ret; + pa = slow_virt_to_phys(src) | 0x01ULL; + wrmsrl(msr_kvm_system_time, pa); + pr_info("kvm-clock: cpu %d, msr %llx, %s\n", cpu, pa, txt); } static void kvm_save_sched_clock_state(void) @@ -218,11 +214,7 @@ static void kvm_restore_sched_clock_state(void) #ifdef CONFIG_X86_LOCAL_APIC static void kvm_setup_secondary_clock(void) { - /* - * Now that the first cpu already had this clocksource initialized, - * we shouldn't fail. - */ - WARN_ON(kvm_register_clock("secondary cpu clock")); + kvm_register_clock("secondary cpu clock"); } #endif @@ -265,16 +257,11 @@ void __init kvmclock_init(void) } else if (!(kvmclock && kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE))) return; - hv_clock = (struct pvclock_vsyscall_time_info *)hv_clock_mem; - - if (kvm_register_clock("primary cpu clock")) { - hv_clock = NULL; - return; - } - printk(KERN_INFO "kvm-clock: Using msrs %x and %x", msr_kvm_system_time, msr_kvm_wall_clock); + hv_clock = (struct pvclock_vsyscall_time_info *)hv_clock_mem; + kvm_register_clock("primary cpu clock"); pvclock_set_pvti_cpu0_va(hv_clock); if (kvm_para_has_feature(KVM_FEATURE_CLOCKSOURCE_STABLE_BIT)) -- 2.18.0