Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1777265pxb; Wed, 30 Mar 2022 09:53:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpuyEDeJKg0jZwyJopAswlzyQ0YCUy+/qEsQrXLF/sSJkx5+2QdRHo44bE/Q6OmQjlAe6V X-Received: by 2002:a17:907:1ca3:b0:6e0:5a9:37a1 with SMTP id nb35-20020a1709071ca300b006e005a937a1mr439192ejc.651.1648659238656; Wed, 30 Mar 2022 09:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648659238; cv=none; d=google.com; s=arc-20160816; b=WGww9D5632JMcgfzkwWrOmwGYmA66lbxgTiI0E3E54BM160U/sAsMrHUTSEjUjbqez GpwJxeP/Du8ylA71i1Zwz1sEgat2EWPjssUYipd9qFIoSFkiDB9VezZQv2JadkipSXLW YHthxEoLELRpn52RUNgRThM+myVPoEdXnRpwlFt1enF/p59Olp/uR7HMQGacwtUIkY0H 0H+wz95iTPI7LBfolw10bS/X5Qgp+pSxtGHIBCpVjQ5h3Mbk1HD/C43cOIxRgc634cB0 b0axWIW5PlIzgHwSKmIBiLErIM5ySzz/8mstxx/Jf+2bX8elP/y3IqjuTgXRU4GxBNj0 rwfg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=MUFVyysUdoPdz+GQhkqKxHsF7V7+5wuBxTvpNCjkBHQ=; b=gBC8QFF3XZWc/PS0CeZfclzEkut3qN8MWQ6o4hxV4WdjVpnfVudB11uILtjSHP1fPT 6QLLi2zGJvRY39l1+v4J2TTfSEif3VkxQ/OW93f/hZiBDVhWrHvveG+jjLYwCxk//T0F 299VrcsAbQOutsDCU68iQg+eO1Dk96pZUDo5H2ydPfylcbtxNTblhX4wL/V9LfvtYYEb MFUe4Dr4IrMAVOFaMvIxpMFsU+Ul/pAQ3N2a1nkFw3oUbuXfjDZPr49L5d02bYEkVDI+ pz0cel35b/0gE2zA2+y380WZjJG9fN8+Lqa5IMzZJlTwcXNxf5cPs9TL2wNa3ouOCmDV GZWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=PDYKOx3w; 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 j22-20020a170906535600b006df76385d5dsi20361259ejo.509.2022.03.30.09.53.35; Wed, 30 Mar 2022 09:53:58 -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=PDYKOx3w; 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 S241771AbiC3Mac (ORCPT + 68 others); Wed, 30 Mar 2022 08:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349036AbiC3M1K (ORCPT ); Wed, 30 Mar 2022 08:27:10 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B917E2B5199; Wed, 30 Mar 2022 05:12:28 -0700 (PDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22UBQkFs026930; Wed, 30 Mar 2022 12:12:02 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 : mime-version : content-type : content-transfer-encoding; s=pp1; bh=MUFVyysUdoPdz+GQhkqKxHsF7V7+5wuBxTvpNCjkBHQ=; b=PDYKOx3wxUFSnsD7R97b2PQoJ5lgQO2Md4e0CiPdZD5viSXuSelavKL/RHn/pev1mZMH X+45fRDnJWiU4Qwo/fKAPjsdCoZ/VKMrp/JR1/KOFB2Pb5dEnpCoVy64Jvp1P2uOcbij SG9lrdCnuQptxKFW27X/W35PEO1VeyKsE+XlP9Jyzg/jauief+Y4ho64RNXzfY2O6zgY 2AEFumF8FepOXwntvvmfbjvntAzpC0MRBoMQuSQ/tFcZ5N9L8SzBoHzHd5X22uq+6/JM dze6ewWnew8a1HgX6CceO7eXHRpAK+bGgDEAtxNNIOPO97XPzanjTM4fs8hZ1IA/y/gT yQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f4pbcgxdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Mar 2022 12:12:02 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 22UBdOnf017794; Wed, 30 Mar 2022 12:12:02 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3f4pbcgxcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Mar 2022 12:12:01 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22UBwVWc018090; Wed, 30 Mar 2022 12:11:59 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06fra.de.ibm.com with ESMTP id 3f1t3hy9rv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Mar 2022 12:11:59 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22UCBub229622756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Mar 2022 12:11:57 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6F3E4C050; Wed, 30 Mar 2022 12:11:56 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 071474C040; Wed, 30 Mar 2022 12:11:56 +0000 (GMT) Received: from li-e979b1cc-23ba-11b2-a85c-dfd230f6cf82 (unknown [9.171.15.152]) by d06av22.portsmouth.uk.ibm.com (Postfix) with SMTP; Wed, 30 Mar 2022 12:11:55 +0000 (GMT) Date: Wed, 30 Mar 2022 14:11:54 +0200 From: Halil Pasic To: Christoph Hellwig Cc: Linus Torvalds , Robin Murphy , Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , 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: <20220330141154.2ed284f1.pasic@linux.ibm.com> In-Reply-To: <20220328063723.GA29405@lst.de> References: <1812355.tdWV9SEqCh@natalenko.name> <27b5a287-7a33-9a8b-ad6d-04746735fb0c@arm.com> <20220324190216.0efa067f.pasic@linux.ibm.com> <20220325163204.GB16426@lst.de> <87y20x7vaz.fsf@toke.dk> <20220328063723.GA29405@lst.de> Organization: IBM X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Ul5-ww-qQk8Gw2JXhdzZFG5qKYbo_d91 X-Proofpoint-ORIG-GUID: CV3YK3L41YQ9qvUgMuQRgvjVjUTto1XH 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-30_04,2022-03-30_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 bulkscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203300062 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,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 Mon, 28 Mar 2022 08:37:23 +0200 Christoph Hellwig wrote: > On Fri, Mar 25, 2022 at 11:46:09AM -0700, Linus Torvalds wrote: > > I think my list of three different sync cases (not just two! It's not > > just about whether to sync for the CPU or the device, it's also about > > what direction the data itself is taking) is correct. > > > > But maybe I'm wrong. > > At the high level you are correct. It is all about which direction > the data is taking. That is the direction argument that all the > map/unmap/sync call take. The sync calls then just toggle the ownership. > You seem to hate that ownership concept, but I don't see how things > could work without that ownership concept as we're going to be in > trouble without having that. And yes, a peek operation could work in > some cases, but it would have to be at the cache line granularity. > > arch/arc/mm/dma.c has a really good comment how these transfers relate > to actual cache operations btw> > > * > * | map == for_device | unmap == for_cpu > * |---------------------------------------------------------------- > * TO_DEV | writeback writeback | none none > * FROM_DEV | invalidate invalidate | invalidate* invalidate* Very interesting! Does that mean that memset(buf, 0, size); dma_map(buf, size, FROM_DEVICE) device does a partial write dma_unmap(buf, size, FROM_DEVICE) may boil down to being the same as without the memset(), because the effect of the memset() may get thrown away by the cache invalidate? That is in this scenario we could actually leak the original content of the buffer if we have a non-dma-coherent cache? Regards, Halil > * BIDIR | writeback+inv writeback+inv | invalidate invalidate > * > * [*] needed for CPU speculative prefetches