From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F0F3C07E95 for ; Wed, 7 Jul 2021 20:33:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE8F361CBB for ; Wed, 7 Jul 2021 20:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232543AbhGGUgR (ORCPT ); Wed, 7 Jul 2021 16:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbhGGUgQ (ORCPT ); Wed, 7 Jul 2021 16:36:16 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F83C061574 for ; Wed, 7 Jul 2021 13:33:34 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id t3so5104159edt.12 for ; Wed, 07 Jul 2021 13:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RksO08zxXShmv/TbRX/JnQALfaTc9XSb/QqN0uX0Y4c=; b=Y7teMaxBpvvKQ2gnp5u8kzquNml4aUTJpZl5jIW1lKNpT8ve4ZLtzc/vUNwsNvhqtp e0O3MvxbR+K7v8lrbKbXDJQjN+cz35SF8NgNYZLfyFCmlAgWsI44MSKyzjegkMwU+vte 92HL+Ve+mX19cYQvEVbbBWmk4DELZB3xCkswltxfaTeOEyEu6ZespLqNGXkwgTDggNmr 7Xu4l4KUl3MPnitEsBrOQ8uLWDQwKQIKN1CspgpX2TY4zpyZAT34emBtjii2hLQ5Pz2R FB5Bp/m+eDQRrAyXNb/mIBM+UdkhiidNSP6fwcIs9h27GGGPGHQaY8q43ABqQlje4KDt cMCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RksO08zxXShmv/TbRX/JnQALfaTc9XSb/QqN0uX0Y4c=; b=hdvR+a3DUa5wFafcYzlYM2Gt0pzyX3S68ioVxsoh4LqE/g5vbyk/WCnMeT/7ypDmYL kmo1a1RqgL198cB7zfnIz4WpRKYZuJsWEN8mB+LMBUYNQtIvof+5lblZO5jLLrbxYNng gCRsdIcLICl61gSeVADaYEDqLJmAnb7X6xF5W3Lzzu3zkt1Jg+CQDeOMT61XGsek5z+8 3WSezOxvOR5cR2LpkXT1UfXODc0PKpOFfWjGwQfnQkpS6oH+4g8iC/V2rHdWkJp3BHss vk4uywzaQH33cBr70m2iBMrYl1zhAy7VUO+/7sR1DqorpkVbE+FhS28fP7IAFtN8FqLZ Sktw== X-Gm-Message-State: AOAM5331QKtI5vzcgWV/6p8Jnk9nEWQBqq1SOFaNsNIT6QGbNOm8Sc0n IKMy5UEgTfYZz1Aj4DJBvFbB/ZGAE4ruXz0VJZk= X-Google-Smtp-Source: ABdhPJzL4aKhFnDbKJLykRHEyOt/2yk5mRO6vIgkimxjmW2858+h68zn4jLxxbwEIpTXiZisK01GMIBFtDZ8ByOBvSI= X-Received: by 2002:a50:8fc3:: with SMTP id y61mr31809870edy.107.1625690013534; Wed, 07 Jul 2021 13:33:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Max Filippov Date: Wed, 7 Jul 2021 13:33:22 -0700 Message-ID: Subject: Re: ALSA: intel8x0: div by zero in snd_intel8x0_update() To: Takashi Iwai Cc: Sergey Senozhatsky , alsa-devel@alsa-project.org, Leon Romanovsky , Takashi Iwai , LKML , "Gustavo A. R. Silva" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 7, 2021 at 11:14 AM Takashi Iwai wrote: > On Wed, 07 Jul 2021 19:50:07 +0200, Max Filippov wrote: > > It didn't change anything in my case. My further observation is that > > the snd_intel8x0_update is called before the ichdev->prepared > > is set to one and as a result IRQ is apparently never cleared. > > So it's broken in anyway no matter whether > intel8x0_measure_ac97_clock() is called or not, right? The change that you suggested didn't eliminate the call to intel8x0_measure_ac97_clock, it's still called and an interrupt flood happens at the same place. I've also tried the following change instead and it fixes my issue: diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5b124c4ad572..13d1c9edea10 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -692,11 +692,14 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich int status, civ, i, step; int ack = 0; - if (!ichdev->prepared || ichdev->suspended) - return; - spin_lock_irqsave(&chip->reg_lock, flags); status = igetbyte(chip, port + ichdev->roff_sr); + if (!ichdev->prepared || ichdev->suspended) { + spin_unlock_irqrestore(&chip->reg_lock, flags); + iputbyte(chip, port + ichdev->roff_sr, + status & (ICH_FIFOE | ICH_BCIS | ICH_LVBCI)); + return; + } civ = igetbyte(chip, port + ICH_REG_OFF_CIV); if (!(status & ICH_BCIS)) { step = 0; > I'm afraid that something is wrong in VM, then. The driver has been > working over decades on thousands of real different boards. > > Skipping the clock measurement on VM would be still useful, > independent from your problem, though. -- Thanks. -- Max From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5590FC07E95 for ; Wed, 7 Jul 2021 20:34:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7A5E61CBB for ; Wed, 7 Jul 2021 20:34:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7A5E61CBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 589F482C; Wed, 7 Jul 2021 22:33:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 589F482C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1625690074; bh=9qUXM4H2wtZyrMeQ+ei5PDaC7rgS+Ilb1nmD+VJT8mc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HUCDiBJ+lkO1ZUh4FEUdnK2GKgxrLd7q5TavhWCVCQZMGD8dh32J5zROQDbd5/EQx EzhGeC8Bn5KTiTD4GB3I8IVUd3eCvXk4MFaMkUAhbZAqDqAgLDhPixb7j2t7pu8gNR bDZaYUCMGgwxRpfG012Q7eBZ19R+5qW97hmEwKus= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CC7BDF8016C; Wed, 7 Jul 2021 22:33:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1CEB5F80224; Wed, 7 Jul 2021 22:33:42 +0200 (CEST) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ACD61F8012F for ; Wed, 7 Jul 2021 22:33:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ACD61F8012F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y7teMaxB" Received: by mail-ed1-x529.google.com with SMTP id h2so5176583edt.3 for ; Wed, 07 Jul 2021 13:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RksO08zxXShmv/TbRX/JnQALfaTc9XSb/QqN0uX0Y4c=; b=Y7teMaxBpvvKQ2gnp5u8kzquNml4aUTJpZl5jIW1lKNpT8ve4ZLtzc/vUNwsNvhqtp e0O3MvxbR+K7v8lrbKbXDJQjN+cz35SF8NgNYZLfyFCmlAgWsI44MSKyzjegkMwU+vte 92HL+Ve+mX19cYQvEVbbBWmk4DELZB3xCkswltxfaTeOEyEu6ZespLqNGXkwgTDggNmr 7Xu4l4KUl3MPnitEsBrOQ8uLWDQwKQIKN1CspgpX2TY4zpyZAT34emBtjii2hLQ5Pz2R FB5Bp/m+eDQRrAyXNb/mIBM+UdkhiidNSP6fwcIs9h27GGGPGHQaY8q43ABqQlje4KDt cMCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RksO08zxXShmv/TbRX/JnQALfaTc9XSb/QqN0uX0Y4c=; b=sF10R9Q2zEP+ZaX+5PB8xf35++y3tUBe9hXr3sAg+ZHzYBgm35+ASBQOd7ruA50Lyq HTXOQe9RieyeMigGUWpgWHIzJyVCoyUogPrbWdJFpj1rpBOK5ZK4uYrhZJUA/w1xEo+g MLVshpiCkX6v9NQC4KYRmzaE1t7dhUw+K3Jl8K4euo9FYPPf9JIDp4Ju8xlI2657q7m1 OVtSABmc38x0Yk8tjIchy275fn9/wvleA1A5TfXK4our+bIG62ggoTTXo3iSeKXHQS6l siweoSEDgo+fO8JqntJJ7lEBRoC2tCwRlw+V/gsNSIl7/BTOkkB8UbBB40wdUcUH1tZi h68g== X-Gm-Message-State: AOAM533bAvHi0zOsZ33POieCeQNHOsFU0lDnylSj3F528qJkI5EWJ8lL DMv1cAVdd2t+GvBWv5ikapddUEZLvdLkhPzUnvo= X-Google-Smtp-Source: ABdhPJzL4aKhFnDbKJLykRHEyOt/2yk5mRO6vIgkimxjmW2858+h68zn4jLxxbwEIpTXiZisK01GMIBFtDZ8ByOBvSI= X-Received: by 2002:a50:8fc3:: with SMTP id y61mr31809870edy.107.1625690013534; Wed, 07 Jul 2021 13:33:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Max Filippov Date: Wed, 7 Jul 2021 13:33:22 -0700 Message-ID: Subject: Re: ALSA: intel8x0: div by zero in snd_intel8x0_update() To: Takashi Iwai Content-Type: text/plain; charset="UTF-8" Cc: alsa-devel@alsa-project.org, Leon Romanovsky , LKML , "Gustavo A. R. Silva" , Takashi Iwai , Sergey Senozhatsky X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Wed, Jul 7, 2021 at 11:14 AM Takashi Iwai wrote: > On Wed, 07 Jul 2021 19:50:07 +0200, Max Filippov wrote: > > It didn't change anything in my case. My further observation is that > > the snd_intel8x0_update is called before the ichdev->prepared > > is set to one and as a result IRQ is apparently never cleared. > > So it's broken in anyway no matter whether > intel8x0_measure_ac97_clock() is called or not, right? The change that you suggested didn't eliminate the call to intel8x0_measure_ac97_clock, it's still called and an interrupt flood happens at the same place. I've also tried the following change instead and it fixes my issue: diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 5b124c4ad572..13d1c9edea10 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -692,11 +692,14 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich int status, civ, i, step; int ack = 0; - if (!ichdev->prepared || ichdev->suspended) - return; - spin_lock_irqsave(&chip->reg_lock, flags); status = igetbyte(chip, port + ichdev->roff_sr); + if (!ichdev->prepared || ichdev->suspended) { + spin_unlock_irqrestore(&chip->reg_lock, flags); + iputbyte(chip, port + ichdev->roff_sr, + status & (ICH_FIFOE | ICH_BCIS | ICH_LVBCI)); + return; + } civ = igetbyte(chip, port + ICH_REG_OFF_CIV); if (!(status & ICH_BCIS)) { step = 0; > I'm afraid that something is wrong in VM, then. The driver has been > working over decades on thousands of real different boards. > > Skipping the clock measurement on VM would be still useful, > independent from your problem, though. -- Thanks. -- Max