From patchwork Sun Apr 1 15:53:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Steinar H. Gunderson" X-Patchwork-Id: 10527 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1SEN6u-0006qT-IE for patchwork@linuxtv.org; Sun, 01 Apr 2012 17:54:32 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp for id 1SEN6t-0003Nm-JK; Sun, 01 Apr 2012 17:54:32 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948Ab2DAPyV (ORCPT ); Sun, 1 Apr 2012 11:54:21 -0400 Received: from cassarossa.samfundet.no ([129.241.93.19]:40864 "EHLO cassarossa.samfundet.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752560Ab2DAPyF (ORCPT ); Sun, 1 Apr 2012 11:54:05 -0400 Received: from pannekake.samfundet.no ([2001:700:300:1800::dddd] ident=unknown) by cassarossa.samfundet.no with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1SEN6R-0001VG-Sf; Sun, 01 Apr 2012 17:54:04 +0200 Received: from sesse by pannekake.samfundet.no with local (Exim 4.72) (envelope-from ) id 1SEN6R-0008Nk-Jp; Sun, 01 Apr 2012 17:54:03 +0200 From: "Steinar H. Gunderson" To: linux-media@vger.kernel.org Cc: "Steinar H. Gunderson" Subject: [PATCH 10/11] Ignore timeouts waiting for the IRQ0 flag. Date: Sun, 1 Apr 2012 17:53:50 +0200 Message-Id: <1333295631-31866-10-git-send-email-sgunderson@bigfoot.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <20120401155330.GA31901@uio.no> References: <20120401155330.GA31901@uio.no> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.4.1.154227 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' From: "Steinar H. Gunderson" As others have noticed, sometimes, especially during DMA transfers, the IRQ0 flag is never properly set and thus reads never return. (The typical case for this is when we've just done a write and the en50221 thread is waiting for the CAM status word to signal STATUSREG_DA; if this doesn't happen in a reasonable amount of time, the upstream libdvben50221.so will report errors back to mumudvb.) I have no idea why this happens more often on SMP systems than on UMP systems, but they really seem to do. I haven't found any reasonable workaround for reliable polling either, so I'm making a hack -- if there's nothing returned in two milliseconds, the read is simply assumed to have completed. This is an unfortunate hack, but in practice it's identical to earlier behavior except with a shorter timeout. Signed-off-by: Steinar H. Gunderson --- drivers/media/dvb/mantis/mantis_hif.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c index a3ec2a2..0da3c6d 100644 --- a/drivers/media/dvb/mantis/mantis_hif.c +++ b/drivers/media/dvb/mantis/mantis_hif.c @@ -45,11 +45,19 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca) struct mantis_pci *mantis = ca->ca_priv; int rc = 0; + /* + * HACK: Sometimes, especially during DMA transfers, and especially on + * SMP systems (!), the IRQ-0 flag is never set, or at least we don't get it + * (could it be that we're clearing it?). Thus, simply wait for 2 ms and then + * assume we got an answer even if we didn't. This works around lots of CA + * timeouts. The code with 500 ms wait and -EREMOTEIO is technically the + * correct one, though. + */ if (wait_event_timeout(ca->hif_opdone_wq, test_and_clear_bit(MANTIS_SBUF_OPDONE_BIT, &ca->hif_event), - msecs_to_jiffies(500)) == 0) { + msecs_to_jiffies(2)) == 0) { - dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num); + dprintk(MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout ! (ignoring)", mantis->num); rc = -EREMOTEIO; } dprintk(MANTIS_DEBUG, 1, "Smart Buffer Operation complete");