Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2837115pxb; Mon, 1 Nov 2021 02:54:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR9j2n0dHRlnZM1syPpzM7QYIzt+wREljAKaNtjZzvEjM0vaOS+cmK7zfRDNFhWWWwghXI X-Received: by 2002:a05:6e02:1b81:: with SMTP id h1mr19838234ili.290.1635760465955; Mon, 01 Nov 2021 02:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760465; cv=none; d=google.com; s=arc-20160816; b=SxNK+X/ntBKibvCK9X9UBi5WraZQkgQvOM3Z3v2gRPNGMwY2F3GyPavvDrx5eGtEIj POpOcFBqrl3fn3kCJFtmbhW5qPFUhhVzqnfPTW/Z4j6ONMh3B/wY/rNwRyg0Ytgc9ZoX w5ANG9kSvtI4z8fld4OdVeCTUjcgJ0C84MfIZRB5j3AhwNb5O+XJvYeGxnjMMDDghR2i 5nnvIwlDcfED2n7fBR1uERXlGPQOkDoTH7Pg327uRZzV7O0mDFFfZDppmkNHG3QCbwXE NskXS+UVKKAaRNiYcJ89DRH69iQ0XMSfs9SL1SEu2/6AIc4vGRseonFsHIOiwCr4d4Jj i3AA== 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=QlYmzjhSEaIy3DO1u14NgguoTK7MBAUY+sW3iVE3egw=; b=jCSUhtq9sEaXgGGZ62uzl2XpszpL41Fae93lxZcjsM80Rx+Rl7oePLLaWIP3DvwMKl EolXjg8EX1Yfk89fpWgSV7DX/D1OLL8JRzIxpEhw+PwEoryUO1FYiKE4X0AOG1cV9xbP kzbbPRQK6QINknPvNNMXU1msQlwCUTCuOoJkHCIf+qTTgr3LQC88EUop9He13caKjxL5 0HBCACkzONe5aKK0FJbGbPsXGm4Yb48M6XCgzgseUQw4mocii2wQ+uXT4eSbm5WfstqD K73VKbWKbU6RW/aLEBFrGKvbk3vORw/JgJajMS27A4qd8JRkK6LM7eCNlQt2e46mVd2B YXwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dQkHL9wO; 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 m20si7570214iow.110.2021.11.01.02.54.14; Mon, 01 Nov 2021 02:54:25 -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=dQkHL9wO; 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 S235156AbhKAJxv (ORCPT + 99 others); Mon, 1 Nov 2021 05:53:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:51418 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234775AbhKAJtC (ORCPT ); Mon, 1 Nov 2021 05:49:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 203F761205; Mon, 1 Nov 2021 09:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635759094; bh=fZVerNpCBZyP9MJ/63mzMn5VUC7cc2H05bLULyo8nNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQkHL9wOA2iVMfX+4vZEPMURPX/Xpt0HM6OiuZGBZXGLQbSucmqxSdb9c++gIRoVr ZsQvnvqsgWOqGMNjden0G/1N42+/p/aeZh9S0xGyXQTpAhxXng2LYRaj+efC8cOtdW +DklO6z1Esjl6OIt0q3C3ESkn8bxlXpeUGD5afqQ= 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.14 113/125] KVM: s390: clear kicked_mask before sleeping again Date: Mon, 1 Nov 2021 10:18:06 +0100 Message-Id: <20211101082554.460781400@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@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 8580543c5bc3..46ad1bdd53a2 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3341,6 +3341,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