Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3789475ybi; Mon, 29 Jul 2019 12:39:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9FUfpGqr4Nu9XMUCpYWLCax0at4Nl6Lq38tENm5ySFhL5mZx4rPwQqwOhSqaM11T3vQQJ X-Received: by 2002:a17:902:fe14:: with SMTP id g20mr105493674plj.54.1564429173930; Mon, 29 Jul 2019 12:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429173; cv=none; d=google.com; s=arc-20160816; b=N1QSTTJZvdeo7oMdGTigD45x6PQTFatr0r7hl+5/J5qvKSbiBRiB1xdF60AquoTMue FhLeE12KbnJ9/Ckb9tuTQ2trxB/YGSLeIn1vmx7qDYFc0BB99ftdVMPwA13vGZMIZb7A ssMlizJmU4Un+50k1SCIG2bk+2bAHUSchHVtVtj+eYKpZz8thHbmJkUYsIZpTBIqXnLS 0pNamOcOYXowamhBG/+pDciqrNztRw62t2ufry9Ga39ySXD3enTjrvzFaUMRk+zCTeG/ anO0s9E1K4nSM6hmZdUSWxOWOMVnyzEpGdrRrqBdpvqtmOkziY6+qdRGKAcLXPBxf57f DQ/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PM3TXz2CWHTrkjp/U6wpCHhgN0jQCjvL8YYqpP0N3DM=; b=OYCuSBQDPmIj+bu+rXQcZ21GgOu6CBOn8PNM1X7tT44O6W7wqe4gd74NKZ3k3QwP+p 2w42Qpjy7r4ceucb7t4J7xBpRL3rGWv4sCEWJO7J1abzaf0LY/UdEE0iDF6T87AgRVti DmN3HTQfs7u7aCXwOsDMrYe2vp4DUA0JdZMxcVZRjq+A7KCNcdMU/2cakKzOOqhRzO9Y 7EyQl6fkqTdG4fOgqXklea2W/n3dRwhoPEYtsYvk2Yi0ROAEK8zuTlg+b1DVv6D9b+wh r2w7A4TY01Azagfr2nFWzwa0R3pYKG3QaAk0YJTJ7yxZOQKOtOYIt4W06m8MTqa8LYg+ di/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zg+Zl8L+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k72si31100581pge.95.2019.07.29.12.39.19; Mon, 29 Jul 2019 12:39:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zg+Zl8L+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388814AbfG2Th7 (ORCPT + 99 others); Mon, 29 Jul 2019 15:37:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:52918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388795AbfG2Th6 (ORCPT ); Mon, 29 Jul 2019 15:37:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 51E082171F; Mon, 29 Jul 2019 19:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429077; bh=6gK9q/3ixP2ypfFCq5avtOjd/FjOrw4fbcEoMIVTtc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zg+Zl8L+d/s9H7zBh7/cTQb2c+ITgHkwI3zdvvy22qDbZBP5T4iswy3NOe3x9BNCu wGOaOC//3fcFTK4rAV8Rg6jE13JgSTJeGASaEG5V/fgILOsPMnC2rX9MeOqtQWzMzl QmC/ol0xJLMCPaCGwgpNHKYYm9LnZGjRiu82D3Kc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maarten Lankhorst , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Sasha Levin Subject: [PATCH 4.14 278/293] drm/crc: Only report a single overflow when a CRC fd is opened Date: Mon, 29 Jul 2019 21:22:49 +0200 Message-Id: <20190729190845.576584535@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit a012024571d98e2e4bf29a9168fb7ddc44b7ab86 ] This reduces the amount of spam when you debug a CRC reading program. Signed-off-by: Maarten Lankhorst [mlankhorst: Change bool overflow to was_overflow (Ville)] Reviewed-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20180418125121.72081-1-maarten.lankhorst@linux.intel.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_debugfs_crc.c | 9 ++++++++- include/drm/drm_debugfs_crc.h | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 021813b20e97..f689c75474e5 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -139,6 +139,7 @@ static int crtc_crc_data_count(struct drm_crtc_crc *crc) static void crtc_crc_cleanup(struct drm_crtc_crc *crc) { kfree(crc->entries); + crc->overflow = false; crc->entries = NULL; crc->head = 0; crc->tail = 0; @@ -373,8 +374,14 @@ int drm_crtc_add_crc_entry(struct drm_crtc *crtc, bool has_frame, tail = crc->tail; if (CIRC_SPACE(head, tail, DRM_CRC_ENTRIES_NR) < 1) { + bool was_overflow = crc->overflow; + + crc->overflow = true; spin_unlock(&crc->lock); - DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n"); + + if (!was_overflow) + DRM_ERROR("Overflow of CRC buffer, userspace reads too slow.\n"); + return -ENOBUFS; } diff --git a/include/drm/drm_debugfs_crc.h b/include/drm/drm_debugfs_crc.h index 7d63b1d4adb9..b225eeb30d05 100644 --- a/include/drm/drm_debugfs_crc.h +++ b/include/drm/drm_debugfs_crc.h @@ -43,6 +43,7 @@ struct drm_crtc_crc_entry { * @lock: protects the fields in this struct * @source: name of the currently configured source of CRCs * @opened: whether userspace has opened the data file for reading + * @overflow: whether an overflow occured. * @entries: array of entries, with size of %DRM_CRC_ENTRIES_NR * @head: head of circular queue * @tail: tail of circular queue @@ -52,7 +53,7 @@ struct drm_crtc_crc_entry { struct drm_crtc_crc { spinlock_t lock; const char *source; - bool opened; + bool opened, overflow; struct drm_crtc_crc_entry *entries; int head, tail; size_t values_cnt; -- 2.20.1