Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1965711pxb; Fri, 25 Mar 2022 08:46:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6UW3od8CL52PxG3vKHFgPWbz1QbwohMS1QImueh8RuM+9PUPijYIt/wcpohUYptXBJFpz X-Received: by 2002:a17:90b:4a0d:b0:1c6:f480:b7f2 with SMTP id kk13-20020a17090b4a0d00b001c6f480b7f2mr25586561pjb.79.1648223169262; Fri, 25 Mar 2022 08:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648223169; cv=none; d=google.com; s=arc-20160816; b=Aiu8l4S4we2Rx08ku7h7fBr5MbKyKfbmGUkJPByxnYI1HUwl4/hEcZD3X24BE4dHHh urphYnVacVrnGa9bBZzDUFT35+G0nXQcMUY5DqpaozD3r7Rm1RcptRyqp2Uu9JTn795V J1QeQ7Kfnau7ZbqxcoTuEh68BfDeAa6B9sjO9bmW+yt0vRImd7f5XTftM9IBlu5QvC1P 7iVSDleBvIprqMMM70koTwkJ0DqtVZiVoYhCcY5hjGqlHF5wbjcmedTTm/GBIKC+SZVW MpMCQGzmj36QWYw/VfwasLXCXMkN/T6BiZkyALv37WEmUttmFrmk29dK8MfJTuo3n7MG OdGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0kZDRe244Ho+56p1lKIcy0+GT4xOH+L25rK8rNrmj5M=; b=wZAw5KZZSshZg8t2ja0vW2vSNyrwvWV9dHT4qICmDtN1ClHRWTvbb3jcB17sN1Rzkh lJGO+CdjGjS+VmCxjmm1hW7479lGXPGgf+l2jGoFs/Zi7cCvUGh4z70M9dXBqEzfx9sM knDD3FUgGO9CS0UrohVUpXeiRPPfTRp+wcKZbkqhk95zNAHZO585/iZN7ureKDmz1quj vP2DyDHMeogkboKOCFCdp+GTjLhlVYavXuycOUvyCRWhl7rH97k6J8MCOCazXDHqlKrS bBHaMatUeow9MGS8eRRKdKGAZLnEXA5Ai1j1VQjNVe2lPXYzGYTYNeVIsON8vCGtEMdG KQpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=xTLCXRCN; 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=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c22-20020a056a00249600b004fa3a8e0026si3449999pfv.221.2022.03.25.08.45.54; Fri, 25 Mar 2022 08:46:09 -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=@natalenko.name header.s=dkim-20170712 header.b=xTLCXRCN; 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=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349474AbiCXK0w (ORCPT + 99 others); Thu, 24 Mar 2022 06:26:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbiCXK0u (ORCPT ); Thu, 24 Mar 2022 06:26:50 -0400 Received: from vulcan.natalenko.name (vulcan.natalenko.name [104.207.131.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 873AD45798 for ; Thu, 24 Mar 2022 03:25:15 -0700 (PDT) Received: from spock.localnet (unknown [83.148.33.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vulcan.natalenko.name (Postfix) with ESMTPSA id 46336E4A5DD; Thu, 24 Mar 2022 11:25:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=natalenko.name; s=dkim-20170712; t=1648117508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0kZDRe244Ho+56p1lKIcy0+GT4xOH+L25rK8rNrmj5M=; b=xTLCXRCNMwAKN6C6abDkvpf8K2mg/Sm4GaWSCsryLwp5Fq4HqX8lUoEohqBSWrzOqMIaix kRFT7EmZ97tKbHZfyY4//hxr65jVGb/7gVgp7+S6tP4fJ8p1HUuP7h1jt5+OqhjIlCJgG2 yc1FDX9OJ6CAbtcVZklteEyyfX7d5Cw= From: Oleksandr Natalenko To: Robin Murphy , Christoph Hellwig Cc: Linus Torvalds , Halil Pasic , Christoph Hellwig , Marek Szyprowski , Toke =?ISO-8859-1?Q?H=F8iland=2DJ=F8rgensen?= , Kalle Valo , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Olha Cherevyk , iommu , linux-wireless , Netdev , Linux Kernel Mailing List , Greg Kroah-Hartman , stable Subject: Re: [REGRESSION] Recent swiotlb DMA_FROM_DEVICE fixes break ath9k-based AP Date: Thu, 24 Mar 2022 11:25:06 +0100 Message-ID: <4386660.LvFx2qVVIh@natalenko.name> In-Reply-To: <20220324055732.GB12078@lst.de> References: <1812355.tdWV9SEqCh@natalenko.name> <20220324055732.GB12078@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" 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 Hello. On =C4=8Dtvrtek 24. b=C5=99ezna 2022 6:57:32 CET Christoph Hellwig wrote: > On Wed, Mar 23, 2022 at 08:54:08PM +0000, Robin Murphy wrote: > > I'll admit I still never quite grasped the reason for also adding the=20 > > override to swiotlb_sync_single_for_device() in aa6f8dcbab47, but I thi= nk=20 > > by that point we were increasingly tired and confused and starting to=20 > > second-guess ourselves (well, I was, at least). I don't think it's wron= g=20 > > per se, but as I said I do think it can bite anyone who's been doing=20 > > dma_sync_*() wrong but getting away with it until now. If ddbd89deb7d3= =20 > > alone turns out to work OK then I'd be inclined to try a partial revert= of=20 > > just that one hunk. >=20 > Agreed. Let's try that first. >=20 > Oleksandr, can you try the patch below: >=20 >=20 > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c > index 6db1c475ec827..6c350555e5a1c 100644 > --- a/kernel/dma/swiotlb.c > +++ b/kernel/dma/swiotlb.c > @@ -701,13 +701,10 @@ void swiotlb_tbl_unmap_single(struct device *dev, p= hys_addr_t tlb_addr, > void swiotlb_sync_single_for_device(struct device *dev, phys_addr_t tlb_= addr, > size_t size, enum dma_data_direction dir) > { > - /* > - * Unconditional bounce is necessary to avoid corruption on > - * sync_*_for_cpu or dma_ummap_* when the device didn't overwrite > - * the whole lengt of the bounce buffer. > - */ > - swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE); > - BUG_ON(!valid_dma_direction(dir)); > + if (dir =3D=3D DMA_TO_DEVICE || dir =3D=3D DMA_BIDIRECTIONAL) > + swiotlb_bounce(dev, tlb_addr, size, DMA_TO_DEVICE); > + else > + BUG_ON(dir !=3D DMA_FROM_DEVICE); > } > =20 > void swiotlb_sync_single_for_cpu(struct device *dev, phys_addr_t tlb_add= r, >=20 With this patch the AP works for me. Thanks. =2D-=20 Oleksandr Natalenko (post-factum)