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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 087C3C433EF for ; Tue, 8 Mar 2022 16:30:55 +0000 (UTC) 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 75968172B; Tue, 8 Mar 2022 17:30:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 75968172B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1646757053; bh=W9dElgi4Wx08lrXUpbo7Hw/HPCKx7EyX1sVOO6YHXpY=; h=Date:Subject:To:References:From:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nlyGgG7sffCDknX8k9CCn+LhFGPUbcNvDHHhqs1IKA4HPXgva3UpiuSD3c8j94yQY jO6NlBQvl1ZCP/S2cim3YisxGV2rImShfmnGkLOvsdpM7WyfnbeSXgHweJ/M50DZ+t rntT1wY2STY01TZzleTXfdjycY5fSqhWsdl/j2GQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DC00BF80121; Tue, 8 Mar 2022 17:30:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CA326F8026A; Tue, 8 Mar 2022 17:29:58 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0E946F800D2 for ; Tue, 8 Mar 2022 17:29:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0E946F800D2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IWqPnRY/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646756994; x=1678292994; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=W9dElgi4Wx08lrXUpbo7Hw/HPCKx7EyX1sVOO6YHXpY=; b=IWqPnRY/uNPG3dCLp4KLFAA84entEO0fAt/j+2W5BBUOqxyrEA4k0jlc w0BtuPjJCghInQlPgTBkQ12zT4KCA090CoenysGtNXk6F6yMg5HxVC9TF lkrU/xd2OGV0HeciB3pxvreO4kKzxVuNqvQ68+1NKI3kBoqcqvaxNMa+V hRMq5jf8agK+RMa2jH0oYUd+fPaLhcv8CdiOFryCGokB/YEe+R9DmQRgD kcKg36w0ILSOV4jL8c3XrYawpT3PlsAeJ78PU/PyoD4/P1awHVcKUOLKV ukHwf7mk+L+fVn7B4jYagYhkIRtmyKfyJh7ZqX1bESLyXLB4GbPIWjS6z A==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="234685393" X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="234685393" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 08:29:25 -0800 X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="553685100" Received: from aslawinx-mobl.ger.corp.intel.com (HELO [10.99.249.183]) ([10.99.249.183]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 08:29:23 -0800 Message-ID: Date: Tue, 8 Mar 2022 17:29:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait Content-Language: en-US To: Kai Vehmanen , alsa-devel@alsa-project.org, tiwai@suse.de References: <20220308141112.880662-1-kai.vehmanen@linux.intel.com> From: =?UTF-8?Q?Amadeusz_S=c5=82awi=c5=84ski?= In-Reply-To: <20220308141112.880662-1-kai.vehmanen@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Ramalingam C , intel-gfx@lists.freedesktop.org, Lucas De Marchi 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 3/8/2022 3:11 PM, Kai Vehmanen wrote: > If kernel is built with hung task detection enabled and > CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set to less than 60 seconds, > snd_hdac_i915_init() will trigger the hung task timeout in case i915 is > not available and taint the kernel. > > Split the 60sec wait into a loop of smaller waits to avoid this. > > Cc: Lucas De Marchi > Co-developed-by: Ramalingam C > Signed-off-by: Ramalingam C > Signed-off-by: Kai Vehmanen > --- > sound/hda/hdac_i915.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c > index 454474ac5716..6219de739b56 100644 > --- a/sound/hda/hdac_i915.c > +++ b/sound/hda/hdac_i915.c > @@ -143,7 +143,8 @@ static bool i915_gfx_present(void) > int snd_hdac_i915_init(struct hdac_bus *bus) > { > struct drm_audio_component *acomp; > - int err; > + unsigned long wait = 0; I'm not sure if it is best name for variable that is set to 0 ("false"), maybe `done` would be better? Especially looking at condition in the following for loop. > + int err, i; > > if (!i915_gfx_present()) > return -ENODEV; > @@ -159,9 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus) > if (!acomp->ops) { > if (!IS_ENABLED(CONFIG_MODULES) || > !request_module("i915")) { > - /* 60s timeout */ > - wait_for_completion_timeout(&acomp->master_bind_complete, > - msecs_to_jiffies(60 * 1000)); > + /* max 60s timeout */ > + for (i = 0; !wait && i < 60; i++) > + wait = wait_for_completion_timeout(&acomp->master_bind_complete, > + msecs_to_jiffies(1000)); > } > } > if (!acomp->ops) { > > base-commit: fd7698cf0858f8c5e659b655109cd93c2f15cdd3 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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3216C433EF for ; Tue, 8 Mar 2022 16:29:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0AE2A10E2B4; Tue, 8 Mar 2022 16:29:52 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E744310E29B for ; Tue, 8 Mar 2022 16:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646756990; x=1678292990; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=W9dElgi4Wx08lrXUpbo7Hw/HPCKx7EyX1sVOO6YHXpY=; b=EuF9W5JLEWzOxvcc889dyCy14LcWI6StgI4Fw+zF2mlAcCLdnYvHNG0G 6UIRzhaHKD+2/enJR6VGadg/+7lvluz4YQZ9djd5Xw8Zsw6izPFHYvvb6 ffaKetRCT0Z72OTsckHy3xlI+5jqD8Km1u4MCLGyfRMMmC3SwoFFdiU1A bNkPqICYeTNYFSXf1LyYWQKL//hq4Zl9AO28/wHYQR5LMAWzjRutxgWFx uBRdCY/L0GM/LdkpTdeArfebuLx6B6GM7sW7sdUO17YFRJiCEr7XDCzen JeLb/rWJYZy99NpNDtmXC//g1ZvON1lqwIwD1aMq8UReyaeGf4OMrhqIp Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10280"; a="315447177" X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="315447177" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 08:29:25 -0800 X-IronPort-AV: E=Sophos;i="5.90,165,1643702400"; d="scan'208";a="553685100" Received: from aslawinx-mobl.ger.corp.intel.com (HELO [10.99.249.183]) ([10.99.249.183]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2022 08:29:23 -0800 Message-ID: Date: Tue, 8 Mar 2022 17:29:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: Kai Vehmanen , alsa-devel@alsa-project.org, tiwai@suse.de References: <20220308141112.880662-1-kai.vehmanen@linux.intel.com> From: =?UTF-8?Q?Amadeusz_S=c5=82awi=c5=84ski?= In-Reply-To: <20220308141112.880662-1-kai.vehmanen@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH] ALSA: hda/i915 - avoid hung task timeout in i915 wait X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, Lucas De Marchi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 3/8/2022 3:11 PM, Kai Vehmanen wrote: > If kernel is built with hung task detection enabled and > CONFIG_DEFAULT_HUNG_TASK_TIMEOUT set to less than 60 seconds, > snd_hdac_i915_init() will trigger the hung task timeout in case i915 is > not available and taint the kernel. > > Split the 60sec wait into a loop of smaller waits to avoid this. > > Cc: Lucas De Marchi > Co-developed-by: Ramalingam C > Signed-off-by: Ramalingam C > Signed-off-by: Kai Vehmanen > --- > sound/hda/hdac_i915.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c > index 454474ac5716..6219de739b56 100644 > --- a/sound/hda/hdac_i915.c > +++ b/sound/hda/hdac_i915.c > @@ -143,7 +143,8 @@ static bool i915_gfx_present(void) > int snd_hdac_i915_init(struct hdac_bus *bus) > { > struct drm_audio_component *acomp; > - int err; > + unsigned long wait = 0; I'm not sure if it is best name for variable that is set to 0 ("false"), maybe `done` would be better? Especially looking at condition in the following for loop. > + int err, i; > > if (!i915_gfx_present()) > return -ENODEV; > @@ -159,9 +160,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus) > if (!acomp->ops) { > if (!IS_ENABLED(CONFIG_MODULES) || > !request_module("i915")) { > - /* 60s timeout */ > - wait_for_completion_timeout(&acomp->master_bind_complete, > - msecs_to_jiffies(60 * 1000)); > + /* max 60s timeout */ > + for (i = 0; !wait && i < 60; i++) > + wait = wait_for_completion_timeout(&acomp->master_bind_complete, > + msecs_to_jiffies(1000)); > } > } > if (!acomp->ops) { > > base-commit: fd7698cf0858f8c5e659b655109cd93c2f15cdd3