Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp4972147pxb; Mon, 28 Mar 2022 06:19:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJPwNQbCu0nFdWKe6cC/c7u5t6QBSUQFKw9uvIf7b5t3rVtCQfZX2R3nX0ym9RPX4g2+9o X-Received: by 2002:a9d:4712:0:b0:5ad:f2a:6394 with SMTP id a18-20020a9d4712000000b005ad0f2a6394mr9986773otf.281.1648473589713; Mon, 28 Mar 2022 06:19:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648473589; cv=none; d=google.com; s=arc-20160816; b=gSfcvYVJTTs0sV6BF+oT5D/xvPCVa2TWm5cTsydynBPSI1V4vMeOlXwezko8I+D8K5 hVJ6RZMOPCvLe/bHGNtAxpEIqiKptjhj+cUiFPL/e6kSf751Jg75N25ufiVgbtM/ywyb sV6/RAayyp4amC2xuMORD5Wej15OftK4CQkAXndk1NOd8ADo2NTGNYGYKujiFn9EFWLk B1R40PR5O79kacj+UL6wIevhp7V+Ued9VfgV2m69f4uX7ZcRXLLieigYtHZZlcmGvrV0 9opIrV//YGhupz71GJq5haF0w+yvqCvq5rUuhbWzT0Wfl8H/96MB8SXnqYdX0+bizzZp d3Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=r7UI6r0vhzHWJ0DdSAPFuEMXckYJbKdBAO1kRHkhc5Y=; b=emRmOp+Oa3b/mEKlphv6Mfw4moCe9kjkZrVLpd7ves/wlDJQvAuV4DXf/kvlf7It1C kBy3Fg+WN5TU0q2ZC3QaLxlAS8lhtMsAVvApfuh+YGDAL+0FqbkCIWm2vK3RZo5H5nBH rTJsR2YrO9PMA/gxIb6jsah2CF6jL5Oybj9eqK8fjtPrrLv3FvCgarGNM+mkrjknploT EpKQcOFkTithIobbM2ZN6eT/dgcVcY8BzvXfeznzaQxiGFMfPuGX52oeKMEB1aHsDOSu wszzueVzmEA4JNhUqSfPOalNiMf+ofOJVWfDx/7E8x2rUW79TnK5bJyrGWpx7CeoxGWK VKsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=IrGw5fC+; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o4-20020a9d6d04000000b005cb2fc137cbsi9609100otp.71.2022.03.28.06.19.38; Mon, 28 Mar 2022 06:19:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@ibm.com header.s=pp1 header.b=IrGw5fC+; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236772AbiC0XyS (ORCPT + 68 others); Sun, 27 Mar 2022 19:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbiC0XyR (ORCPT ); Sun, 27 Mar 2022 19:54:17 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06F8232999; Sun, 27 Mar 2022 16:52:37 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22RHp42g020397; Sun, 27 Mar 2022 23:52:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=r7UI6r0vhzHWJ0DdSAPFuEMXckYJbKdBAO1kRHkhc5Y=; b=IrGw5fC+bhblv0McpkRKNrHPiWoTbcp7qPAqko9LVIsi27dATC+i4mW+24aPfezh+2VB o/wU4wKc0uupGQLqPwCyzrM3I0RCh1BV6FrMuP55zedCCOxTDaEZ6HoAXvURZsHh4wpG UmT5jcAnzFsiTCCNtDgb4+ZGnxF3wTWjBomHhdvd74gIleomqmtbOMa/v/fRbuN3HpVm k6i7WlPaRN7z+u9H7udlArKTZtIAqRfLevsdPAqg76WD+43qXlWNwMNmejB50hoY0VIP ERQKj2aVeoz9ToNspp0PYpFbu6iK+tTin0InNe8EujWosaTgDYL3/J6xFWD6F7ElV5Z6 DQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f2cm9p13h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 27 Mar 2022 23:52:19 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22RNlYAW008814; Sun, 27 Mar 2022 23:52:18 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f2cm9p137-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 27 Mar 2022 23:52:18 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22RNlhX7020612; Sun, 27 Mar 2022 23:52:16 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 3f1tf8tmwe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 27 Mar 2022 23:52:16 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22RNqEFQ50135528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 27 Mar 2022 23:52:14 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B3584C040; Sun, 27 Mar 2022 23:52:14 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EE6C4C044; Sun, 27 Mar 2022 23:52:13 +0000 (GMT) Received: from li-e979b1cc-23ba-11b2-a85c-dfd230f6cf82 (unknown [9.171.73.54]) by d06av22.portsmouth.uk.ibm.com (Postfix) with SMTP; Sun, 27 Mar 2022 23:52:13 +0000 (GMT) Date: Mon, 28 Mar 2022 01:52:11 +0200 From: Halil Pasic To: Linus Torvalds Cc: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , Robin Murphy , Christoph Hellwig , Maxime Bizon , Oleksandr Natalenko , Marek Szyprowski , Kalle Valo , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Olha Cherevyk , iommu , linux-wireless , Netdev , Linux Kernel Mailing List , Greg Kroah-Hartman , stable , Halil Pasic Subject: Re: [REGRESSION] Recent swiotlb DMA_FROM_DEVICE fixes break ath9k-based AP Message-ID: <20220328015211.296739a4.pasic@linux.ibm.com> In-Reply-To: References: <1812355.tdWV9SEqCh@natalenko.name> <20220324055732.GB12078@lst.de> <4386660.LvFx2qVVIh@natalenko.name> <81ffc753-72aa-6327-b87b-3f11915f2549@arm.com> <878rsza0ih.fsf@toke.dk> <4be26f5d8725cdb016c6fdd9d05cfeb69cdd9e09.camel@freebox.fr> <20220324163132.GB26098@lst.de> <871qyr9t4e.fsf@toke.dk> <20220327054848.1a545b12.pasic@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) Content-Type: text/plain; charset=US-ASCII X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: LIQGtJT-sE34r-gI5wfiZS3vQxX3f983 X-Proofpoint-GUID: -qkeLTOVVipiHtnnCpD3cas1qvCNYQSC Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-27_09,2022-03-24_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 bulkscore=0 adultscore=0 impostorscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203270146 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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-wireless@vger.kernel.org On Sat, 26 Mar 2022 22:21:03 -0700 Linus Torvalds wrote: > On Sat, Mar 26, 2022 at 10:06 PM Linus Torvalds > wrote: > > > > On Sat, Mar 26, 2022 at 8:49 PM Halil Pasic wrote: > > > > > > I agree it CPU modified buffers *concurrently* with DMA can never work, > > > and I believe the ownership model was conceived to prevent this > > > situation. > > > > But that just means that the "ownership" model is garbage, and cannot > > handle this REAL LIFE situation. > > Just to clarify: I obviously agree that the "both sides modify > concurrently" obviously cannot work with bounce buffers. > > People still do want to do that, but they'll limit themselves to > actual cache-coherent DMA when they do so (or do nasty uncached > accesses but at least no bounce buffering). Thanks for the explanation! > > But the "bounce ownership back and forth" model comes up empty when > the CPU wants to read while the DMA is still going on. And that not > only can work, but *has* worked. > > You could have a new "get me a non-ownership copy" operation of > course, Yes, https://www.spinics.net/lists/linux-wireless/msg222442.html was mostly about exploring that idea. > but that hits the problem of "which existing drivers need it?" > > We have no idea, outside of ath9k. > > This is why I believe we have to keep the existing semantics in a way > that keep ath9k - and any number of unknown other drivers - happy. I agree. > > And then for the cases where you want to introduce the zeroing because > you don't know how much data the DMA returned - those are the ones > you'll have to mark some way. I have no intention of pursuing this. When fixing the information leak, I happened to realize, that a somewhat similar situation can emerge when mappings are reused. It seemed like an easy fix, so I asked the swiotlb maintainers, and they agreed. It ain't my field of expertise, and the drivers I'm interested in don't need this functionality. Regards, Halil > > Linus