Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2823132pxb; Mon, 1 Nov 2021 02:33:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFEMKRXOIwUwURnNcPb2ggR/NJWln1aiqsSj8H1fdIITE7XG2TGBrSo3sYK8x9910Q1CzP X-Received: by 2002:a05:6602:59:: with SMTP id z25mr17709815ioz.212.1635759198262; Mon, 01 Nov 2021 02:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759198; cv=none; d=google.com; s=arc-20160816; b=k/tQg71T9w9vXPVhh+xbqf0wias9KSzDrHsgbbGyJoFAhj0na4q7EHDZkpQGtaXwpy ebwfsLbReXu/imfwm2ZCHry7hK+jCptUh8E++p0KYaMIzDXMAEKuiBtuM4FVUc1na4sy hlmJox5Z5zVDOPXQW0QHiXHUzJ9TllAa+yus0ylfT6giTtzCYvZsqMe25U6pb2+TCK39 ILFYsI27GsPCDOKCyTUEvjKYJD8TnazoXU1IQZEP+hdKXwCruMq65mKTft22/mBJ/yu7 YD18nFEyP7XYeZ6MgMSl8hLTKtx6LpW9MdpOv9X/CLB9eZyYAGBs6CyJI4RXBgR41+kM Uzuw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EYKAj3TS1mE7vAJGDtXvR/67Med1TidIB62/NG1FonY=; b=ihK9ps6bRD3tAs14z4rznn0cLNIPFOHoQLO64dJhykXLzvAaLX1KItySl1Wx9sasqO DHQFKiegDrMlNhWLQKUfJVIfWVFuGufuGgw8Xg4RyWLnzMmZk/g/MkPDJ7NRQOI7QV5o QtnatDjHM+dMxgQJ7Ch3CMUw5dhcQF67Vg2w7B0LrCMcXm20GlgkBHuhkx4SL14lxi1S bm+TZJfNw4MSeuh7A+Hs07mMh9u53BnMvbKiV34x8QU5Wl+v16JENk2fiqbqUSZ90uyT xW0vKGMvBHA+sMh5suRH7YM5uUQ+7IZvmtUHi/TcWjziVLnl971fiK3xhKu3RDvLM3Su hQ7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fp4cmh6s; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m22si14602821jac.35.2021.11.01.02.33.07; Mon, 01 Nov 2021 02:33:18 -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=@linuxfoundation.org header.s=korg header.b=Fp4cmh6s; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233033AbhKAJej (ORCPT + 99 others); Mon, 1 Nov 2021 05:34:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:37302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232957AbhKAJa2 (ORCPT ); Mon, 1 Nov 2021 05:30:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 30EE2610E5; Mon, 1 Nov 2021 09:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758646; bh=KukCVh30aY1wieDZcMRPz5ZH2KjilbetPUXsSfiLFNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fp4cmh6sXlR/UtBcH//8T3U00lpFudmQQ/OTAVr/iyoa7ntCoU6j5PwvhC38CyaM5 7Kee0WM1L9JHHzQkpEGrkExM9psI+OYeMgd9Hn5RWLih7XwOKbZhoPzT9wrrdKPwe9 0GvbGMO0WwbpvsxXU50vLAWWZlvvY+A1qB7Qjkm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Rosato , Halil Pasic , Christian Borntraeger , Michael Mueller , Claudio Imbrenda , Sasha Levin Subject: [PATCH 5.4 49/51] KVM: s390: clear kicked_mask before sleeping again Date: Mon, 1 Nov 2021 10:17:53 +0100 Message-Id: <20211101082511.910355787@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082500.203657870@linuxfoundation.org> References: <20211101082500.203657870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Halil Pasic [ Upstream commit 9b57e9d5010bbed7c0d9d445085840f7025e6f9a ] The idea behind kicked mask is that we should not re-kick a vcpu that is already in the "kick" process, i.e. that was kicked and is is about to be dispatched if certain conditions are met. The problem with the current implementation is, that it assumes the kicked vcpu is going to enter SIE shortly. But under certain circumstances, the vcpu we just kicked will be deemed non-runnable and will remain in wait state. This can happen, if the interrupt(s) this vcpu got kicked to deal with got already cleared (because the interrupts got delivered to another vcpu). In this case kvm_arch_vcpu_runnable() would return false, and the vcpu would remain in kvm_vcpu_block(), but this time with its kicked_mask bit set. So next time around we wouldn't kick the vcpu form __airqs_kick_single_vcpu(), but would assume that we just kicked it. Let us make sure the kicked_mask is cleared before we give up on re-dispatching the vcpu. Fixes: 9f30f6216378 ("KVM: s390: add gib_alert_irq_handler()") Reported-by: Matthew Rosato Signed-off-by: Halil Pasic Reviewed-by: Christian Borntraeger Reviewed-by: Michael Mueller Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20211019175401.3757927-2-pasic@linux.ibm.com Signed-off-by: Christian Borntraeger Signed-off-by: Sasha Levin --- arch/s390/kvm/kvm-s390.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 9ed2fee61229..b286818d8d54 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3092,6 +3092,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) { + clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.gisa_int.kicked_mask); return kvm_s390_vcpu_has_irq(vcpu, 0); } -- 2.33.0