From patchwork Tue Jul 18 23:34:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wan-Teh Chang X-Patchwork-Id: 4362 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp79399vsb; Tue, 18 Jul 2017 16:35:17 -0700 (PDT) X-Received: by 10.223.173.246 with SMTP id w109mr2598028wrc.113.1500420917865; Tue, 18 Jul 2017 16:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500420917; cv=none; d=google.com; s=arc-20160816; b=OdU6UFXm3h0ozjMzaN9uHBkk7h6bqT5Ba8IQ8n92ZdJ3kiGcgPK6yuLWdbDQrewcvr 7ZM1qOWvIysyH8m8+4t6Fn9AGX61bvgGbYzffYfTBvXt4vxtvaaTyhwuCkD9WsOzhMON TT3riRhBcrF7JMAaxrVlegcXoUxeMG1amH3S4nSCaI7KSOxdxIu9ZjugkHH81EvxkwP9 4WGzRATWYI64GblohjzqKVc7tFqbZt3YAl0obNeaTutXTMdAx7gLzoMZRzOa58iPZOY4 axJ8ip2Ep1/G6uigvYk+gTZMqBDrV3jQs+pFfMIqz/KraQ0PKFtGsRH/ESgU0zjBZY2+ ti5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=wHWx6zh23LP/0nFspC3IVfOPDBfD6yvnAHeaOqv2ZkE=; b=WmFe+3BzkwM0WpNK9mjBv8rwm2EzDmrXGSSJFGqSjkFhf3XZSaq8YECYJaSyIsgGE4 1sDJh3IuB9vEqaliUUrGgOqPC1tkE+NxZN1+ZppOA07kPXrvWnXDgfJVNXFSipYx2Q/2 I1p+/eBcul2wLxw6iDtqMx5i6RTPIqHHzifa8uVmghvvpSaYcL4NJzU8fwOjD9W4EDsh thjXAT2gOG+jb1VAML3FYwkUG6KI5y7VhDdj8/3MTLSjTJAPGTGDSRKGfkWzL4Nptxlw 9tXfFSzIL2DZfUtYFPhVAPjPKKlHftFufqK8L84qjxvD0d2YloPF0SXxHDXUYKkT5sAZ rwYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.b=MSUqFTo+; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o2si2671313wra.335.2017.07.18.16.35.17; Tue, 18 Jul 2017 16:35:17 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.b=MSUqFTo+; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9A6E5689895; Wed, 19 Jul 2017 02:35:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com [209.85.192.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9CCBB689784 for ; Wed, 19 Jul 2017 02:35:00 +0300 (EEST) Received: by mail-pf0-f176.google.com with SMTP id s70so9285944pfs.0 for ; Tue, 18 Jul 2017 16:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:subject:date:message-id; bh=TzwtqZlbVKlHHPW0aLe56DEA7swxJ5kIpHqYLtaIkx4=; b=MSUqFTo+FNW5DdnvCm21RQLojlz+3+MnfPxg7DGVI5XOmBGDbJHM80VyycrAx77u9g xyhDbrAogdofoK5k5Y+swFe+Eh/NIDFt/oLlwYWawiirJRJxvP324VSAlaEHAgTrO05n Ij/Z9CXMa4TR3AE31qxwVbZfWsQQCWhQ0vapGhXbMm7Q0fEM/+ZaV/N5xfFeDRs8vqFw RWxyqZ58KDYRuaRrHTw+5/lDbmJoIeiYLzZxOCcLZkqvmyWCRq8D6lKhfvKa/4xqVKBB yjA7Ew+VFmhPJeOrhifzYInyrJL7s3zKIPedW9UeF2ftjbH/EOjSXmUFqrBBJUAfRX5Z vMnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=TzwtqZlbVKlHHPW0aLe56DEA7swxJ5kIpHqYLtaIkx4=; b=dRtJAbhx2loklTalxs0FdO2m63XGKtF4sH5ptLe6JD84g+zqirrGml4mMgDDHysqKf A9f6nPMl+QGQ67fzqf/tVOE2dBt3q+nsQYPQQjUhajD06GjehJigAGsdUaeBb/sxhjjq PDCNyrWYqmu8HRcivbEtIb84Iy5BVhrSlA9gjTVdn33GoY5OV60uMplcOglioXPS5cD/ 35UjSBIN+smbxIF/Sq+LFc0ymsQhwFtUNqndosPhTZgTyi4/daxPCEhxvK0ThoXA1L6B kjJApHQj8gPGOkrbAR9KxdfonAZB+caB93EPXNuhJEWY9WqbSeKYqKlhkpOrdAIeCdzr H8Mg== X-Gm-Message-State: AIVw111I0uoCPuXxeRRD5A0n1mvtp6zMKZ+H5Y/PZWPipZ8UlSZLKYTv zGFhp8hLbdpu9QM25LosMQ== X-Received: by 10.101.75.197 with SMTP id p5mr90504pgr.164.1500420906026; Tue, 18 Jul 2017 16:35:06 -0700 (PDT) Received: from wtc-desktop.mtv.corp.google.com ([100.98.5.29]) by smtp.googlemail.com with ESMTPSA id r9sm7968669pfi.114.2017.07.18.16.35.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 16:35:04 -0700 (PDT) From: Wan-Teh Chang To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Jul 2017 16:34:40 -0700 Message-Id: <20170718233440.81731-1-wtc@google.com> X-Mailer: git-send-email 2.13.2.932.g7449e964c-goog Subject: [FFmpeg-devel] [PATCH] avcodec/h264_slice: don't sync default_ref[] between threads. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" default_ref[] is unconditionally initialized in h264_initialise_ref_list() (called from ff_h264_build_ref_list(), called from h264_slice_init()). This fixes the following tsan warning when running fate-h264: WARNING: ThreadSanitizer: data race (pid=31070) Write of size 8 at 0x7bbc000082a8 by thread T1 (mutexes: write M1628): #0 memcpy /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:655:5 (ffmpeg+0x10de9d) #1 h264_initialise_ref_list ffmpeg/libavcodec/h264_refs.c:214:29 (ffmpeg+0x1186b3f) #2 ff_h264_build_ref_list ffmpeg/libavcodec/h264_refs.c:306 (ffmpeg+0x1186b3f) #3 h264_slice_init ffmpeg/libavcodec/h264_slice.c:1900:11 (ffmpeg+0x1191149) [..] Previous read of size 8 at 0x7bbc000082a8 by main thread (mutexes: write M1630): #0 memcpy /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:655:5 (ffmpeg+0x10de9d) #1 ff_h264_update_thread_context ffmpeg/libavcodec/h264_slice.c:411:5 (ffmpeg+0x118b7dc) Signed-off-by: Wan-Teh Chang --- libavcodec/h264_slice.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 6deb08fe6d..2fb89b189d 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -408,7 +408,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst, memcpy(&h->poc, &h1->poc, sizeof(h->poc)); - memcpy(h->default_ref, h1->default_ref, sizeof(h->default_ref)); memcpy(h->short_ref, h1->short_ref, sizeof(h->short_ref)); memcpy(h->long_ref, h1->long_ref, sizeof(h->long_ref)); memcpy(h->delayed_pic, h1->delayed_pic, sizeof(h->delayed_pic));