From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30C2A1DE8BF for ; Fri, 9 Jan 2026 08:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767946696; cv=none; b=Ze0nN5qgwmqJRWtMo4NIEtcb49UhlxHxLHxhr3JgQRdxvZ/q7KTPM3tyGV7TYhkvfQKFQpwa5hVSbUYQxTrpEbcikn6j5EkRgrp5LGGUKG/e1i5JwtcI3WwVx5WYF4jejc2RJoEjQrEFs6cU+JpNqMAOQB2WTpl1BqPEd1eZJBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767946696; c=relaxed/simple; bh=1dclAeAmo/kEKTJgPxF3hc0nU/ucwLIlvxkT6ispSeo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=dToLh/zBbhZnCfdqJYIblI2IooL1XeGTXtBtRnTuo824isr4QThkMuwJmE5o00DlIKTyybejJBh64zuMomRmoKg0XiKAAWvJULcaHHWhILVciCeSqIs8lo0+r9JjrhLaIUacRhAHrgDrihEzDVcV7MB6XwEXAmz3D7NeZdbE1To= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ba+I+0MW; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ba+I+0MW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1767946696; x=1799482696; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=1dclAeAmo/kEKTJgPxF3hc0nU/ucwLIlvxkT6ispSeo=; b=ba+I+0MW9j9ojYky4kTdHbfvCcYjdsHIxXb2bVDNcMVbJKkcJsHiQfg8 ecN0QG3iglde8LSvV3Rzovq3pCcuJFKP/kgv8Od7ZEPd7jcidyyjKu/Z9 DqMeiHjpSm9gJuYO8cbLHQ31IXCamXSyMjDU+wqv0Q8M6RKf36BMEHd9P dKOGfrvF+D83XzouMvrQXUaLVI70wZXHTkTezc+Oo5mdKJz4Ovl1gz7gK dr9T9afbEtQlsfTlkOLWu4nCVCp5SOsZUlRFtDxrRXaA9y6mTy/rs7Kjj XBQ6aTPngaLCm8Gaa9aXg33wimwNRu5m9R07SxcE0oAFlaQrtO9It8fGP w==; X-CSE-ConnectionGUID: EUFG7v4CTay4LfKKUy1YJQ== X-CSE-MsgGUID: WLGTBymiRmmUiogOHioNPQ== X-IronPort-AV: E=McAfee;i="6800,10657,11665"; a="79623974" X-IronPort-AV: E=Sophos;i="6.21,212,1763452800"; d="scan'208";a="79623974" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2026 00:18:15 -0800 X-CSE-ConnectionGUID: yHCXLxk+Sw+DerJM4Bzemw== X-CSE-MsgGUID: swLwwOcHSXGGGha3ZSthpw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,212,1763452800"; d="scan'208";a="234596574" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.143]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2026 00:18:11 -0800 From: Jani Nikula To: Aaron Erhardt , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Aaron Erhardt , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND RFC PATCH 1/1] drm: ensure that vblank diff is never negative In-Reply-To: <20260108165139.1381835-2-aer@tuxedocomputers.com> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs Bertel Jungin Aukio 5, 02600 Espoo, Finland References: <20260108165139.1381835-1-aer@tuxedocomputers.com> <20260108165139.1381835-2-aer@tuxedocomputers.com> Date: Fri, 09 Jan 2026 10:18:08 +0200 Message-ID: <686ae9c3d4697956d16eff0b6f2e6e43cb25ba90@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, 08 Jan 2026, Aaron Erhardt wrote: > Handle cases, where drivers report incorrect timestamps and negative > time differences are calculated. If the negative difference is large > enough, negative missed vblanks are reported, but stored in an unsigned > integer which can causes freezes. This patch prevents this case. > > This fix has been verified to fix problems with the i915 driver on > modern Intel CPUs (e.g. Intel Core Ultra 7 155H). Is there a reported bug about this, preferrably with logs? If not, please file one as instructed at [1], and reference the patch. BR, Jani. [1] https://drm.pages.freedesktop.org/intel-docs/how-to-file-i915-bugs.html > > Signed-off-by: Aaron Erhardt > --- > drivers/gpu/drm/drm_vblank.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 94e45ed6869d..1022b6d61e4e 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -1563,7 +1563,14 @@ static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe) > } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0); > > diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time)); > - if (framedur_ns) > + > + /* > + * Make sure no bogus diffs result from negative differences > + * when incorrect timestamps are reported by a driver. > + */ > + if (drm_WARN_ON_ONCE(dev, t_vblank < vblank->time)) > + diff = 0; > + else if (framedur_ns) > diff = DIV_ROUND_CLOSEST_ULL(diff_ns, framedur_ns); -- Jani Nikula, Intel