Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3653937pxb; Mon, 24 Jan 2022 14:31:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxRhLtTQCoxULYUYveFYU5akv67PZw3OXuqYmkUKenZCuopP6aNTIutAjvDnSd26e+3fdm X-Received: by 2002:a17:902:8509:b0:14b:7484:9ce6 with SMTP id bj9-20020a170902850900b0014b74849ce6mr491611plb.19.1643063513963; Mon, 24 Jan 2022 14:31:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063513; cv=none; d=google.com; s=arc-20160816; b=JOdJPws+f66Uz+1Ljwi3Q1qVFtg3RSwebqyooQT+l6DjtriaMzmL2jLOqvfcR1MLTd OoQXfTjDLzZxOkxDmLFJjdsPmTqAl1bgvxqMLjEn49KfyIutqMnDlRvE3kmm9CWK5LiG ZdlTg4jGFx5AMtGxHxw85BtANzwuAhRwgjKdyc01SaJqNuWzQlY3UHpg2Rw5kywepcte 7ogAwYrILPeyDZKNtbCeRJ+W7YkhyL+pIxa4SQmJBriRyZROpg5M8VaC6PklKPngJajV oB+Xnx1sDmyvkNPL3SgR+9BfiykwgwE/G3pa7cV9wEO78pJM/5izdyC95lkRoGpKu41B Z9Aw== 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=eZSvOn/vVSg4d99HQnQvFhdRtU09vEYfIIVQGe2NiYk=; b=gSb+b+Zux9ejcb7Cbmak+c/VHB2lUN7lrK36uzyU4XECtQCWf9t4DgDcM6UVCiwQWq DJ25lJfIvJCE8VCs4l8VrluV/BmRisDoQKUBXKld83djg56hjaaXg0kNUcfEdPCp9ooI bEQhGN9h5XjQI3pAKnxGH3gReY4lAb/ixoHyWSSvtx/8V4JuxFM3kStVZp8wCJXjyhz9 Ble75dg+5BaLVrhm4nAmxViLRP5lTM6rJ/q9xzYjLpt6h45tRSpA+de8d4yGN9TkcKvP KglTAx+JErudpu/6dYpC3Wo0ddBWekwRMUyT4IIq4qI915FkiiPNFwu2YOMREzivkP4g xztQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O2Uyj1b7; 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 y124si14653054pgy.605.2022.01.24.14.31.41; Mon, 24 Jan 2022 14:31:53 -0800 (PST) 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=O2Uyj1b7; 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 S1587392AbiAXW2O (ORCPT + 99 others); Mon, 24 Jan 2022 17:28:14 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51444 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454974AbiAXVeP (ORCPT ); Mon, 24 Jan 2022 16:34:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECD0B61305; Mon, 24 Jan 2022 21:34:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D10F6C340E4; Mon, 24 Jan 2022 21:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060053; bh=nRMkltgKgdbuMr9XsmL+FvkFhQmImYJklYWMTfuJkEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2Uyj1b7qyl/d+Uh/DHLTlrgSwioi97jT5+7I2DDTgkJZ9v3Gq6MR8lLnp993oKgS 3mduPUVog7slhAgyAs/KeOubUCGh9eLQT2vtVj7+Q2GfNQ00uF/V0qCRjXcVzyDTxh xPyeBpesHE9DkFYBcbVp1Z5r+MFwEDn0o4t/Qvu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guchun Chen , Alex Deucher , Kelly Zytaruk , Sasha Levin Subject: [PATCH 5.16 0823/1039] drm/amdgpu: use spin_lock_irqsave to avoid deadlock by local interrupt Date: Mon, 24 Jan 2022 19:43:32 +0100 Message-Id: <20220124184152.959306615@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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: Guchun Chen [ Upstream commit 2096b74b1da5ca418827b54ac4904493bd9de89c ] This is observed in SRIOV case with virtual KMS as display. _raw_spin_lock_irqsave+0x37/0x40 drm_handle_vblank+0x69/0x350 [drm] ? try_to_wake_up+0x432/0x5c0 ? amdgpu_vkms_prepare_fb+0x1c0/0x1c0 [amdgpu] drm_crtc_handle_vblank+0x17/0x20 [drm] amdgpu_vkms_vblank_simulate+0x4d/0x80 [amdgpu] __hrtimer_run_queues+0xfb/0x230 hrtimer_interrupt+0x109/0x220 __sysvec_apic_timer_interrupt+0x64/0xe0 asm_call_irq_on_stack+0x12/0x20 Fixes: 84ec374bd580 ("drm/amdgpu: create amdgpu_vkms (v4)") Signed-off-by: Guchun Chen Acked-by: Alex Deucher Tested-by: Kelly Zytaruk Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c index ac9a8cd21c4b6..7d58bf410be05 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -142,15 +142,16 @@ static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc, static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state) { + unsigned long flags; if (crtc->state->event) { - spin_lock(&crtc->dev->event_lock); + spin_lock_irqsave(&crtc->dev->event_lock, flags); if (drm_crtc_vblank_get(crtc) != 0) drm_crtc_send_vblank_event(crtc, crtc->state->event); else drm_crtc_arm_vblank_event(crtc, crtc->state->event); - spin_unlock(&crtc->dev->event_lock); + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); crtc->state->event = NULL; } -- 2.34.1