Received: by 10.223.176.5 with SMTP id f5csp2584289wra; Thu, 1 Feb 2018 02:48:20 -0800 (PST) X-Google-Smtp-Source: AH8x225iql1xcXjyW08OllF9Jzjwt9oaQ2K3dOVbtTpxEcdCXiJvD+wDf3eEZYSDrJcMmAFjtJb1 X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr16074511pls.32.1517482099973; Thu, 01 Feb 2018 02:48:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517482099; cv=none; d=google.com; s=arc-20160816; b=p4pVca28B5tdbO7c3wQOmR/9CPCfHhYx5Gno/BZYZjUQ1zPRmz2tiO6faM8Zac70NQ NyAYmpWQO1wXji+V+nLZ+RNwBhKXgRE6oO8WanteKkLlsnx4B7jaYSbMgszY9ypsUyO+ vXD1oZczgMDPnRK4okldB9QymdnW3wvDuexjZj6L9wJv/Cc8LxayfK+clQWqRiQB3e6E w7U30SMZPT5TguS3tGXax8kNBvVkEboFKrsOJ5pdHDoGa06QkqjgFIUxp/FTr499INoO 4IJOmOqT0D3+0wS7jHcuhhJxMCzCtqWbkoGQwiQOOmc+RIueQpnUPpsBlkLpa0pbjItd EIRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=bEOUja5UsNz1GGnzX+FEUOUivv3wOre8RxnK0McpZOg=; b=hBv3LEBlUdrMxeUG07nAPOzCsVRo33Tu7U6pCtvvMufe6VMB1Ir2ZfSZteZ2kM5dQH 6dvWmlwv5VKX+eTXBbxoR2rswbnwmxqR005a4ve3XofVaI+Up9R++trs3/i9flNWNRMB 11CkyO5sGkqwLsYRqf1d/I8Yaw/oXbKwezEGVrFZOZ1FDqzTc+EZaZ/U3FqhV2uTHWJS 6ny+rV0FtuGL+ftnStOiUz/pL0nlPLAR3uRk8K2M8wDkszYlRQwnytCqXjlI7S80fNcR s/R7yjm44W4vruv0poVouHs8nTR4mHX/Shp1VbRLe6u5O/gFAZl8ZKcJFtRtAYRhe3Wl FdCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gdoOPwaA; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si4108734plg.400.2018.02.01.02.48.05; Thu, 01 Feb 2018 02:48:19 -0800 (PST) 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=@linaro.org header.s=google header.b=gdoOPwaA; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbeBAKrM (ORCPT + 99 others); Thu, 1 Feb 2018 05:47:12 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:37234 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbeBAKrK (ORCPT ); Thu, 1 Feb 2018 05:47:10 -0500 Received: by mail-wm0-f41.google.com with SMTP id v71so4734772wmv.2 for ; Thu, 01 Feb 2018 02:47:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bEOUja5UsNz1GGnzX+FEUOUivv3wOre8RxnK0McpZOg=; b=gdoOPwaA7IZzPnYQkSBtdMkjFvOFSjlgLoZLI6VKexqIXhFMAaogeXEEomDsHIMCp3 0qU1oYaMU7KcRj2Q4BooiRtBZz2Zlh9Lbv0xPYLmnt1r+p4Frw1Z9uPdpccsYDhGZ2tn VnbN1kOkGubjlMenFOvys7fFhEaji4ojvu+Ys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bEOUja5UsNz1GGnzX+FEUOUivv3wOre8RxnK0McpZOg=; b=q8mHkbTnIJJi60ggmI4QtfW1bGrCtnrM66kYac46cohMM5gjcwX3wMfafYFbHcNMue lb6p3MBZLO17sxrBe8IgUhIFtap9ll3DDtHucJUm/2YqJvYsYoUmVPri/2514TQEpPoy 7G4dJcEI/JSoiy99CJ9RjU53IR8+puFDIpFpcPBzFEWa4XXT7sbrZQfu1/Qk1aqlIOK3 1kXKoLZQaR+ILijZRfIOBNP63kbE3K7HJQ6uYPt283DJu4EpWcaN63QAnc65hmJ4zKVS X9SjagMTb0SN6fL0koZ6x3+vQZEMrjom2XpUyHg/10Rtf7zLVeRxrTH25gFLzpTF+pAq hAsA== X-Gm-Message-State: AKwxytcuEryVhV7g4Msh/aH3ALtMGCnRxpQcGeNk+iWt2wHl9uzBmkRZ G6BFQLj8Ecjz7xbzJq8SJtC0Tg== X-Received: by 10.80.138.66 with SMTP id i60mr39287398edi.40.1517482029687; Thu, 01 Feb 2018 02:47:09 -0800 (PST) Received: from localhost (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id s5sm10745473eda.60.2018.02.01.02.47.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 02:47:08 -0800 (PST) Date: Thu, 1 Feb 2018 11:47:07 +0100 From: Christoffer Dall To: Stephen Rothwell Cc: Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , KVM , Linux-Next Mailing List , Linux Kernel Mailing List , Marc Zyngier Subject: Re: linux-next: manual merge of the kvm tree with Linus' tree Message-ID: <20180201104707.GA21802@cbox> References: <20180201125512.7bc96674@canb.auug.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180201125512.7bc96674@canb.auug.org.au> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Feb 01, 2018 at 12:55:12PM +1100, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the kvm tree got a conflict in: > > virt/kvm/arm/arch_timer.c > > between commit: > > 36e5cfd410ad ("KVM: arm/arm64: Properly handle arch-timer IRQs after vtimer_save_state") > > from Linus' tree and commits: > > 70450a9fbe06 ("KVM: arm/arm64: Don't cache the timer IRQ level") > 13e59ece5b30 ("KVM: arm/arm64: Fix incorrect timer_is_pending logic") > > from the kvm tree. > > I fixed it up (I think - see below) and can carry the fix as > necessary. This is now fixed as far as linux-next is concerned, but any > non trivial conflicts should be mentioned to your upstream maintainer > when your tree is submitted for merging. You may also want to consider > cooperating with the maintainer of the conflicting tree to minimise any > particularly complex conflicts. > While the suggested fix is functional it does result in some code duplication, and the better resolution is the following: diff --cc virt/kvm/arm/arch_timer.c index cc29a8148328,fb6bd9b9845e..000000000000 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@@ -92,27 -92,18 +92,22 @@@ static irqreturn_t kvm_arch_timer_handl { struct kvm_vcpu *vcpu = *(struct kvm_vcpu **)dev_id; struct arch_timer_context *vtimer; - u32 cnt_ctl; - if (!vcpu) { - pr_warn_once("Spurious arch timer IRQ on non-VCPU thread\n"); - return IRQ_NONE; - } + /* + * We may see a timer interrupt after vcpu_put() has been called which + * sets the CPU's vcpu pointer to NULL, because even though the timer + * has been disabled in vtimer_save_state(), the hardware interrupt + * signal may not have been retired from the interrupt controller yet. + */ + if (!vcpu) + return IRQ_HANDLED; vtimer = vcpu_vtimer(vcpu); - if (!vtimer->irq.level) { - cnt_ctl = read_sysreg_el0(cntv_ctl); - cnt_ctl &= ARCH_TIMER_CTRL_ENABLE | ARCH_TIMER_CTRL_IT_STAT | - ARCH_TIMER_CTRL_IT_MASK; - if (cnt_ctl == (ARCH_TIMER_CTRL_ENABLE | ARCH_TIMER_CTRL_IT_STAT)) - kvm_timer_update_irq(vcpu, true, vtimer); - } + if (kvm_timer_should_fire(vtimer)) + kvm_timer_update_irq(vcpu, true, vtimer); - if (unlikely(!irqchip_in_kernel(vcpu->kvm))) + if (static_branch_unlikely(&userspace_irqchip_in_use) && + unlikely(!irqchip_in_kernel(vcpu->kvm))) kvm_vtimer_update_mask_user(vcpu); return IRQ_HANDLED; Thanks, -Christoffer