Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2156550pxb; Mon, 23 Aug 2021 13:23:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDlOcge95156GosCGDU3e6fv97H/V2Ttj4g6ZUonzxZxhM2dygpLLOSUMUlcz6fZg8U710 X-Received: by 2002:a92:6a06:: with SMTP id f6mr8676110ilc.16.1629750206933; Mon, 23 Aug 2021 13:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629750206; cv=none; d=google.com; s=arc-20160816; b=G+KDFU2gLuIaV7eHGiQgk/4mhDphL/epQ+S4D25dAN9NNDlGks/gu6V6oDzVjjTcUn Y4lcVhJqHl71H4KQ2IfmRmLFVXvesRn2dWV7T2DSgA+FHmnEYycj+HjjViAOnUYC5vmu bu8Memsw1fejXVp28vcBtICEL4jsCgK4QgRtgtuYrsi3QPe++31/YDBB3TTLCA6fGZZ4 7qvCRTPrxSqQ+dY8H5T5cZ0P7LSodIE61SV1BjTYqkXpfbPy2yNp1bqtIgacF9GogOkC 7jHVcJv9p+3OWg8328ny15bhNTYvjxqoQg/JcHI5UcEEs6CC3yOssJiFpzXNOTmF30dH COGQ== 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 :organization:message-id:subject:cc:to:from:date:dkim-signature; bh=/rpPS8476jT+j14HYEnQugw58KjCjolM6XDTGzrL7Q8=; b=myXNbHW6xo42jSsbRrakCI3v2zCEMoa1q6/DzA0ZA+hH0vuRVY0z1fWm6UpHF42vsV CW9C7CUU+LJsicD85Hi+COp6/7WCYohLi3hP6OOU1aEWdNhQcrbrr5VNF/LxTRYcbf1c lZZLXOOJU5/m/x+wiQnuK3jp7qL1c6XqMAYARTDUxzkd0gFUM5ZF9yR0hqgZe+0jaPax /7xftrrlyxQ1k7zHOQK8z7AzgosMx0pKrKAxIPfomhQc7zZk2T5pa1LyB3b5vKqMwbBV bOhK9TN0MV8PC5cTAX1oZjYZLsNKE5TXmFjgb31Nb0yPZe1QyG2EE3LG4POBTMRNEeeH NX6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RtAtCY4W; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si14875264ils.62.2021.08.23.13.23.15; Mon, 23 Aug 2021 13:23:26 -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=@redhat.com header.s=mimecast20190719 header.b=RtAtCY4W; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbhHWUBJ (ORCPT + 99 others); Mon, 23 Aug 2021 16:01:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34268 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbhHWUBH (ORCPT ); Mon, 23 Aug 2021 16:01:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629748823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/rpPS8476jT+j14HYEnQugw58KjCjolM6XDTGzrL7Q8=; b=RtAtCY4WeZAPK5qrsqmqwCcXYWXiZt7GmvxHzzJwJSzDsxyO5xj0Le9nhYvUWmtIWQHOo8 3iq4ykP+I5QeoNUhaLlHSzzI1KJqizrQH8wwdEDw8uI5XaclwHp/KK6BrxGaoWhpznoE1h qjbjG+vbNy0/zhmsN2yNr9E3PTLJJ1s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-8uGg5a33MiyiAxjiEOwLyA-1; Mon, 23 Aug 2021 16:00:20 -0400 X-MC-Unique: 8uGg5a33MiyiAxjiEOwLyA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D7C41082923; Mon, 23 Aug 2021 20:00:18 +0000 (UTC) Received: from theseus (unknown [10.22.17.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15FD369CBC; Mon, 23 Aug 2021 20:00:16 +0000 (UTC) Date: Mon, 23 Aug 2021 15:00:15 -0500 From: Clark Williams To: Sebastian Andrzej Siewior Cc: Thomas Gleixner , Steven Rostedt , David Airlie , LKML , RT , Daniel Vetter Subject: [PATCH PREEMPT_RT] i915: fix PREEMPT_RT locking splats Message-ID: <20210823150015.61ebc7d6@theseus> Organization: Red Hat, Inc MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Found two separate spots where i915 was throwing "sleeping function called from invalid context" when running on a PREEMPT_RT kernel. In both cases it was from calling local_irq_disable prior to taking a spin_lock. Since spin locks are converted to rt_mutex_t on PREEMPT_RT this means that we might sleep with interrupts disabled. Since in both cases the calls were in threaded context on RT (irq or ksoftirqd) and in no danger of reentrance, change the code to only disable interrupts on non-PREEMPT_RT kernels. Signed-off-by: Clark Williams --- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 6 ++++-- drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c index 38cc42783dfb..b8bf8d6d3c61 100644 --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c @@ -318,9 +318,11 @@ void __intel_breadcrumbs_park(struct intel_breadcrumbs *b) /* Kick the work once more to drain the signalers, and disarm the irq */ irq_work_sync(&b->irq_work); while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) { - local_irq_disable(); + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) + local_irq_disable(); signal_irq_work(&b->irq_work); - local_irq_enable(); + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) + local_irq_enable(); cond_resched(); } } diff --git a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c index fc77592d88a9..0e918831b69f 100644 --- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c +++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c @@ -1580,9 +1580,11 @@ static void execlists_dequeue(struct intel_engine_cs *engine) static void execlists_dequeue_irq(struct intel_engine_cs *engine) { - local_irq_disable(); /* Suspend interrupts across request submission */ + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) + local_irq_disable(); /* Suspend interrupts across request submission */ execlists_dequeue(engine); - local_irq_enable(); /* flush irq_work (e.g. breadcrumb enabling) */ + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) + local_irq_enable(); /* flush irq_work (e.g. breadcrumb enabling) */ } static void clear_ports(struct i915_request **ports, int count) -- 2.31.1 -- The United States Coast Guard Ruining Natural Selection since 1790