From patchwork Thu Jun 13 12:18:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Vasilev X-Patchwork-Id: 10991643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E56113AD for ; Thu, 13 Jun 2019 12:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CE4428B9D for ; Thu, 13 Jun 2019 12:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 616EC28BBD; Thu, 13 Jun 2019 12:18:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 245F828B9D for ; Thu, 13 Jun 2019 12:18:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 029DC8999A; Thu, 13 Jun 2019 12:18:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 109B589996 for ; Thu, 13 Jun 2019 12:18:20 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2019 05:18:19 -0700 X-ExtLoop1: 1 Received: from ovasilev-desk1.fi.intel.com ([10.237.72.57]) by orsmga001.jf.intel.com with ESMTP; 13 Jun 2019 05:18:17 -0700 From: Oleg Vasilev To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/vkms: stop generating CRCs on buffer overflow Date: Thu, 13 Jun 2019 15:18:01 +0300 Message-Id: <20190613121802.2193-2-oleg.vasilev@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190613121802.2193-1-oleg.vasilev@intel.com> References: <20190613121802.2193-1-oleg.vasilev@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Shayenne Moura , Rodrigo Siqueira Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Because interrupts are generated artifitially, kernel bug may lead to infinte attempts to submit CRC. Signed-off-by: Oleg Vasilev --- drivers/gpu/drm/vkms/vkms_crc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index d7b409a3c0f8..bc717a8888b5 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -167,6 +167,7 @@ void vkms_crc_work_handle(struct work_struct *work) u32 crc32 = 0; u64 frame_start, frame_end; unsigned long flags; + int ret; spin_lock_irqsave(&out->state_lock, flags); frame_start = crtc_state->frame_start; @@ -202,7 +203,14 @@ void vkms_crc_work_handle(struct work_struct *work) * missing frames */ while (frame_start <= frame_end) - drm_crtc_add_crc_entry(crtc, true, frame_start++, &crc32); + { + ret = drm_crtc_add_crc_entry(crtc, true, frame_start++, &crc32); + if (ret) { + DRM_WARN("VKMS stop generating CRCs\n"); + out->crc_enabled = false; + break; + } + } out: /* to avoid using the same value for frame number again */