From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751595AbdBYBZH (ORCPT ); Fri, 24 Feb 2017 20:25:07 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:2846 "EHLO dggrg01-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751473AbdBYBZE (ORCPT ); Fri, 24 Feb 2017 20:25:04 -0500 Subject: Re: [RFC][PATCH] drm: kirin: Add a mutex to avoid fb initialization race To: John Stultz References: <1487811383-6915-1-git-send-email-john.stultz@linaro.org> <58AF92A3.2040200@hisilicon.com> CC: lkml , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , Sean Paul , "dri-devel@lists.freedesktop.org" From: liuxinliang Message-ID: <58B0DC3A.4060707@hisilicon.com> Date: Sat, 25 Feb 2017 09:22:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.46.44.48] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.58B0DC33.0013,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d9f8332d6f1d91eafc558fe9ff26db3b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/2/25 5:33, John Stultz wrote: > On Thu, Feb 23, 2017 at 5:55 PM, liuxinliang > wrote: >> Hi John, >> >> On 2017/2/23 8:56, John Stultz wrote: >>> In some cases I've been seeing a race where two framebuffers >>> would be initialized, as kirin_fbdev_output_poll_changed() >>> might get called quickly in succession, resulting in the fb >>> initialization happening twice. This could cause the system >> >> I might understand this race. This because two places call >> drm_helper_hpd_irq_event might cause the race: >> One place is here >> static int kirin_drm_kms_init(struct drm_device *dev) >> { >> ... >> /* force detection after connectors init */ >> (void)drm_helper_hpd_irq_event(dev); >> ... >> } >> >> another is the adv7533 interrupt thread handler >> static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd) >> { >> ... >> if (process_hpd && irq0 & ADV7511_INT0_HPD && adv7511->bridge.encoder) >> drm_helper_hpd_irq_event(adv7511->connector.dev); >> ... >> } >> >> right? >> >> I don't get a better way to fix this yet , I like to put fb_lock into >> kirin_drm_private. > Ok. I've moved the mutex to the kirin_drm_private structure. > > Anything else you'd like to see before I resend? Thanks, no more then. Best, -xinliang > > thanks > -john > > . >