Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751817AbcLCMjb (ORCPT ); Sat, 3 Dec 2016 07:39:31 -0500 Received: from mail-he1eur01on0108.outbound.protection.outlook.com ([104.47.0.108]:28928 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750917AbcLCMj2 (ORCPT ); Sat, 3 Dec 2016 07:39:28 -0500 X-Greylist: delayed 18955 seconds by postgrey-1.27 at vger.kernel.org; Sat, 03 Dec 2016 07:39:27 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bhuvanchandra.dv@toradex.com; Subject: Re: [PATCH] tty: serial: fsl_lpuart: fix del_timer_sync() vs timer routine deadlock To: Nikita Yushchenko , Stefan Agner References: <1480674490-24718-1-git-send-email-nikita.yoush@cogentembedded.com> <77e2726b8b84c55f9109ff18dfcfbbdf@agner.ch> <9ee78fcd-7aca-e2d3-4df1-fe65a512a0f5@toradex.com> <68d2fd35-834b-fe74-c9a2-719c7b62a83a@cogentembedded.com> CC: Greg Kroah-Hartman , Jiri Slaby , Wei Yongjun , Aaron Brice , Nicolae Rosia , , Chris Healy , From: Bhuvanchandra DV Message-ID: Date: Sat, 3 Dec 2016 15:36:56 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <68d2fd35-834b-fe74-c9a2-719c7b62a83a@cogentembedded.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [106.51.139.89] X-ClientProxiedBy: MA1PR01CA0005.INDPRD01.PROD.OUTLOOK.COM (10.164.117.12) To VI1PR0501MB2397.eurprd05.prod.outlook.com (10.168.135.141) X-MS-Office365-Filtering-Correlation-Id: 1796d7ff-fd27-4be0-9124-08d41b6427aa X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:VI1P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ctB5OYuPYj+K5aXbpwflNAw0YXZ6cakGUtD3OOUhQbi99jEb8 X-Microsoft-Exchange-Diagnostics: 1;VI1PR0501MB2397;31:p2FmhIVrVWqzXRl7nguVSPxppVZIUCD31ZcxprCXzbiFVmFnkJ66ZMyJsijLU2n9dTeHgYXEGp48jKVUF9RvvxsXcNImdcEStw4t/QJlmDgQGDOOQxW0nwqX08lEUH1hm6rk9cAq11RgtEJSLHuB96ZQsMRwZ3JM7Oh/xaWidhRNGjuKjP4Y9kcmdDtk6728mKzZEWwAWKbySlKlUupp7jJrSJ2/qTHb5FKS+tq/fyIlMx+gGB/ba4i9RwyuZe4LeDJhaFJpkFMK9clYl1bXE569sHvqor25v0R3qDhX1dU=;20:m8ZqJ6OnXvKv9lR3Vym1QCklrOiNii6FjOT3+tFn65JHVOOzn2yFUOKjfJv7CBrZh0KlBjI1xeTfXwPwZqvYEEY/BO9CND4mnISBgEfCLbxOHiO3wdBiIuhIGfDNhbM1JvqW+pptbGJJOElc9G49+sMqA5nUeJA1GBrCTIIzKztZgWeTRTyeAw0xXuRa+5jLS53XixiUO62PhPIYdzYn32AhTK4oWZZSEhuNIdPlmgyOJDxfme4inQwTdvn1zeJr8/Bw+ModQ+6WEzWMD4LPk/xE6uvhvDP8bvzbkVr74BZ0lMjrAHEjfnkbEbGQ39CTdWvT8ZJz3+uiYE2UuoWZ7Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6090148)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6042181)(6072148);SRVR:VI1PR0501MB2397;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0501MB2397; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0501MB2397;4:yKDDG/drWZarqi5YLJNL6JdQKpf3o/JYjGZHYM2X5Y5yMQ3425EMQEVJ1bGvy6hudh0rs6xBQfqyvyLLOQFMqc5Xri3OPdQG3EqhWwdHVgC1O5buxh+R9aB6QBE5LQY0xW3cdBcyMvfy0kfd4TCMvrGVaHdwd+dRswWusTbUh3jAhgMit1xYotd2joOVE5u9HCgy01YzCbNpPatO40ILLOBzjIS+rWhyDQqkuk4J3vRtIXvN7kDJDrXwf2NJORyFgPTemtkjYBao+dC1G11+t4+7qXn5xuKz+K47Zp0VYNNQUytXDdREodR04MeDFCsxuwZC1UGoGT8Dt2yNyUnQFQLMslMVBz6fQPQiR44EcA4puTYUecqyNRVVNqi/W7Vcxmc1iXL2G2453JnEKHtgtvsP80x2C4ZrEOg+SVFxWZxA4dyW6NdqxxZn2gBkgdDzxCysZHj9mxWL24vtZn/rOQdGdDmCq1VB65KJV85bkiyQxVs+O9Lnp33YWI7eCEz0rt9C/tHtHjHLajkcEGzr7teAIXNFI7zWuKX0ZvqqDSdFj+w61OLtxykOUque0u5m9iEjT2AIuGflKnkn8NKVF/VNq70KNEGl3DpYQZD0/Rw= X-Forefront-PRVS: 0145758B1D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(377454003)(199003)(24454002)(189002)(3846002)(93886004)(6116002)(189998001)(65956001)(65806001)(66066001)(8676002)(47776003)(5001770100001)(97736004)(33646002)(4001350100001)(4326007)(2906002)(31686004)(42186005)(50986999)(2870700001)(54356999)(101416001)(81166006)(76176999)(81156014)(68736007)(305945005)(7736002)(7846002)(106356001)(105586002)(7416002)(92566002)(65826007)(5660300001)(64126003)(90366009)(50466002)(36756003)(229853002)(23676002)(39060400001)(38730400001)(6666003)(2950100002)(733004)(6486002)(77096006)(86362001)(31696002)(83506001)(9456002)(5009440100003)(20860200003)(32040200003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0501MB2397;H:[10.243.248.147];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUj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amDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0501MB2397;7:J+ijbE9+cEGt/JazO9tkOpM2vkBTCisiMwYKRNFxsRq5FhyQN9GBgn6csvzlT/tk+ylOUf4xOhKONLQa2RZEIbf4BecdIWRwCx/g6H9b458ndLAdq6Kfe0UsDDifmi9dGjzTBzci8Ed57YI6LIX/daaLISk/1ItVUkHleCpHgrR4LH5+G94dYiEssqTszdEvK/8jeIqhSf2DTDqUpQ4srMScHan4oFyjpoAuTpBlXyBUXpqHChn5UbPrN1Al9BvZJ2G2Yxd51uRg148a3bWFa0zgLeZ2uAfxCnlye9ooSZLsbn+tgpfVd5uNam8dz60sNx28jhGuDqWnQPgY5qPlwrwZBvzCLY5Em4BaO+bctfVH4TX5U+lEgdUpwlyWaWyT4rx5i7ng4gAiy9/OJbPRTYY9hVMha6MUaY1iFNSP82k+NkzoZ+WcW/uje/DHKBcsGpU7kB5Eh1dm7Hy7sLzYog== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2016 10:07:12.3516 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2397 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1329 Lines: 43 On 12/03/2016 02:25 PM, Nikita Yushchenko wrote: > > 03.12.2016 10:06, Bhuvanchandra DV пишет: >> On 12/03/2016 02:58 AM, Nikita Yushchenko wrote: >> >>>>> Problem found via lockdep: >>>>> >>>>> - lpuart_set_termios() calls del_timer_sync(&sport->lpuart_timer) while >>>>> holding sport->port.lock >>>>> >>>>> - sport->lpuart_timer routine is lpuart_timer_func() that calls >>>>> lpuart_copy_rx_to_tty() that acquires same lock. >>>>> >>>>> To fix, move Rx DMA stopping out of lock, as it already is in other >>>>> places >>>>> in the same file. >>>>> >>>>> While at it, also make Rx DMA start/stop code to look the same is in >>>>> other places in the same file. >>>> Yeah I saw that too, never really came around to look closer into it. >>>> >>>> Thanks for looking into it. >>>> >>>> You removed the check whether there was an old configuration, I think >>>> the idea of that was that we only resize DMA if it was configured >>>> differently before... >>> Per my code reading, checking for sport->lpuart_dma_rx_use should be >>> enough, this flag will be set only if DMA was previously enabled, >> The check is to make sure the reconfiguration of DMA is done only when >> the baudrate is altered. > Then, ok to use > > if (old && sport->lpuart_dma_rx_use) {...} > > in both places? Looks ok to me. -- Bhuvan