From patchwork Mon Dec 13 06:34:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 12673143 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 34269C433F5 for ; Mon, 13 Dec 2021 06:35:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB25310EAC8; Mon, 13 Dec 2021 06:35:06 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2055.outbound.protection.outlook.com [40.107.220.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D07310E734; Mon, 13 Dec 2021 06:35:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aZYKXOvKSAdeES6m3vNpb2mpHYaBvJfgFVLlNHbgPm29K3CfPupxouGXGIQmHRo4Gnl+nY+PMq+jdO6d3UR1J9pia3KCnsNQwSnDYg6KDKXOZZZgk++7BQlGN90KE2cxRQF6XJMIdv1FcRLRNmXB4GurE4MBRZrzTI5NCHacoDGTqyu3gjHLRUeE/ViKL9cBK8RalJDAhrYWJ+Zw5YcUXVVBE8QI4OfsdmElB1su24ABBvBSmpgnJlIGRrTEElfXyODR6x6TMFuP51MICL1+/6pkry3Q+zLAciphoGXrsgjat8YIUFydLB0KhzdGqrwoRH04YnNF0HR+jgdM39kFDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=OtFaLkXyIDaegFPZ1ycvUm7Tna4b2hyRVXN0VAM4SYE=; b=PFLLSbOn6YR9ILz/NEvb1jtJ08EdhgDnO57FIKUFGbBZs149BC+XMjbTSDhMEDp+62JkDtFZg1umR+FSvM2g/UTu/9q3i+lNAnx2lAlooCAMnPBn6Xrx5Xcv6AsB0BFpzcwgZPqq8B5PmkafsdXObKJi8QmbpV7z707/lQDU7HZFdS14MzOiYDUGwctv/PzF0207ao13BpyYZg+JN2UC0wPyTfd8IAjEMD6hIdTTDOifhM0xjkQF4frRkQrHiBNxbieqSLizbKRHN/66vu9Zbdk5wGYGK2gu5xrgu8AHNFdvNdcZOI8Y83wRdOGQqqpneAxo5fq3i69wpyQM3wJlBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OtFaLkXyIDaegFPZ1ycvUm7Tna4b2hyRVXN0VAM4SYE=; b=vW0oj2M2ZZfCOiqv9mwbpN9ap0pDNf7yselfdqBSUb2wbzHXofjFdji0MxPw0HmpgMDGb0iJt7Ad/3leYDx8iwSdpIrIAkaE+7dRJ+VTNZ5VNDiPHHb8zwh68sRaDOZCzcOm69akVFoQoFvJiI2sG8Bh2vyJSjLUk/FfgpeBStA= Received: from DM5PR21CA0016.namprd21.prod.outlook.com (2603:10b6:3:ac::26) by MN2PR12MB3325.namprd12.prod.outlook.com (2603:10b6:208:ce::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Mon, 13 Dec 2021 06:35:00 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ac:cafe::77) by DM5PR21CA0016.outlook.office365.com (2603:10b6:3:ac::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.5 via Frontend Transport; Mon, 13 Dec 2021 06:35:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Mon, 13 Dec 2021 06:34:59 +0000 Received: from hr-amd.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 00:34:56 -0600 From: Huang Rui To: , =?utf-8?q?Christian_K=C3=B6nig?= , Daniel Vetter , "Sumit Semwal" Subject: [PATCH 1/3] dma-buf: make the flags can be configured during dma fence init Date: Mon, 13 Dec 2021 14:34:20 +0800 Message-ID: <20211213063422.2232155-1-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75041765-a86d-444e-c086-08d9be02af91 X-MS-TrafficTypeDiagnostic: MN2PR12MB3325:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vVecrs46S7J0or84IWwwun6frnIFPRwBwJ0bZeAiDFTV1VfI/Jk7h1/aUsz4tP890srgL8vTA+u1xA+tgv3jdHvNHA3X30GI3fqfVM6/Xwd4Oyp1+82JNuCyyQ5FAiVrrBNJIN/g0zIZFKEdVXkTHBKX6ict5KERdWpG4gIvZUCJyK+UvWWJ3AfR3P1kVtkS3DzpziWw30cDN/1igfm0ey1ASG5+A/52kZGWG2p10jxvwFIOmwKiCL4buMV9EoRirSV+Yks4cUSB8Luk7OEP+SzxHBppjeo7zn53fdogap/AuCRjWN4EdInNZSrloa1H+tmM32X/C+bL9guvL5QYIGKkuSfSGXL3s1a+15OIE3SXPuZoJ1yvV70YEPCr5DAvK5rXqEYXyL83mO2hIeAsXoD0jI40Yf91rfZqx0SsbyO01EZ8zYiBqun0XWhUAvr52lb76gMCiqgloDw9tEDW8OMrwNyyCAMs+cZ9KdKsZMzseEuKqccLvIlTkHfXvcPIGhLLd1xEjZxqEVoz3vXl467wzs6E+heEfyRqL9d/0BLfTl3+nHaZTJ8EAspekeiBCdu6XA6Cb3nUVP7hzS0khhyeI1eHzj2TCbwC7Y+TIQjoW7reRua3cM4ipVTLZ0c/gRms5rt60aNizz0riyMaMUR/lFYKY2mbZSNBGhV9Umv1ZmVFW8vRgOwpQSC33OGI8tAk1ZyHuGn5aDAHOAZvnMkHeszcViEYTNc41aC8AF7YgY73G+NvTOVGls//efdBhSqOS+rOC6BCEh+KjfT3pE6COwsmF2QBB5uRibcYPPQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(70586007)(36860700001)(5660300002)(110136005)(54906003)(47076005)(40460700001)(316002)(81166007)(508600001)(4326008)(26005)(186003)(16526019)(70206006)(426003)(336012)(2616005)(6666004)(83380400001)(1076003)(8936002)(356005)(8676002)(86362001)(36756003)(82310400004)(2906002)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2021 06:34:59.3631 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 75041765-a86d-444e-c086-08d9be02af91 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3325 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: , Cc: Alex Deucher , Huang Rui , Monk Liu , amd-gfx@lists.freedesktop.org, linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In some user scenarios, the get_timeline_name callback uses the flags to decide which way to return the timeline string name. Once the trace_dma_fence_init event is enabled, it will call get_timeline_name callback to dump the fence structure. However, at this moment, the flags are always 0, and it might trigger some issues in get_timeline_name callback implementation of different gpu driver. So make a member to initialize the flags in dma_fence_init(). Signed-off-by: Huang Rui --- drivers/dma-buf/dma-fence.c | 2 +- include/linux/dma-fence.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 066400ed8841..3e0622bf385f 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -952,7 +952,7 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, fence->lock = lock; fence->context = context; fence->seqno = seqno; - fence->flags = 0UL; + fence->flags = ops->init_flags; fence->error = 0; trace_dma_fence_init(fence); diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index 1ea691753bd3..f9270c5bc07a 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -131,6 +131,13 @@ struct dma_fence_ops { */ bool use_64bit_seqno; + /** + * @init_flags: + * + * The initial value of fence flags (A mask of DMA_FENCE_FLAG_* defined). + */ + unsigned long init_flags; + /** * @get_driver_name: * From patchwork Mon Dec 13 06:34:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 12673141 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 03341C433EF for ; Mon, 13 Dec 2021 06:35:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D10D10EB0B; Mon, 13 Dec 2021 06:35:07 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D77F10E73E; Mon, 13 Dec 2021 06:35:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DLL9Vt33lmUaBduJOHAXWCoel/+PubUfZz/qpPmJriNM8lf0CSWnsZYnDYAxjn7FcuO5FVz1F86lB2VBdzzuxrbj0c/N4AWX9SgRs7yPjO8mwF1zUfsfR+vCMjOlXZsssL3EdB2JWPz8tlR5wCSFiVqL5gsCnEK4y+684q6kkdUi2JKGP9C5S8yIJGJWrNB7mdzcnYVrtNeNGwLh3iKHlIN+oe/J++cFcil84VFBlTdDhnu8eyrhm9ewImVcCURRF83vUscEcxHAVU6vuKBFks6KE/k8GNFax7wWU8Fj518Osyce4EZ53vdeke7x88rY8swBka4VO/t7LykUuNY+Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Mm/yAaZNe59INqbvgSewcslMennb8Fsl1HNjUQ1zTV8=; b=KalzQ1feHmykFt7z6dQ46J/ZRl8qT4OdJ49/nYt+TW9L3vXb9qekSaeUvLjV11kjgHQ/LD65hUV7FAzFf+CYx3ZaFz478D/I8CPcqOHGIJ1Z21U/sGp115jGmY3fh7I7HoNA6bPdfeEfOJtfHKCHHGMV9ob8cPPP4hVuNH+E3xPuuiJTgmUHc76MI9gCHLcTNJzEPby2KZ4uGxYStZ5+QxBbbLqC7jRDEpdvS3t/323wVY1ZnJ9E+Uo11VqQsZ/J8C8GbeCZvqM/bgnDjCUeNi9W+UMn3xZwWV3kFs22doM4u1ONYwN6aFH5CiGJqiIpkDA2gLB5KvLk9Hc85FMwTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mm/yAaZNe59INqbvgSewcslMennb8Fsl1HNjUQ1zTV8=; b=CRE++l3eLnvyPYGb3zb+pfOZk2UPSS4cjkP0vJ6T5ETmclA+OFM4OrArX1RZ26WsQJdgAbE5LW5xJoKoch7/AVrHB/4t6rq1kaTW+zGBw2pUK6jiOCcggnJQW6o/cE0Jn5eK0HGiXX/97T1Yt7aTpqyRwk8GTFv/EAZeExqGQfA= Received: from DM5PR21CA0018.namprd21.prod.outlook.com (2603:10b6:3:ac::28) by SN1PR12MB2511.namprd12.prod.outlook.com (2603:10b6:802:23::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.16; Mon, 13 Dec 2021 06:35:02 +0000 Received: from DM6NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:3:ac:cafe::6f) by DM5PR21CA0018.outlook.office365.com (2603:10b6:3:ac::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.5 via Frontend Transport; Mon, 13 Dec 2021 06:35:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT018.mail.protection.outlook.com (10.13.172.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Mon, 13 Dec 2021 06:35:02 +0000 Received: from hr-amd.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 00:34:59 -0600 From: Huang Rui To: , =?utf-8?q?Christian_K=C3=B6nig?= , Daniel Vetter , "Sumit Semwal" Subject: [PATCH 2/3] drm/amdgpu: fix the fence timeline null pointer Date: Mon, 13 Dec 2021 14:34:21 +0800 Message-ID: <20211213063422.2232155-2-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213063422.2232155-1-ray.huang@amd.com> References: <20211213063422.2232155-1-ray.huang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6e46ac36-ac63-4b8f-0065-08d9be02b1a3 X-MS-TrafficTypeDiagnostic: SN1PR12MB2511:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cyOcf0uL6JO1ZfP3uuoBTLnjv6eiQ2x4JRkQeOgEXb5DjIMUZMeccGAH26BNs6IKut1aO9bsbgEJSbSviHIZ3sTrsRRij98/C8DqSCnZ+/0EEKwiazIfS8O4/kgwfCZnhwOEPGx0XR2Yzs0SkSFWqkqg1cTVo3wdsfd5xn9/LlTooPKvf3AnB52/J3QXdwghjBvkzOuKoS5i7cD+CpC5hxWRpB9hBeL/mqTMJy4SS145IOcPHy7aIsYam9E0GpYI1kkgw7kOwvx2piGBizyNWQGsOGWQHfxUU7VUJxg+hyOh3zwPYB97D5kNHC377zwEPjQp/jon/LqH5TJuzRXh9kne3uE6xXNTXywMMgjMSGpQUkwF7EH08jzWzWgPutRcRIoJcZjUihM6FzJPY1KzUvAH02nYRvPmVexZ+sqJnqKJGevATu+rZcoEoAZJbV+k+bYCvxrwyYYehPR1+ZS9gcpEgVggaaHgzmhOPDvmUF1KTeZZ0fgEB/TQUoYhpzH/zx6jSiLECbF77xQsFJmb/TiAT1spQJxKy9BvOqGt+YZNfxi8MMqWQV/mf/NNE7xadN44ReMlSMgJKwbRMNs+/2Wsrs8JKRPdVdWiAQoHhaoOtw76vL8w2Dwq6gHTszcX7ZACzKeeoywtN3esb7AWQxtqHgqqk4F5cFWf3s1CB8xL7AjLEYQUKncqP2Pi7GOb0svhjBA9xm7URJ6XJi8NyKaICbxLxCOlWb6PZnE7gZF+TbIJJjjli4vzZkTXqGAxddRzVlvrifU5yqOfRQ4FJzv7qo3Vp5i3EhkFeCmOdPA= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(26005)(8936002)(16526019)(6666004)(82310400004)(356005)(4326008)(70586007)(81166007)(336012)(110136005)(8676002)(1076003)(36860700001)(83380400001)(36756003)(7696005)(47076005)(86362001)(54906003)(316002)(2906002)(508600001)(70206006)(186003)(2616005)(5660300002)(40460700001)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2021 06:35:02.8316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e46ac36-ac63-4b8f-0065-08d9be02b1a3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2511 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: , Cc: Alex Deucher , Huang Rui , Monk Liu , amd-gfx@lists.freedesktop.org, linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Initialize the flags for embedded fence in the job at dma_fence_init(). Otherwise, we will go a wrong way in amdgpu_fence_get_timeline_name callback and trigger a null pointer panic once we enabled the trace event here. [ 156.131790] BUG: kernel NULL pointer dereference, address: 00000000000002a0 [ 156.131804] #PF: supervisor read access in kernel mode [ 156.131811] #PF: error_code(0x0000) - not-present page [ 156.131817] PGD 0 P4D 0 [ 156.131824] Oops: 0000 [#1] PREEMPT SMP PTI [ 156.131832] CPU: 6 PID: 1404 Comm: sdma0 Tainted: G OE 5.16.0-rc1-custom #1 [ 156.131842] Hardware name: Gigabyte Technology Co., Ltd. Z170XP-SLI/Z170XP-SLI-CF, BIOS F20 11/04/2016 [ 156.131848] RIP: 0010:strlen+0x0/0x20 [ 156.131859] Code: 89 c0 c3 0f 1f 80 00 00 00 00 48 01 fe eb 0f 0f b6 07 38 d0 74 10 48 83 c7 01 84 c0 74 05 48 39 f7 75 ec 31 c0 c3 48 89 f8 c3 <80> 3f 00 74 10 48 89 f8 48 83 c0 01 80 38 00 75 f7 48 29 f8 c3 31 [ 156.131872] RSP: 0018:ffff9bd0018dbcf8 EFLAGS: 00010206 [ 156.131880] RAX: 00000000000002a0 RBX: ffff8d0305ef01b0 RCX: 000000000000000b [ 156.131888] RDX: ffff8d03772ab924 RSI: ffff8d0305ef01b0 RDI: 00000000000002a0 [ 156.131895] RBP: ffff9bd0018dbd60 R08: ffff8d03002094d0 R09: 0000000000000000 [ 156.131901] R10: 000000000000005e R11: 0000000000000065 R12: ffff8d03002094d0 [ 156.131907] R13: 000000000000001f R14: 0000000000070018 R15: 0000000000000007 [ 156.131914] FS: 0000000000000000(0000) GS:ffff8d062ed80000(0000) knlGS:0000000000000000 [ 156.131923] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 156.131929] CR2: 00000000000002a0 CR3: 000000001120a005 CR4: 00000000003706e0 [ 156.131937] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 156.131942] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 156.131949] Call Trace: [ 156.131953] [ 156.131957] ? trace_event_raw_event_dma_fence+0xcc/0x200 [ 156.131973] ? ring_buffer_unlock_commit+0x23/0x130 [ 156.131982] dma_fence_init+0x92/0xb0 [ 156.131993] amdgpu_fence_emit+0x10d/0x2b0 [amdgpu] [ 156.132302] amdgpu_ib_schedule+0x2f9/0x580 [amdgpu] [ 156.132586] amdgpu_job_run+0xed/0x220 [amdgpu] Signed-off-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index 3b7e86ea7167..e2aa71904278 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -76,7 +76,7 @@ void amdgpu_fence_slab_fini(void) /* * Cast helper */ -static const struct dma_fence_ops amdgpu_fence_ops; +static struct dma_fence_ops amdgpu_fence_ops; static inline struct amdgpu_fence *to_amdgpu_fence(struct dma_fence *f) { struct amdgpu_fence *__f = container_of(f, struct amdgpu_fence, base); @@ -158,21 +158,22 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, struct amd } seq = ++ring->fence_drv.sync_seq; - if (job != NULL && job->job_run_counter) { + if (job && job->job_run_counter) { /* reinit seq for resubmitted jobs */ fence->seqno = seq; + set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &fence->flags); } else { + amdgpu_fence_ops.init_flags = 0; + if (job) + set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, + &amdgpu_fence_ops.init_flags); + dma_fence_init(fence, &amdgpu_fence_ops, &ring->fence_drv.lock, adev->fence_context + ring->idx, seq); } - if (job != NULL) { - /* mark this fence has a parent job */ - set_bit(AMDGPU_FENCE_FLAG_EMBED_IN_JOB_BIT, &fence->flags); - } - amdgpu_ring_emit_fence(ring, ring->fence_drv.gpu_addr, seq, flags | AMDGPU_FENCE_FLAG_INT); pm_runtime_get_noresume(adev_to_drm(adev)->dev); @@ -720,7 +721,7 @@ static void amdgpu_fence_release(struct dma_fence *f) call_rcu(&f->rcu, amdgpu_fence_free); } -static const struct dma_fence_ops amdgpu_fence_ops = { +static struct dma_fence_ops amdgpu_fence_ops = { .get_driver_name = amdgpu_fence_get_driver_name, .get_timeline_name = amdgpu_fence_get_timeline_name, .enable_signaling = amdgpu_fence_enable_signaling, From patchwork Mon Dec 13 06:34:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 12673145 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 8FC95C433F5 for ; Mon, 13 Dec 2021 06:35:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12F9910EB59; Mon, 13 Dec 2021 06:35:13 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88AF310EB4B; Mon, 13 Dec 2021 06:35:07 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lqoC2MEAs8NAus/RETtTQVdfO2L/CeA4MJKFwm6DW79GPYECqQ4VqDFV94ydA0CS0idVRjslAdlH7bFcVz7o60nVIkaRqh0DRFjxJPwjeb6h79UqkNye6VXvNz0DBv/tMCLje5P/qDnxEXfQP+k8wV8x4qeHAc8NN5NBCARNSlmTvr2493wyTGHGpMHiTag45JGg6ijyR7VZHV5cxCuYGa0VMYuTh0gpVuFxClFpoS/cffPMMIZz6gbBfYLr6Ooz7e8Cg2j8+CAL2EWTaLI9qwjEZLUXSDpU+czAnWqWuy2GaOT/P4IC97d5o4NtjJCoCvhJdFVmE4Mm3H4s3k/UCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=YtvEoVgPwbQN7X83Mue1P5Z3FtzkaZmPb3gwvz6ceyM=; b=P9oC5ipaG9QDQ+2QHtVKIPYmcVVlVdgaiqgakB5ijCeXbGz2EFcKZY1ZRErJEC5ocvjyQNPHCbicKSjit/GqsqfT6+h4nutTlqOdlrunUUvLKxr5MjNsUujG54PZtf11SdcHjR+aEVOKLKHaIOkl0nJZrEN0l4ioEK32o+xRfU/Gv8q9ltXQxvk8VILH8szd8aY9XpuxHm5lRHCmF5KGOFcx95XSHnKBa7bV7QhTh193f7/R66jaAXuREHbNOq+tode7+ab9CltgGTKbOGFqYlXSLJ+97uvr0938pi1Yndxjj9Le4ZyoG/6+kKnkmvMTvF9bXhYgHMrKw6ox2h60yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YtvEoVgPwbQN7X83Mue1P5Z3FtzkaZmPb3gwvz6ceyM=; b=W1UO/L7I7K1TC9wVRt//ZZIS+mJ9dq0cGk1J3a1hS94q/ia0ceQ0fHZ0WIwv1w5bEbYuvQ1TJ9a9Bcr7YG/r4rFt80rutuEwriYJfLG/YMTi7bwEFvXcS9n1J7mMOhUAuz8SPd0OZk5N3e+KLgvamb8M0j7a7GVTdZz5RSWgxAc= Received: from DM6PR01CA0026.prod.exchangelabs.com (2603:10b6:5:296::31) by BYAPR12MB3142.namprd12.prod.outlook.com (2603:10b6:a03:de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.16; Mon, 13 Dec 2021 06:35:05 +0000 Received: from DM6NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::60) by DM6PR01CA0026.outlook.office365.com (2603:10b6:5:296::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13 via Frontend Transport; Mon, 13 Dec 2021 06:35:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT045.mail.protection.outlook.com (10.13.173.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4778.13 via Frontend Transport; Mon, 13 Dec 2021 06:35:04 +0000 Received: from hr-amd.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 13 Dec 2021 00:35:01 -0600 From: Huang Rui To: , =?utf-8?q?Christian_K=C3=B6nig?= , Daniel Vetter , "Sumit Semwal" Subject: [PATCH 3/3] drm: fix the warnning of string style for scheduler trace. Date: Mon, 13 Dec 2021 14:34:22 +0800 Message-ID: <20211213063422.2232155-3-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213063422.2232155-1-ray.huang@amd.com> References: <20211213063422.2232155-1-ray.huang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB03.amd.com (10.181.40.144) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 23661121-62b1-495e-eef1-08d9be02b2ba X-MS-TrafficTypeDiagnostic: BYAPR12MB3142:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:256; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WdgqhyvUmWvnUxzNSHNIPHn1yZKE8RCbbvGZ3fSl+UpfNqxj5VgkCPv/M+Q15kReB/rrFWGncCwrZ/EMpiCl6o4WS09LkKpB6ST0NaFwQoernzZxuoz2noL6+JaEeTVhRPksr/7xhGc/qZySZWGfxuXNDR5SbJvt+e76PIqOPdjAhVpO6J5an842bI+96oiQkklL0hksoJpNVcm5i6E4LBYi5xxxhNzgMba7rP50RfmsjzoAZ1UtqBzEm7JlNVb/rynQn1GDCKSqHb3e/FpEb2E1hHo5TMeZUzcv5l1cZtcfJBsdzxIul+29jLmwst44jg7/QaecbJ49qavHiHFf+hyckyI/mmqCB/J2kcvoMMRilUhrO8xhJANHQZODaBgmFWZqEiMLS3yYCnZ7aBwGWLDmesOdoUdWJIQ8vDaKuFJEjeNET1tjHomnL27BgX2eQWJiyGYXvRmICO5E8TY896tV2UEJU/i2Z8suGosuPvZP+v9qykuUaw1hPVFiUpdvvsQPosITn7PWkdFPCMBxoV9LQIo8EauF9WpX/QidSS3qSj+UpusK5UxMF+X+/AfWfG6qhJiK2MPkze23YBPwjDGNjuJqgnyJprrspQNYqUu/QwUJzQK0UeYv4bni9SW65mYsomWebzfmYEO7QRZFDuVa4GnS4yyGeYw2ZEJ7cqvLWSEhZWmCxQZKfdVV0dxoDuZYXgdG0PkEIf/Cyk8HzXIWJYCnlI059XQPg5A9HzfkeRgL7JVd4pA5mnJSJfZEFb8lQWB8G5rhs+45FWqKKjgRuymXJpOWDS1Xg0iS94g= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700001)(26005)(70586007)(5660300002)(7696005)(8936002)(2906002)(86362001)(1076003)(336012)(8676002)(82310400004)(40460700001)(426003)(36860700001)(6666004)(4326008)(16526019)(70206006)(110136005)(83380400001)(186003)(508600001)(316002)(54906003)(36756003)(356005)(81166007)(47076005)(2616005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2021 06:35:04.5880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23661121-62b1-495e-eef1-08d9be02b2ba X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3142 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: , Cc: Alex Deucher , Huang Rui , Monk Liu , amd-gfx@lists.freedesktop.org, linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use __string(), __assign_str() and __get_str() helpers in the TRACE_EVENT() instead of string definitions in gpu scheduler trace. [ 158.890890] ------------[ cut here ]------------ [ 158.890899] fmt: 'entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d ' current_buffer: ' Xorg-1588 [001] ..... 149.391136: drm_sched_job: entity=0000000076f0d517, id=1, fence=000000008dd56028, ring=' [ 158.890910] WARNING: CPU: 6 PID: 1617 at kernel/trace/trace.c:3830 trace_check_vprintf+0x481/0x4a0 Signed-off-by: Huang Rui --- drivers/gpu/drm/scheduler/gpu_scheduler_trace.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h index 877ce9b127f1..4e397790c195 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h @@ -38,6 +38,7 @@ TRACE_EVENT(drm_sched_job, TP_STRUCT__entry( __field(struct drm_sched_entity *, entity) __field(struct dma_fence *, fence) + __string(name, sched_job->sched->name) __field(const char *, name) __field(uint64_t, id) __field(u32, job_count) @@ -48,14 +49,14 @@ TRACE_EVENT(drm_sched_job, __entry->entity = entity; __entry->id = sched_job->id; __entry->fence = &sched_job->s_fence->finished; - __entry->name = sched_job->sched->name; + __assign_str(name, sched_job->sched->name); __entry->job_count = spsc_queue_count(&entity->job_queue); __entry->hw_job_count = atomic_read( &sched_job->sched->hw_rq_count); ), TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", __entry->entity, __entry->id, - __entry->fence, __entry->name, + __entry->fence, __get_str(name), __entry->job_count, __entry->hw_job_count) ); @@ -65,7 +66,7 @@ TRACE_EVENT(drm_run_job, TP_STRUCT__entry( __field(struct drm_sched_entity *, entity) __field(struct dma_fence *, fence) - __field(const char *, name) + __string(name, sched_job->sched->name) __field(uint64_t, id) __field(u32, job_count) __field(int, hw_job_count) @@ -75,14 +76,14 @@ TRACE_EVENT(drm_run_job, __entry->entity = entity; __entry->id = sched_job->id; __entry->fence = &sched_job->s_fence->finished; - __entry->name = sched_job->sched->name; + __assign_str(name, sched_job->sched->name); __entry->job_count = spsc_queue_count(&entity->job_queue); __entry->hw_job_count = atomic_read( &sched_job->sched->hw_rq_count); ), TP_printk("entity=%p, id=%llu, fence=%p, ring=%s, job count:%u, hw job count:%d", __entry->entity, __entry->id, - __entry->fence, __entry->name, + __entry->fence, __get_str(name), __entry->job_count, __entry->hw_job_count) ); @@ -103,7 +104,7 @@ TRACE_EVENT(drm_sched_job_wait_dep, TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence), TP_ARGS(sched_job, fence), TP_STRUCT__entry( - __field(const char *,name) + __string(name, sched_job->sched->name) __field(uint64_t, id) __field(struct dma_fence *, fence) __field(uint64_t, ctx) @@ -111,14 +112,14 @@ TRACE_EVENT(drm_sched_job_wait_dep, ), TP_fast_assign( - __entry->name = sched_job->sched->name; + __assign_str(name, sched_job->sched->name); __entry->id = sched_job->id; __entry->fence = fence; __entry->ctx = fence->context; __entry->seqno = fence->seqno; ), TP_printk("job ring=%s, id=%llu, depends fence=%p, context=%llu, seq=%u", - __entry->name, __entry->id, + __get_str(name), __entry->id, __entry->fence, __entry->ctx, __entry->seqno) );