From patchwork Fri Feb 18 10:03:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12751178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD5E9C433FE for ; Fri, 18 Feb 2022 10:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8AZgffVwzjag24MfDiid+WejtXWiHzTsjer1WvKzldc=; b=QmtYLSzJFsR71J +njAsaCEoAnav+zqrLV6BwHyNZgsyxd65P9B+2zpC9NfBAc6oaLHWHw1F0SdACnVTw0Z5YWVR1Sni LrjL5IxQStC8Q8aYJIFi2riW5jksg8nOZRRzMOKY5Z+8cEedQhfzj6k2O6EpqGNgTva/tOMUd11yL /cn0S7BvPhycWl88N17iuUhs4jDrnfpmiC7v/xGYKn09jEHCMVmIDlrXdYJyfBiYFnjUWkmFoLk7e u0TpcI9Mik0Y/VoAmJ6KiBudye/hUXlAQZFrdGWpe0roqR+waF9tqwEZriQsJOqDe5y225QPL6uTo fD7C1v8lySn8IJBOJSrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL07g-00DiuX-Qm; Fri, 18 Feb 2022 10:04:21 +0000 Received: from mga18.intel.com ([134.134.136.126]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nL07c-00Ditn-Pm; Fri, 18 Feb 2022 10:04:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645178656; x=1676714656; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=stdZieqOPeTYM4fZPShDTH9sPVJsu1F9iRmFq4q1S1Y=; b=nGqHbdjkkiGxpL5ZR8h9uqSoX6UTWCt97YPElsB0u9EUNMtaLVx8Exao rdt+cUDyAVx9rW9cmQGQud+fjEJi4Ke7yBPyOuGZGCPeY8pU0SJNtM2FP QRvvKGOByIDceu4A3USB6K57c2wRCwH8xlpumf99Q5IQNXl0+yGpWJMEE N0p9dhcEMbaqHN1E9jVw149yFWfbR1UsJ0gdsMNQ7hRYLDUAtEXnMZzMo 0NrypgAyYislqEfsuSfFZZpPWU69aS12a+bbbnEeVohjvy9hjU2B70IU8 xPQUS9YI30aROE18haev3tywWDs9vBka8w+Peylcl79CVXmxmsoQ80Fwj g==; X-IronPort-AV: E=McAfee;i="6200,9189,10261"; a="234628532" X-IronPort-AV: E=Sophos;i="5.88,378,1635231600"; d="scan'208";a="234628532" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Feb 2022 02:04:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,378,1635231600"; d="scan'208";a="682442318" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.151]) by fmsmga001.fm.intel.com with SMTP; 18 Feb 2022 02:04:04 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 18 Feb 2022 12:04:03 +0200 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, Abhinav Kumar , Alain Volmat , Alex Deucher , amd-gfx@lists.freedesktop.org, Andrzej Hajda , Aurabindo Pillai , Chen Feng , Chun-Kuang Hu , Emma Anholt , freedreno@lists.freedesktop.org, Harry Wentland , =?utf-8?q?Heiko_St=C3=BCbner?= , Jernej Skrabec , John Stultz , Jonas Karlman , Jyri Sarha , Laurent Pinchart , Leo Li , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, Maxime Ripard , Neil Armstrong , Nikola Cornij , Patrik Jakobsson , Philipp Zabel , Rob Clark , Robert Foss , Rodrigo Siqueira , Sam Ravnborg , Sandy Huang , Sean Paul , Thierry Reding , Tian Tao , Tomi Valkeinen , Xinliang Liu , Xinwei Kong Subject: [PATCH 00/22] drm: Review of mode copies Date: Fri, 18 Feb 2022 12:03:41 +0200 Message-Id: <20220218100403.7028-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220218_020416_937550_A3DCE8A9 X-CRM114-Status: GOOD ( 16.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ville Syrjälä I might be taking this a bit too far, but the lack of consistency in our methods to copy drm_display_mode structs around is bugging me. The main worry is the embedded list head, which if clobbered could lead to list corruption. I'd also prefer to make sure even the valid list heads don't propagate between copies since that makes no sense. While going through some of the code I also spotted some very weird on stack copies being made for no reason at all. I elimininated a few of them here, but there could certainly be more lurking in the shadows. Cc: Abhinav Kumar Cc: Alain Volmat Cc: Alex Deucher Cc: amd-gfx@lists.freedesktop.org Cc: Andrzej Hajda Cc: Aurabindo Pillai Cc: Chen Feng Cc: Chun-Kuang Hu Cc: Emma Anholt Cc: freedreno@lists.freedesktop.org Cc: Harry Wentland Cc: "Heiko Stübner" Cc: Jernej Skrabec Cc: John Stultz Cc: Jonas Karlman Cc: Jyri Sarha Cc: Laurent Pinchart Cc: Leo Li Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: Maxime Ripard Cc: Neil Armstrong Cc: Nikola Cornij Cc: Patrik Jakobsson Cc: Philipp Zabel Cc: Rob Clark Cc: Robert Foss Cc: Rodrigo Siqueira Cc: Sam Ravnborg Cc: Sandy Huang Cc: Sean Paul Cc: Thierry Reding Cc: Tian Tao Cc: Tomi Valkeinen Cc: Xinliang Liu Cc: Xinwei Kong Ville Syrjälä (22): drm: Add drm_mode_init() drm/amdgpu: Remove pointless on stack mode copies drm/amdgpu: Use drm_mode_init() for on-stack modes drm/amdgpu: Use drm_mode_copy() drm/radeon: Use drm_mode_copy() drm/bridge: Use drm_mode_copy() drm/gma500: Use drm_mode_copy() drm/hisilicon: Use drm_mode_init() for on-stack modes drm/imx: Use drm_mode_duplicate() drm/msm: Nuke weird on stack mode copy drm/msm: Use drm_mode_init() for on-stack modes drm/msm: Use drm_mode_copy() drm/mtk: Use drm_mode_init() for on-stack modes drm/rockchip: Use drm_mode_copy() drm/sti: Use drm_mode_copy() drm/tilcdc: Use drm_mode_copy() drm/vc4: Use drm_mode_copy() drm/i915: Use drm_mode_init() for on-stack modes drm/i915: Use drm_mode_copy() drm/panel: Use drm_mode_duplicate() drm: Use drm_mode_init() for on-stack modes drm: Use drm_mode_copy() .../gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 41 ++++++++++--------- drivers/gpu/drm/bridge/nwl-dsi.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- drivers/gpu/drm/bridge/tc358767.c | 2 +- drivers/gpu/drm/drm_crtc_helper.c | 12 +++--- drivers/gpu/drm/drm_edid.c | 8 +++- drivers/gpu/drm/drm_modes.c | 21 +++++++++- drivers/gpu/drm/drm_vblank.c | 2 +- drivers/gpu/drm/gma500/oaktrail_crtc.c | 8 +--- drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c | 2 +- drivers/gpu/drm/i915/display/intel_display.c | 20 +++++---- drivers/gpu/drm/imx/imx-ldb.c | 3 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 2 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 9 ++-- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- drivers/gpu/drm/msm/dp/dp_drm.c | 10 ++--- drivers/gpu/drm/panel/panel-truly-nt35597.c | 3 +- .../gpu/drm/panel/panel-visionox-rm69299.c | 4 +- drivers/gpu/drm/radeon/radeon_connectors.c | 4 +- drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- drivers/gpu/drm/rockchip/inno_hdmi.c | 2 +- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 2 +- drivers/gpu/drm/sti/sti_dvo.c | 2 +- drivers/gpu/drm/sti/sti_hda.c | 2 +- drivers/gpu/drm/sti/sti_hdmi.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 2 +- drivers/gpu/drm/vc4/vc4_hdmi.c | 5 +-- include/drm/drm_modes.h | 2 + 30 files changed, 105 insertions(+), 79 deletions(-)