Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp258284lqc; Thu, 7 Mar 2024 17:13:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQYHrwx9k43s/ReemlDpchZ7EmVfvq5NrDe+h/S/DCFXpJ1XycYktmQVFJ0c76m24CX4aTniBG6w55K7lSj55mxl0uJ03zJQ1bvg0ZaQ== X-Google-Smtp-Source: AGHT+IEmXvpbypS/v6BRP7h5NV3flVv6vn9vo2Pa4Cad25rpBkPjXxeZswJ6KOUZB8EbPOLMAyMi X-Received: by 2002:a05:6a20:9592:b0:1a1:e70:3195 with SMTP id iu18-20020a056a20959200b001a10e703195mr9821844pzb.8.1709860392327; Thu, 07 Mar 2024 17:13:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709860392; cv=pass; d=google.com; s=arc-20160816; b=XZHV7kK1m2zcowfcYLfjce/OaiRK0xWtAPQoMBAJJ85CmsoatdYHd8Vq5oM1tTHM1c akpfshrFebK+KlJ0OFoKLYjBGolWxzZbJCrgiy2KBnfuoTwvHOkIfPE6o5ete5w7RgVu PRZHkgfoNpHaVKHnWSwulecEgiIf7hhoCP21oTA4livGbfV8KnbR07Fl0M9aUwKP5Qpw uGd+ypRM+21FT4bkxEh+B7WysEC3Nuxlm79Et9DSDysJhu/XbF4qOHWt3vghqmrieJ2M FyLuR4QUe651m16X737fMzsE8YR9RS85ITd1RFPopt2c+LcZMd3K4UkFfhnYpqbtdK05 vmwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Owx6jt72g5QT/V0uQHGstO9uCqzU46h0v31gh/DzxSw=; fh=jHKCW7MsMr9v/FlcP2x1ebmKGCEASTGaJnhEIAD1cww=; b=LZhphB+94/wZ/cu3Kfr/BqA6nVjxzycgtSZ+zEOHuAYeet6qbP1Xccn7PqfbEjMOFv y74p0PITOUOE6dJQ9DaDAITpF86S4DcT9kDgDG7sIKouj40n/2Z2woSmJINdr1D9kJuS 6roToNg5TNB1ZEHAVIgX0Jduod9KS/juISCVLiDo02LLyGgH7DY2bRx/4juwE63iWBo+ pmzn91+qnNeZKrXIGI22ZHPIqwy6kU+8kcRr2NRv6Cc+dKVrTNpF+RQSS2CvLGhaPHvg HzmSfFi4FZNPnYJquJpXw0N/1piQ5UW24l1lCgUoL1W2AKb653xy31JHUZZ0OtJylTW5 Hglg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PxkS3Y3M; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-96421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i4-20020a17090332c400b001dcfaf53cb7si10898949plr.18.2024.03.07.17.13.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 17:13:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=PxkS3Y3M; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-96421-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96421-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D8483B21F61 for ; Fri, 8 Mar 2024 01:12:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F32DD224F0; Fri, 8 Mar 2024 01:12:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PxkS3Y3M" Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CD5523750 for ; Fri, 8 Mar 2024 01:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709860348; cv=none; b=tMP0Yrviw8J2Eos9X5jKTdSEuHBEJbDHR3ELcVJ9V4xHaODcDLNyOHm6rNOoNYU7xDjyViI7OkPtHjR8BYK4RqD+9mHCydzjBTBrt3eRgx2B6uGJIlD7BrOSjfW+NstntUWk6m0spxfscTagF0FVH9xAp6KAfOQWTHJUNjZ1NTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709860348; c=relaxed/simple; bh=sA5YotOtX3AcvjjrYf5fHrYUORIzots7hTq07UQbKVI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f3Y4/lvJO+nluz5GD6eSoOHJ7ZNPQHZUIODAAgM9Ydl4z/YwDtECwDetYd2T4iXrjrJ7kPZ9J2v60z6MvS3MGHa18Jjgd7dsLH+L/f7VG4iPGMx8TNrDBCCXO9EleVOcpk5S0V0i7ozvUqAhBUVEn+krQiD0ik46oFa8+3V2mU8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PxkS3Y3M; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-33e742ca96bso404483f8f.3 for ; Thu, 07 Mar 2024 17:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709860345; x=1710465145; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Owx6jt72g5QT/V0uQHGstO9uCqzU46h0v31gh/DzxSw=; b=PxkS3Y3MU+Ds4ZgLtFQCLvB35mWreYDwDKbu+q1SeOQBVjewFykej39z3w8s/bkAZo /gZyqQwUanCxijE6clPgp3HYgkGerqqAMqPrhuoch1MhaamW9wvgBPFUGSaQpDOjhaDd vXCb4PD9+rrZz1Cb74sfpZ9o33HCeArsIvCEhkuIUY1Si6XTi0vrzQn+9JtMkbN/3FNu KgQLptuh6GVKbRhB/Xsme2HjFIcXJPgwGRgjPoJjocCA1gC7YyvWsyDOMcz/FXpTDmeg S2brMlNBSdRWHzjB/m3rqZwrlRMPeeNkcbVNcZF5SbAV4MBRgO6RAiOQefwebiXnwzft WFKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709860345; x=1710465145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Owx6jt72g5QT/V0uQHGstO9uCqzU46h0v31gh/DzxSw=; b=GvuS+6GJ8hzZDUGN6+6g6rCYdffi+h0AbdhNoMFUAelXew6JO6v5hkSPoJVp3fivyI 1oeC0h4bLGH898Oz5fdFFN6tKY2g2W84VgvOTNwPJjNNAtpsAcizYVlvgPqRSwn3aUr8 f9XGnLkIcgNz7sxmZCNJrG0Z4Q5o6EdDSFHOJNqwPR9zwoWjs3ZU7AvVQJgKs2TdfBFB QcUakDJQFDWYf6Tal4GTlXd2UPO3aVjsIFHUXd/1jWZfixJALvgNFFU8fbi4m5L3b6KA zVFsdpvXqjCNTY6qq1PCY+TTM1302Dw72vM84iFmTNmsvjJLPCmbIL3qN4lCI6faGGc9 3IMw== X-Forwarded-Encrypted: i=1; AJvYcCV/CqdC2PqdPS1DPojXrwAmtPvcFyEi+wZD/+YqKBCPe4EKf+F73VO4AqgnvkxtWgxF4O2fHh38fX1y7f7T27Hl41I1sHMdmAnnWzh+ X-Gm-Message-State: AOJu0YxEIkVrkshix4mk6wA7XW8/MvyLwLpYC2bbNq4iQCFqzwNK+935 U2R2fVxPx26vGxh7aQkUTIAE5q5blJNum4SaNVpuBb9iQuaoq09L X-Received: by 2002:a5d:554d:0:b0:33e:6760:6def with SMTP id g13-20020a5d554d000000b0033e67606defmr2195331wrw.56.1709860344707; Thu, 07 Mar 2024 17:12:24 -0800 (PST) Received: from localhost (ec2-18-169-47-158.eu-west-2.compute.amazonaws.com. [18.169.47.158]) by smtp.gmail.com with ESMTPSA id f14-20020a5d50ce000000b0033b66c2d61esm21450770wrt.48.2024.03.07.17.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 17:12:24 -0800 (PST) From: Alex Constantino To: regressions@leemhuis.info Cc: 1054514@bugs.debian.org, airlied@redhat.com, carnil@debian.org, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, kraxel@redhat.com, linux-kernel@vger.kernel.org, regressions@lists.linux.dev, spice-devel@lists.freedesktop.org, timo.lindfors@iki.fi, tzimmermann@suse.de, virtualization@lists.linux-foundation.org, Alex Constantino Subject: [PATCH 1/1] drm/qxl: fixes qxl_fence_wait Date: Fri, 8 Mar 2024 01:08:51 +0000 Message-Id: <20240308010851.17104-2-dreaming.about.electric.sheep@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240308010851.17104-1-dreaming.about.electric.sheep@gmail.com> References: <20240308010851.17104-1-dreaming.about.electric.sheep@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fix OOM scenario by doing multiple notifications to the OOM handler through a busy wait logic. Changes from commit 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait") would result in a '[TTM] Buffer eviction failed' exception whenever it reached a timeout. Fixes: 5a838e5d5825 ("drm/qxl: simplify qxl_fence_wait") Link: https://lore.kernel.org/regressions/fb0fda6a-3750-4e1b-893f-97a3e402b9af@leemhuis.info Reported-by: Timo Lindfors Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054514 Signed-off-by: Alex Constantino --- drivers/gpu/drm/qxl/qxl_release.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index 368d26da0d6a..51c22e7f9647 100644 --- a/drivers/gpu/drm/qxl/qxl_release.c +++ b/drivers/gpu/drm/qxl/qxl_release.c @@ -20,8 +20,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include - #include #include "qxl_drv.h" @@ -59,14 +57,24 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr, { struct qxl_device *qdev; unsigned long cur, end = jiffies + timeout; + signed long iterations = 1; + signed long timeout_fraction = timeout; qdev = container_of(fence->lock, struct qxl_device, release_lock); - if (!wait_event_timeout(qdev->release_event, + // using HZ as a factor since it is used in ttm_bo_wait_ctx too + if (timeout_fraction > HZ) { + iterations = timeout_fraction / HZ; + timeout_fraction = HZ; + } + for (int i = 0; i < iterations; i++) { + if (wait_event_timeout( + qdev->release_event, (dma_fence_is_signaled(fence) || - (qxl_io_notify_oom(qdev), 0)), - timeout)) - return 0; + (qxl_io_notify_oom(qdev), 0)), + timeout_fraction)) + break; + } cur = jiffies; if (time_after(cur, end)) -- 2.39.2