Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp878005pxk; Thu, 17 Sep 2020 20:06:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrxiQ5kaGV/NJp5FpMh4jujp6XgJB1YS0h+WM8dRbCZoXiz0g78RK97rQ46RLNu7EfhlGY X-Received: by 2002:a50:fb15:: with SMTP id d21mr37770369edq.150.1600398387411; Thu, 17 Sep 2020 20:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398387; cv=none; d=google.com; s=arc-20160816; b=EiXvGpIjW8SbCyYTcncVb19QXHXJ+qoSKi7Oes50Bnwlz77Dhc2JIzxQBe38DAy+bV 1AYSr00jGz7FAzU94KFXRXNR9o0uD2/zexuxQ4KxXqqqsqgjNvWSS8fVLgumXAEsbKZz RpOoH4Mmvxhqk+JsKE+XmDP58zWHigM9lshc3qM/ZmJjxTC7sNI5d1G7mpv4duzeXnhY RXuKL3A4W2W2QZsdi8va161jF43BDUrmfiaZXTNZWQUdgGZGwl34500w0CT2NaPcYjvC JzYRLArvlkkn+HMup85Nk4bCJximLWahW+QW8Y16G5sVDmCwerrjwYC7O+BdlM5sBmK1 xF8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hJAOLfGpZHVfdRLEfIZajPnpDdEydV7cBWmdE27tEow=; b=gG1Wap079UpZuF1c30LQ/BsnvdvWtCFL+dxl7lIt4Nva68RKa5b61+ju99f9MvOn2Y YPyFAlKQaoa8X3S7NHxB1LHEKRY/61Q+JHI/7JFSWP5ASo8kwwtUmLlHvRvTiESbXWwS +P/Ntcq2/PB5Phyz7hCvkVi3kLMJuNy0le+dUK83PQ+saFOrR8AJWobVvcWyyLguEfl6 mXrDlkWCziilQOOdjJYgiXgZiLxHFzkEHstfU4xYyKeIO5dKw6I9wCUc/G9O0e4NjCMn 5GF88PR5Dgw3M2XaW9KAB0d2kZxoaiAVDrAPYobvla4MIatm3pNyLIsyMqS4JmNYrDz4 eeDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K74zVkGy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si1165288edy.292.2020.09.17.20.06.04; Thu, 17 Sep 2020 20:06:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=K74zVkGy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730152AbgIRDDp (ORCPT + 99 others); Thu, 17 Sep 2020 23:03:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:52822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbgIRCE6 (ORCPT ); Thu, 17 Sep 2020 22:04:58 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25A14238D6; Fri, 18 Sep 2020 02:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394697; bh=RgzAspewNG+FqXNbXc14AK6gvvJ4XOlo51itPlkMIUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K74zVkGyA91tVNTeSSaYXXfmiiwx06EbXXPku48yCucLJTR+ZIL2CPO2Gv/1NkCBo hTF/TNjO8FCX7FtT3VN8vo65WQB4DAJb/uR3/7ZEtlRkFXxmYAy45X5T0GjKKISWt/ BOly/rHkPMeboq0TFHdYXLInGLNblBu3ehAmWs4k= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: He Zhe , Wanpeng Li , Paolo Bonzini , Sasha Levin , kvm@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 185/330] KVM: LAPIC: Mark hrtimer for period or oneshot mode to expire in hard interrupt context Date: Thu, 17 Sep 2020 21:58:45 -0400 Message-Id: <20200918020110.2063155-185-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: He Zhe [ Upstream commit edec6e015a02003c2af0ce82c54ea016b5a9e3f0 ] apic->lapic_timer.timer was initialized with HRTIMER_MODE_ABS_HARD but started later with HRTIMER_MODE_ABS, which may cause the following warning in PREEMPT_RT kernel. WARNING: CPU: 1 PID: 2957 at kernel/time/hrtimer.c:1129 hrtimer_start_range_ns+0x348/0x3f0 CPU: 1 PID: 2957 Comm: qemu-system-x86 Not tainted 5.4.23-rt11 #1 Hardware name: Supermicro SYS-E300-9A-8C/A2SDi-8C-HLN4F, BIOS 1.1a 09/18/2018 RIP: 0010:hrtimer_start_range_ns+0x348/0x3f0 Code: 4d b8 0f 94 c1 0f b6 c9 e8 35 f1 ff ff 4c 8b 45 b0 e9 3b fd ff ff e8 d7 3f fa ff 48 98 4c 03 34 c5 a0 26 bf 93 e9 a1 fd ff ff <0f> 0b e9 fd fc ff ff 65 8b 05 fa b7 90 6d 89 c0 48 0f a3 05 60 91 RSP: 0018:ffffbc60026ffaf8 EFLAGS: 00010202 RAX: 0000000000000001 RBX: ffff9d81657d4110 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000006cc7987bcf RDI: ffff9d81657d4110 RBP: ffffbc60026ffb58 R08: 0000000000000001 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000000 R12: 0000006cc7987bcf R13: 0000000000000000 R14: 0000006cc7987bcf R15: ffffbc60026d6a00 FS: 00007f401daed700(0000) GS:ffff9d81ffa40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000ffffffff CR3: 0000000fa7574000 CR4: 00000000003426e0 Call Trace: ? kvm_release_pfn_clean+0x22/0x60 [kvm] start_sw_timer+0x85/0x230 [kvm] ? vmx_vmexit+0x1b/0x30 [kvm_intel] kvm_lapic_switch_to_sw_timer+0x72/0x80 [kvm] vmx_pre_block+0x1cb/0x260 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_vmexit+0x1b/0x30 [kvm_intel] ? vmx_vmexit+0xf/0x30 [kvm_intel] ? vmx_sync_pir_to_irr+0x9e/0x100 [kvm_intel] ? kvm_apic_has_interrupt+0x46/0x80 [kvm] kvm_arch_vcpu_ioctl_run+0x85b/0x1fa0 [kvm] ? _raw_spin_unlock_irqrestore+0x18/0x50 ? _copy_to_user+0x2c/0x30 kvm_vcpu_ioctl+0x235/0x660 [kvm] ? rt_spin_unlock+0x2c/0x50 do_vfs_ioctl+0x3e4/0x650 ? __fget+0x7a/0xa0 ksys_ioctl+0x67/0x90 __x64_sys_ioctl+0x1a/0x20 do_syscall_64+0x4d/0x120 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f4027cc54a7 Code: 00 00 90 48 8b 05 e9 59 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b9 59 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007f401dae9858 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00005558bd029690 RCX: 00007f4027cc54a7 RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 000000000000000d RBP: 00007f4028b72000 R08: 00005558bc829ad0 R09: 00000000ffffffff R10: 00005558bcf90ca0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 00005558bce1c840 --[ end trace 0000000000000002 ]-- Signed-off-by: He Zhe Message-Id: <1584687967-332859-1-git-send-email-zhe.he@windriver.com> Reviewed-by: Wanpeng Li Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/lapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 6920f1d3b66f5..9f793c9649cdf 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1684,7 +1684,7 @@ static void start_sw_period(struct kvm_lapic *apic) hrtimer_start(&apic->lapic_timer.timer, apic->lapic_timer.target_expiration, - HRTIMER_MODE_ABS); + HRTIMER_MODE_ABS_HARD); } bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu) -- 2.25.1