Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3294888pxk; Mon, 21 Sep 2020 09:55:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvgCe3dla5YHyivlHqfYE4GhGNSUK/SBfBzMn1pfocIj9BFOogMp9xZRdChevSRh2432pB X-Received: by 2002:a17:906:4a8c:: with SMTP id x12mr352147eju.271.1600707348332; Mon, 21 Sep 2020 09:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707348; cv=none; d=google.com; s=arc-20160816; b=o6vKz5PEehfjTBlmkOiFwjNcumbvVXOnECSi/+axXB5LjEKAlosHPXP8bWFAke3nx6 Sfr3tmTJ/GxRUEskprBLn2Z0McgsinKdRQKF6roNc8PwyPy0xSTGbfiOxWm94trmdq7i oYrI9l91M8c8TqRrh2s3QUme7wAX+i+OcsiMhSqaMUJG0YjIbJPwo3BJYJ5FhVYt3HHi 3wen7yiQI2aXPJACzplOcTDezKm9e+2rHteuahb0TouPrSEaqkPjSYFSq9FwpG7ZMeOw Bv0aTSuMCDYFq2pdHhqc9mzVT4qY1+/TPCIkFcdHeSEnNide71K4+zPn1QKvJFGvtag1 9PcQ== 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=Gc/oHYCfFGb06tNjS7pvKRZqf3wUr5JP0btbxszcimo=; b=G+tpkk/f4s+zBaaGoYYbNYI/B/OjP9JiVlfXziaLwshQ1MtCZognc2DwBzaz+zzP93 9sWO73JQDgYyn6JnRTRXeOj7LVowDTWDvloXa/LCTkuBOxBFumtCMMyRe/3CMYLQWcjv liuUONi7WxsWRRSgBcKrzI5wCda62LvPAp5rDUlejFsWjVSGmmX/xnIufT0+meHhUVKa 3Pbtjvbkqwfu1pdTpZGZA7oizkNTxHtV5/3OqBT0jOwN41s7NWv8lQSHiGQn8DrGc72V jqewCcKWH8q9vaBjsmgxrOLjTyzvKZk1cwmOZogDtxOzGxNq20HVM6mNDO0TKkJzH/Rv /v9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="l3iHKQ/t"; 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=fail (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 e20si7311659ejm.210.2020.09.21.09.55.24; Mon, 21 Sep 2020 09:55:48 -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=@kernel.org header.s=default header.b="l3iHKQ/t"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728321AbgIUQyc (ORCPT + 99 others); Mon, 21 Sep 2020 12:54:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:52224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727197AbgIUQqJ (ORCPT ); Mon, 21 Sep 2020 12:46:09 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E9B942223E; Mon, 21 Sep 2020 16:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706768; bh=8CgClc7n9JrrvXiLpWN8REZOBT57fFtY5L9Gom4cG6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3iHKQ/tl2lWJ+EQ55uhp84Cdkxi+UzIYc72fvh4ySp0KIlD73unT4LFbh2VScyW0 UjneeH0inc8kdC0ZEiK8qUz7VtYQeygTJV6sHCE6+phsDN3XiVZBsJNGq5AaNfTHwn SBEX3vqxYSu6I3WWnQdqgUxwE40gn7DfuZYgiX1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Matthew Auld , Rodrigo Vivi , Joonas Lahtinen , Jani Nikula Subject: [PATCH 5.8 085/118] drm/i915: Filter wake_flags passed to default_wake_function Date: Mon, 21 Sep 2020 18:28:17 +0200 Message-Id: <20200921162040.295019326@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@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: Chris Wilson commit 20612303a0b45de748d31331407e84300c38e497 upstream. (NOTE: This is the minimal backportable fix, a full fix is being developed at https://patchwork.freedesktop.org/patch/388048/) The flags passed to the wait_entry.func are passed onwards to try_to_wake_up(), which has a very particular interpretation for its wake_flags. In particular, beyond the published WF_SYNC, it has a few internal flags as well. Since we passed the fence->error down the chain via the flags argument, these ended up in the default_wake_function confusing the kernel/sched. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2110 Fixes: ef4688497512 ("drm/i915: Propagate fence errors") Signed-off-by: Chris Wilson Cc: Matthew Auld Cc: # v5.4+ Reviewed-by: Matthew Auld Link: https://patchwork.freedesktop.org/patch/msgid/20200728152144.1100-1-chris@chris-wilson.co.uk Signed-off-by: Rodrigo Vivi [Joonas: Rebased and reordered into drm-intel-gt-next branch] [Joonas: Added a note and link about more complete fix] Signed-off-by: Joonas Lahtinen (cherry picked from commit f4b3c395540aa3d4f5a6275c5bdd83ab89034806) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_sw_fence.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/i915/i915_sw_fence.c +++ b/drivers/gpu/drm/i915/i915_sw_fence.c @@ -164,9 +164,13 @@ static void __i915_sw_fence_wake_up_all( do { list_for_each_entry_safe(pos, next, &x->head, entry) { - pos->func(pos, - TASK_NORMAL, fence->error, - &extra); + int wake_flags; + + wake_flags = fence->error; + if (pos->func == autoremove_wake_function) + wake_flags = 0; + + pos->func(pos, TASK_NORMAL, wake_flags, &extra); } if (list_empty(&extra))