Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2684937rwb; Sun, 4 Sep 2022 22:45:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Z8QFRrkAqDniyInY8brqGYNj7GB5a7tD2GqinNxUNQXQPKy6xDwA4MvLQWn2KZDGLAhSv X-Received: by 2002:a17:907:dab:b0:742:5e2e:6e4 with SMTP id go43-20020a1709070dab00b007425e2e06e4mr19621705ejc.338.1662356748977; Sun, 04 Sep 2022 22:45:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662356748; cv=none; d=google.com; s=arc-20160816; b=RGDZV4JcOU+YQbjashUFNVvBDbI2q2ICDfcjnMwnDZkgWBKBWDvIHy9EtKHuASWoJ5 6iGsqKoV2UaEutHwKimJ3iyqasOoSB2dxKAUIef9gXXfH3lzxMKXzNF71oL8bZb/P4/J 9K4yIzCyA5nzATjpoyDaprav4o+yuTfSwjnvl93FiEAXOW4zY/iMH2Lqze1PqUZIKsTW rhdNqq+5qjWA7/Q8uYkU5psl2i1GDBo+7Htmg6ORmoJb7HLgQ6rxDgyrGI9batSahkww qFCX8nMgOmFghZJAbhFuPCbNWSYu6uoFs29BBPfLyHv+Yj26CiNbYLaSFY3Yc5+6qVpg UpXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=wlCqsPafX9yulBk5PfBssrTc+MGr4mX9ej2/UgRuMXY=; b=G3jXjvgn0oFBvHCgazuFn0MHjgUq4jVBZG+sOAb88sJVvDX2s2mvMvYGDwBeAQvu3l ERjuxQdmWHXWLQduaWDUy7jCdtzhZUkXnWpT8d2AAkDHw5RyYinfTKY7xmExRF9ZE7RB nXF1+aL26j6foH4iboLuM/W5VBaZLYoj1PZB9U65KKEOdvp2PfBJApirpqgUw3FbXz86 +eZj8w9Mhax+u65nqOIdeN5gsjQZw7SaxQX/Slox0OAPLzfjfedEOA6UWcBQe/+b+ZwF n0al7JS0XyVqtK1xGdTJv+QQb0X3PDoFkTuz9uy1LnRpH5nZZcSr9/zpDWNZTusEKjZA U5JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pOEpal5g; dkim=neutral (no key) header.i=@suse.de header.b=Mo3T1Mw8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a05640240ce00b0043e1d52fd9fsi8267429edb.594.2022.09.04.22.45.24; Sun, 04 Sep 2022 22:45:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=pOEpal5g; dkim=neutral (no key) header.i=@suse.de header.b=Mo3T1Mw8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235598AbiIEF2H (ORCPT + 99 others); Mon, 5 Sep 2022 01:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234932AbiIEF2G (ORCPT ); Mon, 5 Sep 2022 01:28:06 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89FC72F002; Sun, 4 Sep 2022 22:28:05 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AE31B5CDE8; Mon, 5 Sep 2022 05:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662355683; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wlCqsPafX9yulBk5PfBssrTc+MGr4mX9ej2/UgRuMXY=; b=pOEpal5gryExhCblB1Sy5QZuby6aT1vk32VBdC+upVOVy60CzdgQdWq4hZys/aZRm36QJP PZsGAsSpTOhJXVBVIUTQLDNdzjZ+yC7zrfSP5sisWmrnIOwZk2gyMZKrQNlBIIkBm0FCQG nXkDWxBfWPAIXW6xb99j/MWXD45qrJM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662355683; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wlCqsPafX9yulBk5PfBssrTc+MGr4mX9ej2/UgRuMXY=; b=Mo3T1Mw8G+rJWSbM2ugfTNkUrAZLlOsLj/K8FBR4+g1j3Pzh6fvtxy5nVp0K0hn4pJqMgR vv4Qqoaxg2EYl+CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8C959139F9; Mon, 5 Sep 2022 05:28:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 7zOEIeOIFWOpRAAAMHmgww (envelope-from ); Mon, 05 Sep 2022 05:28:03 +0000 Date: Mon, 05 Sep 2022 07:28:03 +0200 Message-ID: <874jxml7a4.wl-tiwai@suse.de> From: Takashi Iwai To: Mikhail Gavrilov Cc: Takashi Iwai , Linux List Kernel Mailing , linux-sound@vger.kernel.org Subject: Re: [BUG] commit a8d302a0b77057568350fe0123e639d02dba0745 cause IO_PAGE_FAULT and a lot of errors In-Reply-To: References: <87ilm3vbzq.wl-tiwai@suse.de> <875yi3froa.wl-tiwai@suse.de> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 05 Sep 2022 00:40:48 +0200, Mikhail Gavrilov wrote: > > On Sun, Sep 4, 2022 at 1:51 PM Takashi Iwai wrote: > > Also, please check the patch below instead of the previous one, too. > > If this one works, it'd be a better choice. > > > > I compiled the kernel only with the second patch. > I confirm that patch fixed the described problem. > No new problems were noticed during the day, thanks. > > Tested-by: Mikhail Gavrilov Awesome. Could you try the below one instead? It's a simplified version and applies the workaround more consistently. Once after it's confirmed to work, I'm going to submit a proper patch and merge for the next 6.0 PR. thanks, Takashi --- diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index b665ac66ccbe..cc8459369e41 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -521,6 +521,8 @@ static const struct snd_malloc_ops snd_dma_wc_ops = { /* * Non-contiguous pages allocator */ +static dma_addr_t snd_dma_noncontig_get_addr(struct snd_dma_buffer *dmab, size_t offset); + static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) { struct sg_table *sgt; @@ -543,10 +545,13 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, sg_dma_address(sgt->sgl)); p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt); - if (p) + if (p) { dmab->private_data = sgt; - else + /* store the first page address for convenience */ + dmab->addr = snd_dma_noncontig_get_addr(dmab, 0); + } else { dma_free_noncontiguous(dmab->dev.dev, size, sgt, dmab->dev.dir); + } return p; } @@ -780,6 +785,8 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size) if (!p) goto error; dmab->private_data = sgbuf; + /* store the first page address for convenience */ + dmab->addr = snd_dma_vmalloc_get_addr(dmab, 0); return p; error: diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index a77165bd92a9..b20694fd69de 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1817,7 +1817,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, /* use the non-cached pages in non-snoop mode */ if (!azx_snoop(chip)) - azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC; + azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC_SG; if (chip->driver_type == AZX_DRIVER_NVIDIA) { dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n");