From patchwork Tue Feb 4 02:45:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Perttunen X-Patchwork-Id: 13958521 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 5CF25C02194 for ; Tue, 4 Feb 2025 02:46:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1FE610E5A3; Tue, 4 Feb 2025 02:46:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.b="PEWjs1SJ"; dkim-atps=neutral Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2082.outbound.protection.outlook.com [40.107.237.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E1BA10E036 for ; Tue, 4 Feb 2025 02:46:22 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fdGhXanY+1ZtFRA2TmS0bPRJ76q6K2jmpJgPTKUjvswA8+4502qGLXnKj3LNuQ2vMkE7YvMy0aXn7s2gdClOTfJKphJAtKvDl8aroGweAWik7SReXxLM12bUNIfaYhNI9j/Tjt/FcU/5oKCgtPWn8IODNY5xLuFx3Fj9/Uc5gGZoIL6+rbgAHhJBVxQ7A0p06ZKenkakDW+Q1cfUS651uK1TIO7kds3DKN5EqfFW51XABFJe+vT4QjVbvSc4g+Wd0QwGBPhQlfWkwb6PQrv0S77tF+zVRvikpOXeJPeO1rnpiAilLRF0R2ZcAEXEG3U9U+cGyU6Vkk0sWYYjsva6sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zrApScMxKgJ9JYnFrLt6cV+3BNG1c8zGNYjFSQrmXpI=; b=VC7XYO5tuWr8yTank5q+gI/LLUH+graIwFvgSmg55KWwKa60ad2MlUr4lTXNgUigwafaJ9WfvOVlBlf0F+CYwYY9Ik2ttvirFQvwPcBuM1mYh1axkuHFRMkXOI6qxfLW413EKEDu7Z6zrynUQQ+ATYLMqob2X//S4BK2C4NPmY4UO0wrwLwsj8IEKFE2GGlv0W76abqYocl7b4g/1AqyZl6QpOBe77KOoOIfMautZk/M/xwVjw7ASfV+nKRpmi2vqyKiyfd7d21JSpYtwY+k2YFQfcFOaG8HNuWq/PFWRHt5RXDblbn425YFxARNg3iZB5HHCTpFKMC60P9TZWrdKw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zrApScMxKgJ9JYnFrLt6cV+3BNG1c8zGNYjFSQrmXpI=; b=PEWjs1SJtnGBz/GF+4bI9XcUi+XiW7hT3Cwj1fRep8Fy8DrpwQTVIzQ1dWpi+itUIwcIhfbBKbwnrYLQiYgvTBKHq1qoZovgrr1ZqDQVUbIVaiMdyThUK/oSpKiUS3aUo37XLln2yHO4MaLYItsXwcqsbgdpvZ2xAKQphq1HNQ2xZ4O7H2e+VCNH+5FZO81m6+FFe9QDTp+cJICmiTgpGju3pxIUeCWeIqR3LlqwouiCEnbr+yDUV2/KmOiw5+uQsSjULCj90kM1DehmW34+rzmGjHcSIGLilzOoMkSY82gOCUDME+Q8quHm/MA/QbhSGRFkft8nNEvJiwbuk6oJYg== Received: from DS7PR03CA0132.namprd03.prod.outlook.com (2603:10b6:5:3b4::17) by DS0PR12MB6392.namprd12.prod.outlook.com (2603:10b6:8:cc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.23; Tue, 4 Feb 2025 02:46:18 +0000 Received: from DS2PEPF0000343C.namprd02.prod.outlook.com (2603:10b6:5:3b4:cafe::c3) by DS7PR03CA0132.outlook.office365.com (2603:10b6:5:3b4::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.21 via Frontend Transport; Tue, 4 Feb 2025 02:46:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS2PEPF0000343C.mail.protection.outlook.com (10.167.18.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.14 via Frontend Transport; Tue, 4 Feb 2025 02:46:18 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Feb 2025 18:46:06 -0800 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Mon, 3 Feb 2025 18:46:06 -0800 Received: from build-mperttunen-jammy-20250115.internal (10.127.8.12) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Mon, 3 Feb 2025 18:46:06 -0800 From: Mikko Perttunen To: Thierry Reding CC: , , "Mikko Perttunen" Subject: [PATCH] gpu: host1x: Remove mid-job CDMA flushes Date: Tue, 4 Feb 2025 02:45:46 +0000 Message-ID: <20250204024546.1168126-1-mperttunen@nvidia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF0000343C:EE_|DS0PR12MB6392:EE_ X-MS-Office365-Filtering-Correlation-Id: d6c79bb5-a7e2-4c72-4856-08dd44c61a06 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: YxNzx0256TkG5OLV4LB0LdH9fqXaMwO/qSsso9xQLOIddfS9uHAlZS/e7zWnP/YSbWK4q4c1xr4VFKHlw+4G/AZ7E9HsMhQvzgEdg6erfOh+MRjzKADeNJaqTvP/joJdDO1h3LNpA80ejdLyX2b4/VsQRKWzIp/ZVq0mRMbjKTmiroK2+FPXtuaU4bErUT3rNbe3mo71u/tfy96N3RMe2TolviuUJVDs1UZsBgZoKTam8x1wsi5LZMJRUXfpBRRVuaJSuBvKi2J7vAemvTExq60KdGcMHE0KXRn/np0/ZV9GtJ2FihQFYteI+6MQ0LU2iUFOe/z/Jk6kMARI3NdeW4e3MyK3aBf+n2uEKmU+0xyer+NSvnkFHVRjk2r3bQCZ+IwFzkrFWu6+Z8uOQ/65TjtEdz/zZF0UfloGBfmzisp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I= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2025 02:46:18.5592 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6c79bb5-a7e2-4c72-4856-08dd44c61a06 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF0000343C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6392 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current code can issue CDMA flushes (DMAPUT bumps) in the middle of a job, before all opcodes have been written into the pushbuffer. This can happen when pushbuffer fills up. Presumably this made sense at some point in the past, but it doesn't anymore, as it cannot lead to more space appearing in the pushbuffer as it is only cleaned full jobs at a time. Mid-job flushes can also cause problems, as in an extreme situation (seen in practice), the hardware can run through the entire pushbuffer including the prefix of a partially written job without the driver being able to process any CDMA updates. This can cause the engine MLOCK to be taken and held for extended periods as the tail of the job is not yet available to hardware. Signed-off-by: Mikko Perttunen --- drivers/gpu/host1x/cdma.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index 407ed9b9cf64..ba2e572567c0 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c @@ -247,8 +247,6 @@ static int host1x_cdma_wait_pushbuffer_space(struct host1x *host1x, trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), CDMA_EVENT_PUSH_BUFFER_SPACE); - host1x_hw_cdma_flush(host1x, cdma); - /* If somebody has managed to already start waiting, yield */ if (cdma->event != CDMA_EVENT_NONE) { mutex_unlock(&cdma->lock); @@ -591,7 +589,6 @@ int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) */ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) { - struct host1x *host1x = cdma_to_host1x(cdma); struct push_buffer *pb = &cdma->push_buffer; u32 slots_free = cdma->slots_free; @@ -599,11 +596,9 @@ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), op1, op2); - if (slots_free == 0) { - host1x_hw_cdma_flush(host1x, cdma); + if (slots_free == 0) slots_free = host1x_cdma_wait_locked(cdma, CDMA_EVENT_PUSH_BUFFER_SPACE); - } cdma->slots_free = slots_free - 1; cdma->slots_used++;