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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 768D7C433EF for ; Mon, 7 Mar 2022 03:39:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2C0F7812DB; Mon, 7 Mar 2022 03:39:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qTz3frjNjeKL; Mon, 7 Mar 2022 03:39:12 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 036EC812E4; Mon, 7 Mar 2022 03:39:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C9537C0012; Mon, 7 Mar 2022 03:39:11 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id A8882C000B for ; Mon, 7 Mar 2022 03:39:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8EC0A40150 for ; Mon, 7 Mar 2022 03:39:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hs7vbBEGxNmO for ; Mon, 7 Mar 2022 03:39:09 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by smtp2.osuosl.org (Postfix) with ESMTPS id 552BA400B9 for ; Mon, 7 Mar 2022 03:39:09 +0000 (UTC) X-UUID: f7e21676e1fd457d8434de712293e217-20220307 X-UUID: f7e21676e1fd457d8434de712293e217-20220307 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 801078150; Mon, 07 Mar 2022 11:39:03 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Mon, 7 Mar 2022 11:39:01 +0800 Received: from mbjsdccf07.mediatek.inc (10.15.20.246) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 7 Mar 2022 11:38:47 +0800 To: Subject: RE: [PATCH] iommu/iova: Free all CPU rcache for retry when iova alloc failure Date: Mon, 7 Mar 2022 11:32:46 +0800 Message-ID: <20220307033246.23051-1-yf.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <906a446e-3e25-5813-d380-de699a84b6f4@arm.com> References: <906a446e-3e25-5813-d380-de699a84b6f4@arm.com> MIME-Version: 1.0 X-MTK: N Cc: wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org, Libo.Kang@mediatek.com, yf.wang@mediatek.com, iommu@lists.linux-foundation.org, linux-mediatek@lists.infradead.org, Ning.Li@mediatek.com, matthias.bgg@gmail.com, stable@vger.kernel.org, will@kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "yf.wang--- via iommu" Reply-To: yf.wang@mediatek.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, 2022-03-04 at 14:03 +0000, Robin Murphy wrote: > > OK, so either there's a mystery bug where IOVAs somehow get freed on > offline CPUs, or the hotplug notifier isn't working correctly, or > you've > contrived a situation where alloc_iova_fast() is actually racing > against > iova_cpuhp_dead(). In the latter case, the solution is "don't do > that". > > This change should not be necessary. > > Thanks, > Robin. Hi Robin, 1.As long as iova domain is not destroyed, the cached iovas will always exist, the only chance to free the cache is the retry flushing mechanism when alloc fail, but not free cached iova of not online CPU. 2.Iova rcache mechanism is by cpu, but there is no free rcache mechanism when the CPU state switch. 3.iova.c does not know about CPU state switching, eg.online <--> offline. Based on the above basic information, this is not a user bug, it is more like a defect of the iova rcache mechanism. Thanks, Yunfei. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu