Message ID | 1457943011-20542-1-git-send-email-gnuiyl@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2B6CA9F6E1 for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 14 Mar 2016 08:03:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 604CE2044C for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 14 Mar 2016 08:03:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2BE512046F for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 14 Mar 2016 08:03:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A4D66E614; Mon, 14 Mar 2016 08:03:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0076.outbound.protection.outlook.com [157.56.111.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 36C4D6E03B for <dri-devel@lists.freedesktop.org>; Mon, 14 Mar 2016 08:03:44 +0000 (UTC) Received: from BLUPR0301CA0033.namprd03.prod.outlook.com (10.162.113.171) by BY2PR0301MB2039.namprd03.prod.outlook.com (10.163.196.153) with Microsoft SMTP Server (TLS) id 15.1.427.16; Mon, 14 Mar 2016 08:03:40 +0000 Received: from BN1BFFO11FD009.protection.gbl (2a01:111:f400:7c10::1:166) by BLUPR0301CA0033.outlook.office365.com (2a01:111:e400:5259::43) with Microsoft SMTP Server (TLS) id 15.1.434.16 via Frontend Transport; Mon, 14 Mar 2016 08:03:40 +0000 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; linux.ie; dkim=none (message not signed) header.d=none; linux.ie; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 192.88.168.50 as permitted sender) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD009.mail.protection.outlook.com (10.58.144.72) with Microsoft SMTP Server (TLS) id 15.1.434.11 via Frontend Transport; Mon, 14 Mar 2016 08:03:39 +0000 Received: from victor.ap.freescale.net (victor.ap.freescale.net [10.192.241.62]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u2E83aDB021368; Mon, 14 Mar 2016 01:03:37 -0700 From: Liu Ying <gnuiyl@gmail.com> To: <dri-devel@lists.freedesktop.org> Subject: [PATCH 1/4] gpu: ipu-v3: ipu-dmfc: Protect function ipu_dmfc_init_channel() with mutex Date: Mon, 14 Mar 2016 16:10:08 +0800 Message-ID: <1457943011-20542-1-git-send-email-gnuiyl@gmail.com> X-Mailer: git-send-email 2.5.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131024162201629007; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(189002)(199003)(50466002)(110136002)(4326007)(87936001)(81166005)(47776003)(189998001)(83322999)(81442002)(73972006)(73392002)(2906002)(19580395003)(50986999)(76482005)(5008740100001)(586003)(6260500002)(55446002)(104016004)(6806005)(86362001)(87572001)(1220700001)(1096002)(50226001)(33646002)(11100500001)(77096005)(92566002)(5003940100001)(48376002)(36756003)(106466001)(2351001)(229853001)(105596002)(82202001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB2039; H:tx30smr01.am.freescale.net; FPR:; SPF:SoftFail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD009; 1:VIsdqkPuG8MmB3iCl3Pz+MSI3eBuyIoTyIeL7KtOAeYS/nrGj0/wPY7OE9kFNx5MIDPv1FetzcXgc210/NfXpAzEPASV9vbLXYre0mt7RdzcU2NyGql5c2Y9shcKYy23NSot6avXQYlE6h4AMRhDrQa5hucndY1WyAzM8pvxcNsHKS8rg+ao0h5+jbTRZGCZRaybhVS6nCnZXqQNx94MVwxTfUnVQmnQ0PXZcckOS0cwl8xyJ3gt1Wa4cJQN3cP1SoQnNBHKqFjO+Fb9BKrSCFT8OFrkL3AqRXygUsO60QeloJxjzDD/m/swCDw7e9WFKG/acEifSLfkaz0UmZiRggRQZBLEMEemx16Rok5/urof7aQXIbNE8/DexlqZHQiijuT8p3+T7VH+s9BEn+YDOiAtC+nFvUTjmBuzrF2CC0flFZnOQStP0lWH9+Gt8zbD7Tu+xIeq6BQuAPS12y+ImQFjFcKAzx4EfSS5FvvVZRwcb0hXkqS8PkMvAnZFaFOX MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: cf4bec7d-5ae7-4a37-714f-08d34bdf277c X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2039; 2:y6aFxM6z4kb5YHZuq6dWIf237IJNWtMm5Sx1u6AsiPMakFjLSI23cQk3ypyE6odBIyHwWZr0rQuysY9KDxjNLoZF8pavaJM6nPuNj9Mf0HbpGIFLBJyoo9Ey47pHc327KSis4VIxsy+Xa4r5fXYpazbrSplHdEdxJau7ohTaq7DFUK5vqW15juc7XgDf6882; 3:gl1OK06jJoP0m1Mmpt6DvsxBdeoFmDkE/Rtk3QWDF/kbaHgm3iapwqQPnIGsb5iaUlOLPTihiU5NRthXB5Eem7kswKoNty5PvZuwP5JyLbL8/gi8/6vJW3LxG1wsfaFpdkwbi5VDL+u3AL2c24o16aenb12GoaS7qkpE24CrS+dQee64qxoFYWge6VlR8ux33IjA/Hc3BByRPqzhRasKC/46acFiyQmShj7sw9PS8mE=; 25:T4MeCU8c36Ml0xjl9eL4jOdvOU1gEJoLi2ixm+Yimzji+6Quawrb5doNXxTK3VaYViS5Bl2N9jZJsIzNOSiGJBGJXbshKocJ8ul5QAm76DxuHecDqxra54+AYkzP0rcKiUkodr9tAec4OJJJQ7GtGesG03c3iM8sOk6tREeoCw2aXzH8k46L+u22eT9JB2qGqTbQHcQpdYqGanHORtTGLyjO3tJxZgzViaQuxoacwOGX/CRBqv6nNQSvqQ8vsp6N4GiSQPnJajV5Wg6OYu/3BTNPvyMB/Iq0GF+tTqjOowdDSF1BrmiMTtkzZ0FZGegZYLAW22nTwtY+4rgET2uxAQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB2039; X-Microsoft-Antispam-PRVS: <BY2PR0301MB2039904FB0C06B954BF8AB38DB880@BY2PR0301MB2039.namprd03.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(13023025)(13017025)(13018025)(13024025)(13015025)(10201501046)(3002001); SRVR:BY2PR0301MB2039; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB2039; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2039; 4:gSXBakHNVlyCY8ibmB8YCFlLX+VTfl5O65YExBSfFgujXTd++ssOyAOzd8e4/OGgCuMwV+FR97bE/gpnIA741Cb4SGfSqffvbqisHO8lIb2f7sHMTZsH38RGY0Hp0InxjYYEuxEHoqhOUkQ0Jgv01MsZWevqoxE11kDxc6uV2g8EtyKpzfZA3Tm7B82wPgeFovpfiQQxRUP7HMfxiOa46PppE82GM/JcuNT0eqBDqU8dr7RRkR2fifGH9ySapnLkCf4gq+sb6OulkZL6yMIn+U5HfwYvZ1/eTR3BT1wjyf3zRH7miCGDOymxkHQmmFKtuFRDexkTbFZa5JFoFBWLuq81e3NBidQKggR9i7IANgOmwbaIgXJkZwxCalKpU18PPcvKwkSIvLdPw1gg4eSxGoe03Z/Qdrq8Wovf6u/sRIdy9Ep/BYS/zsdBratgUnY8g/ceZyg6PwQOd5ppYNID0g== X-Forefront-PRVS: 0881A7A935 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB2039; 23:fToOdtVWZBOwaaLdPyGBiFBHJtbKkFluULL094r?= =?us-ascii?Q?MVb/Nvl4Bywu8c0F173lnZwmv0hun0P/u4EDbURUcF1ax1SNINMDnd+k+VOL?= =?us-ascii?Q?/iVb3jAQ8TCuMWTUFKfZZ13RMTcvJQH6xI3hwO8JlfgS1aBIndiBP6bgKH9e?= =?us-ascii?Q?08U65oKdI5ghFh3d/AEog/3QUrfRdmd+Q+HGiblEaxCYFh9x5ApiRG6dByBZ?= =?us-ascii?Q?SHpbPLBMhbo0SjIWdf+wEofY0m39VPk59iGz/Cx3waR9shdGvm+Hc5oQnbvh?= =?us-ascii?Q?YZY9nIgJeSHqR3/caS2qx3qVQRIlXz1P2gDigTItBacWJbSOm5bqDJLaByUW?= =?us-ascii?Q?/zGUQmtp/e46GghxUwR5vqbFebkUX4HabO0BhtHOFhaRf/4yUXjgUl3ItvuI?= =?us-ascii?Q?3KZD2Sspfns4s0s62Lhwbf8QanThthzUTNosKoDysFAqHSiiSZ3vGL3NLWHb?= =?us-ascii?Q?MHt2Agq111Jj/SbG3IOHl21IfrOkVUj6vofRfkOXXIfQjp8rc3W4XIlYA51W?= =?us-ascii?Q?nsLB9Xl0n1XoFFjksbYULYu/Przh6GzAYSyU37LLvfFTac7lhD5RDPbKin07?= =?us-ascii?Q?SsGgwY9NEVg/445UkLfWbs0ejOSHmdGjPVNEWwtwBjSglpTt/2lSh5D7sOuk?= =?us-ascii?Q?oc4Dxx8C+9wXMKadRkmbWKEc5ekn7X0hn187J1rv5uIVCTCnPYo31xaVEh9D?= =?us-ascii?Q?veY3hjvEQqIFrnZTAQHbXTRjrMJaR1PbAl6Lus1KvJqbenB7CG4syeBjBB/U?= =?us-ascii?Q?RKXusecgKpgpM+xUuSFFgaDY7T8yCH3Y2JKRjAobaQFVrWZcTlfZBhWHRBoN?= =?us-ascii?Q?oiOemYSDvmE1S/dWM8YwjmNzOI8CBHA9VsSJdTTSKsU5XYMzQDX/4LE/FPws?= =?us-ascii?Q?Pk3V9S5mvg+x8oqu45wlPN6BhANfx/ziFegwkLRtIBBVnf7XoaFNXh6T1Ffx?= =?us-ascii?Q?u7Bo0/eQqm7i2i7pQMqbtOfWUtKedkwrfbd/wJsyT0qSwFWi6cmfsfJfUuWP?= =?us-ascii?Q?C+t3GYCxsX9Sktclkc3KRKNkCFR5O1lHxbUCx23Z4ln24Vxl/t5U92Ffqua9?= =?us-ascii?Q?eiHe6SwMjG8YKeoH7Cthh9QtwOecDafr8MBF1hFGwbGzy3llYHw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB2039; 5:k2RFPNSz/W8D3nbG1djfcjgbo1unS+X7K/OuigN6NHAanqaHpnCS2RJ2gCsYN8iCd9y3Q4zgp/hF94k5hE2TGD12O5AS4V0fLqOxZYbeeLcS5dPR/kvjn8fkNIo+tATuKILesyLKcdkjPG0tSdXMV6/uBTqe57al1ZSEpuksHAE=; 24:tGUhWyFmGkViO78HhIWaMlSt+XjYPS77U6p5EqcHS818F7SQxjAKOswxWjCSnLF+kk9ZIMkdNwt/ZLgFjoOd3t0/vKclPvCmUmk64Roq25c= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2016 08:03:39.9445 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB2039 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Hi Liu, Am Montag, den 14.03.2016, 16:10 +0800 schrieb Liu Ying: > To avoid race condition issue, we should protect the function > ipu_dmfc_init_channel() with the mutex dmfc->priv->mutex, since it > configures the register DMFC_GENERAL1 at runtime which contains > several control bits for various display channels. This matches > better with fine grained locking logic in upper layer. Applied all four patches, thank you. regards Philipp
diff --git a/drivers/gpu/ipu-v3/ipu-dmfc.c b/drivers/gpu/ipu-v3/ipu-dmfc.c index 042c395..129ccfa 100644 --- a/drivers/gpu/ipu-v3/ipu-dmfc.c +++ b/drivers/gpu/ipu-v3/ipu-dmfc.c @@ -355,6 +355,8 @@ int ipu_dmfc_init_channel(struct dmfc_channel *dmfc, int width) struct ipu_dmfc_priv *priv = dmfc->priv; u32 dmfc_gen1; + mutex_lock(&priv->mutex); + dmfc_gen1 = readl(priv->base + DMFC_GENERAL1); if ((dmfc->slots * 64 * 4) / width > dmfc->data->max_fifo_lines) @@ -364,6 +366,8 @@ int ipu_dmfc_init_channel(struct dmfc_channel *dmfc, int width) writel(dmfc_gen1, priv->base + DMFC_GENERAL1); + mutex_unlock(&priv->mutex); + return 0; } EXPORT_SYMBOL_GPL(ipu_dmfc_init_channel);
To avoid race condition issue, we should protect the function ipu_dmfc_init_channel() with the mutex dmfc->priv->mutex, since it configures the register DMFC_GENERAL1 at runtime which contains several control bits for various display channels. This matches better with fine grained locking logic in upper layer. Signed-off-by: Liu Ying <gnuiyl@gmail.com> --- drivers/gpu/ipu-v3/ipu-dmfc.c | 4 ++++ 1 file changed, 4 insertions(+)