From patchwork Tue Mar 6 03:53:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Monk" X-Patchwork-Id: 10260671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 35ED7602C8 for ; Tue, 6 Mar 2018 04:06:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BB1728C1A for ; Tue, 6 Mar 2018 04:06:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FDC428C1F; Tue, 6 Mar 2018 04:06:27 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 7E4ED28C1E for ; Tue, 6 Mar 2018 04:06:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54B488966B; Tue, 6 Mar 2018 04:06:25 +0000 (UTC) X-Original-To: dri-devel@freedesktop.org Delivered-To: dri-devel@freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0051.outbound.protection.outlook.com [104.47.41.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7F83889E5B for ; Tue, 6 Mar 2018 04:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=OVqv9W6pSrEKw0eTAWKfUE1C7VaH4r6Y4mWDx4qInj4=; b=ENyDLDlrhbRw48hxVebXVEp4jFihhkOHhyn06CWyr7dSXffWur9pQ/DYlfQMsTe7yIog8opQPdFNdvK62XutNZsL8ahSYvju6ruTS6oWsCWfIg6o+1N+pCBgQCbUDHw2VIyF4uymhqFx+XMFk9Kmr+CM1bbltvBm9XlceFM5Vzc= Received: from DM5PR12CA0050.namprd12.prod.outlook.com (2603:10b6:3:103::12) by DM2PR12MB0031.namprd12.prod.outlook.com (2a01:111:e400:3c10::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.548.13; Tue, 6 Mar 2018 04:06:21 +0000 Received: from BY2NAM03FT052.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::204) by DM5PR12CA0050.outlook.office365.com (2603:10b6:3:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.567.12 via Frontend Transport; Tue, 6 Mar 2018 04:06:21 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; freedesktop.org; dkim=none (message not signed) header.d=none;freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT052.mail.protection.outlook.com (10.152.85.223) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.527.18 via Frontend Transport; Tue, 6 Mar 2018 04:06:20 +0000 Received: from monk-build.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.382.0; Mon, 5 Mar 2018 22:06:17 -0600 From: Monk Liu To: Subject: [PATCH] dma-buf/reservation: should keep later one in add fence(v2) Date: Tue, 6 Mar 2018 11:53:10 +0800 Message-ID: <1520308390-32469-1-git-send-email-Monk.Liu@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(39380400002)(39860400002)(376002)(396003)(2980300002)(428003)(189003)(199004)(5660300001)(336012)(77096007)(2906002)(72206003)(104016004)(356003)(1857600001)(26005)(51416003)(186003)(7696005)(53936002)(105586002)(59450400001)(106466001)(6666003)(97736004)(305945005)(50466002)(2351001)(48376002)(53416004)(6916009)(50226002)(36756003)(316002)(8676002)(86362001)(68736007)(81166006)(478600001)(16586007)(81156014)(8936002)(47776003)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR12MB0031; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT052; 1:/EfewqQn/ufxOGR5GSbvaGW97lUGbf7M+nrYZ/HDd3P7G1xnmxorhSeb9sv+fglbEEbOOMMVl9+Kca+reHa83oUqU/+xFqHi4ZzrxTi8UvlX1jjb3qriOHtmAnyqbqqO X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 40408473-b263-4d06-7848-08d583179e7b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603328)(7153060); SRVR:DM2PR12MB0031; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0031; 3:I6QHIF6ReKo0Tdw3S8JGMdAEIiZoMLe1erpXFTTBqY/UhMT6y57p8e80z8O1HeobAfeptOPcvUNf3dtwOCq4zIqOGL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PXXT0IgRhCSlrZSwsrEyreOvMeTBt1RnFROga5DsxK4MVkxShVdUkuGw9ChGOVV6umHV49kXF7Q7SpqtzJS8IKYLJkVUcdiRS9SRW9z6nERrnQjFplpuNbV1JrRp2FzK/4ng5VDAoXeqHXnwuxyuBG3T8wyLAZhDDklVZMiEaCrxRfgGAmaNpKsXDHJblq1r7hwFknNaRSLqWS9dKGrtvXb2S+Emu9rqSUIRRj3oks/NjDcX90QFccQ5RiKIhb0Lpw70Ml/UUfItU5dPcjK1KwybJb+FWb+t6UT3qc0+mzKgA5uNfMqoxZ9C6pbCw/LGKpafyHTqJlD6xvKEW0Fi8ExPQ0u50wU6FjruQnVEXpEk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231220)(944501244)(52105095)(93006095)(93003095)(6055026)(6041288)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DM2PR12MB0031; BCL:0; PCL:0; RULEID:; SRVR:DM2PR12MB0031; X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0031; 4:oET/kYPzfB2XCqF1VD50+lQqsaKRQx6w8oG+JX8d1BEpdigEWCNv0f+ul74Iq/asFedcyuVCBfgKiREvNMOKcAh1gC9flVY7AJo8Wpz0q/8edA1S7WeYhqAaYK7m3BfQF4TuqMFLe/2028il3EQtVeTVEIYok3D8INdjMfnd93O+xGQeuLRiTTn7c1BO/Jrfx+pmWJ1gJWBHOUhqTMkPkZBgQOsVvy4PXfJQIzhQTTMiNMdhPGQ2oYdxSBWWm75nLgjh4+03+AZiX24WDrYsT/1aLwQzWRlqreEhwLySAuRczxY9BB2pSVZbEeIbdUqy X-Forefront-PRVS: 06036BD506 X-Microsoft-Exchange-Diagnostics: =?us-ascii?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PuEpZ8=; 24:CEXNMnHkkMAjn7ROw10Vcopq91vvTmLEyRT5gauxKC95oRP/S/WJHXFkO6RuQLcvkRKP4nYbADTFjuuebLm5oye8zhi54JnwG01Xpw1FJRE=; 7:Yfa2umozH+xkdviYSqD0j5ItLRAQVuMaaZHq8G3QL1yVCj4mOqiKjnEj4kkuGjsbPhT56rAUdBygK8K6IsvH5cowm0qIfRXIdco0an1X4Ub+Th/7YiXEpRMVKZCZXPPSZtq5rmhth0FO5rE8eKIAWk6oz6AGP1HBRyueCtSSHtG2SErXAqfDjoYfJL1J/JceyZLyaMoVQeIEAy+Cgrj8wGXgci//amhTA/GiMG0RXC/JvQvTc6HZLwncTGQNzGw1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR12MB0031; 20:/YqU0s1+ff4Pzr6YRZHbHucj0ZxQjG1fyovbk6unCaAfhYqhuL8g2WhkxDm5w8oQBNFB3uTVFqop4YvedbkVH1hgzv/QEFP4z2kVni0oHGrHpoNCLGVqhFSvU5fqjEqpPc/Foc24B2ZXjVspbReuhhMnYb1J//eCKApBHw20IFYXS/bei2KUk3q6Sy0naBlOjmYd8bCbi0syCpCyl0duAgkvNmtItCESTU/RR5oiV0c2hPcxFBrW1QiU0KBXKD02 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2018 04:06:20.7608 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40408473-b263-4d06-7848-08d583179e7b 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=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR12MB0031 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: Monk Liu Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP v2: still check context first to avoid warning from dma_fence_is_later apply this fix in add_shared_replace as well Change-Id: If6a979ba9fd6c923b82212f35f07a9ff31c86767 Signed-off-by: Monk Liu --- drivers/dma-buf/reservation.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index 314eb10..c6e3c86 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c @@ -118,7 +118,8 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, old_fence = rcu_dereference_protected(fobj->shared[i], reservation_object_held(obj)); - if (old_fence->context == fence->context) { + if (old_fence->context == fence->context && + dma_fence_is_later(fence, old_fence)) { /* memory barrier is added by write_seqcount_begin */ RCU_INIT_POINTER(fobj->shared[i], fence); write_seqcount_end(&obj->seq); @@ -179,7 +180,8 @@ reservation_object_add_shared_replace(struct reservation_object *obj, check = rcu_dereference_protected(old->shared[i], reservation_object_held(obj)); - if (check->context == fence->context || + if ((check->context == fence->context && + dma_fence_is_later(fence, check)) || dma_fence_is_signaled(check)) RCU_INIT_POINTER(fobj->shared[--k], check); else