From patchwork Sun Feb 17 15:34:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Lock X-Patchwork-Id: 16899 Received: from localhost ([127.0.0.1] helo=www.linuxtv.org) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1U76Hj-0006ww-J4; Sun, 17 Feb 2013 16:36:11 +0100 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1U76HG-0006w2-I9 for vdr@linuxtv.org; Sun, 17 Feb 2013 16:36:10 +0100 X-tubIT-Incoming-IP: 78.46.108.116 Received: from gelbbaer.kn-bremen.de ([78.46.108.116] helo=smtp.kn-bremen.de) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1U76HG-0001rY-Dc; Sun, 17 Feb 2013 16:35:42 +0100 Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 775451E000EC; Sun, 17 Feb 2013 16:35:41 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.5/8.14.4) with ESMTP id r1HFYPsh065571; Sun, 17 Feb 2013 16:34:25 +0100 (CET) (envelope-from vdr-l@triton8.kn-bremen.de) Received: (from vdr-l@localhost) by triton8.kn-bremen.de (8.14.5/8.14.3/Submit) id r1HFYPi9065570; Sun, 17 Feb 2013 16:34:25 +0100 (CET) (envelope-from vdr-l) From: Juergen Lock Date: Sun, 17 Feb 2013 16:34:25 +0100 To: vdr@linuxtv.org Message-ID: <20130217153425.GA65533@triton8.kn-bremen.de> References: <20130216154636.GA21094@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130216154636.GA21094@triton8.kn-bremen.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.2.17.152722 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' LEO_OBFU_SUBJ_RE 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_FOUND 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CD 0, __CT 0, __CT_TEXT_PLAIN 0, __FORWARDED_MSG 0, __HAS_FROM 0, __HAS_MSGID 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __USER_AGENT 0' X-LSpam-Score: -1.1 (-) X-LSpam-Report: No, score=-1.1 required=5.0 tests=BAYES_00=-1.9, RDNS_NONE=0.793 autolearn=no Cc: vdr@dolze.de Subject: Re: [vdr] Device bonding X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: vdr-bounces@linuxtv.org Errors-To: vdr-bounces@linuxtv.org On Sat, Feb 16, 2013 at 04:46:36PM +0100, Juergen Lock wrote: > Hi! > > [...] > 3. Running with these four tuners (dual DVB-T and the bonded two DVB-S2) > I get two different deadlocks waiting for cDvbTuner::bondMutex > after live viewing a DVB-T(!) channel for longer (OSD doesn't > react anymore and attaching gdb reveals two threads waiting for > bondMutex) - the following two changes make it work but there > probably is a better fix: (patch may apply with offsets; one > of the problems I think is a lock order reversal with cDvbTuner::mutex > and bondMutex when cDvbTuner::SetChannel calls back into itself > with bondMutex held.) > > --- dvbdevice.c.orig > +++ dvbdevice.c > @@ -476,8 +476,10 @@ void cDvbTuner::SetChannel(const cChanne > t->SetChannel(NULL); > } > } > - else if (strcmp(GetBondingParams(Channel), BondedMaster->GetBondingParams()) != 0) > + else if (strcmp(GetBondingParams(Channel), BondedMaster->GetBondingParams()) != 0) { > + bondMutex.Unlock(); > BondedMaster->SetChannel(Channel); > + } > } > cMutexLock MutexLock(&mutex); > if (!IsTunedTo(Channel)) > @@ -761,7 +773,12 @@ bool cDvbTuner::SetFrontend(void) > tone = SEC_TONE_ON; > } > int volt = (dtp.Polarization() == 'V' || dtp.Polarization() == 'R') ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18; > - if (GetBondedMaster() != this) { > +#if 1 > + if (bondedTuner && !bondedMaster) > +#else > + if (GetBondedMaster() != this) > +#endif > + { > tone = SEC_TONE_OFF; > volt = SEC_VOLTAGE_13; > } > Hmm looks like I posted too soon, the first hunk is actually too much and causes other deadlocks (like when trying to play a DVB-S channel via streamdev while live viewing another), so the patch I'm not testing becomes: Sorry, Juergen --- dvbdevice.c.orig +++ dvbdevice.c @@ -761,7 +773,12 @@ bool cDvbTuner::SetFrontend(void) tone = SEC_TONE_ON; } int volt = (dtp.Polarization() == 'V' || dtp.Polarization() == 'R') ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18; - if (GetBondedMaster() != this) { +#if 1 + if (bondedTuner && !bondedMaster) +#else + if (GetBondedMaster() != this) +#endif + { tone = SEC_TONE_OFF; volt = SEC_VOLTAGE_13; }