Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2830043pxb; Mon, 1 Nov 2021 02:43:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9ChXRSyp24GCpETB/nWv0aJT0nthk9PhuJ7qwjh2InFNbKwsioUIvJ9d8e6IhNpHjqjjg X-Received: by 2002:a05:6402:205a:: with SMTP id bc26mr27907950edb.119.1635759811891; Mon, 01 Nov 2021 02:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759811; cv=none; d=google.com; s=arc-20160816; b=cwl8vfEsleZbn5f3HjMxRe5mHczTAyzqSliq8sXVjeciklwYNV7j3KHvzRi+lBoUGC SEhy4u+M/XvaO1wuGctI1PgFAvHjeAEd7g+zAqB/XhbeWlmqPmFdyTSVSvKWkkRbwMBz cdBgMFLjxhTlq3xIEJid3kz4bgT6N78DEtFJcuH+xCRfE8oUOnmNt4gNJVFz+GpTa/qc H929Y+zLDnCwGoq3q8bDZuYId8uinPqrg20GzrP8osaxkDh+GChANkkxc6vg6/kz2TW4 oYdUziw/o58MgUjSOiNdmKV4Geg7smQrO1+t+d/wSkjELhDRJw77r6Y8WUjaxYq4aTmu n3Dg== 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=ty9wjs+GGd0emliY0gJzZCphaagFfOrA4LNc1VODWus=; b=xMcXUT7rvH1OdS4jLxyTjKjbh0+2VaOH3UOVfGm+TxT1dVueKL+vkWlvPIxjHkkFaB FT6sqOr4CmW9ygLaknP7g1PYGFJpBWIKKs53DwUwjZUhEbXPztTxA52AEXEXbCUgEjAc hwWHKhtuE9p0BjT1XnzRxOyhGvWtKKbPKjSOKn3UdJ+eu53dQypIZSEpUr+bvfLeaQzD fsHv+cB+1NjveXqrdZMN1FeuKwjCynnXiv/XTxaBV8B8p+HdC2jV7pIaiBe1XHtMVs1G luRZaMEhPGn2Ho7stBfnk1PQwEypPcXBXYZA4oBtSZ5pJeiJlmMyvUyBZyQmBbKhZ+DZ KONA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0C3DrNC6; 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 ah14si1855810ejc.107.2021.11.01.02.43.04; Mon, 01 Nov 2021 02:43:31 -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=0C3DrNC6; 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 S233133AbhKAJly (ORCPT + 99 others); Mon, 1 Nov 2021 05:41:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:47844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233419AbhKAJjp (ORCPT ); Mon, 1 Nov 2021 05:39:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A7E361186; Mon, 1 Nov 2021 09:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758837; bh=R8wHN2xghOx33mYGjdO6JMzjo4Nblujv+vL+t3+NtfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0C3DrNC6HKODesAISPqHhqBJRYNwUqMYwK3K1WuKgn2ehTe4RpNty1fLZ02gH995N ZM/roib/v8BvFpXKepZWABu065wsAPDTtsPujWxK6XS2pIpKNXmzRoZiKeK3li9HBN XuRHPhYngmU7rNsQUKOkiFrQkYnBlzMBq6Fiixw4= 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.10 72/77] KVM: s390: clear kicked_mask before sleeping again Date: Mon, 1 Nov 2021 10:18:00 +0100 Message-Id: <20211101082526.600825558@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082511.254155853@linuxfoundation.org> References: <20211101082511.254155853@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 7f719b468b44..00f03f363c9b 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3312,6 +3312,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) 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