From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55F93194A68 for ; Wed, 2 Oct 2024 07:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727854684; cv=none; b=GuHkY9T3ruuuufqkiwqH+voRknD2LRqdDrWzK5fXtYHuh/TJzlmvOmK7p/9hDgye4UEy+ReWLHhEqsgkTt2zW42GPCsYlFGmL0B7JPf2pgBiUwWKuHlFhz5Um6pN+yT2tGhPVN6ZMuQJUFDLkoIa3j0taW2G9givB6196TBAlW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727854684; c=relaxed/simple; bh=WE+06bxezNDAqpcu2ZttnmMzwPNs3mFTLb9xN/v5LS8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IT7naVj2loNGYLVTwQuIOVtn7QVsgg17bABttEl/KQYsRCkivRBwcgWg/SBjsE90q9V4bpjADEjwuOrefx/RIk/ByBLRcSIc2B8qWY01BzxbFpHRszYO+KQHhNit9OZ3uvGvtkKrLInTq9ZaMH5Ow9xCbOWmyefB3z2jW+oc4Oc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KNVes14/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KNVes14/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727854681; 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=j08eYaNn2uqZATIiA0jZfTZrfzeBz+jlQCTj6GcTpN8=; b=KNVes14/3JJRBoN+munY7ry+URfle+5VKEkhjArwd9GY5WxZ9uS3phiI5WVOkkasuAM0+N Kz9JS2wbb0y8GSdBTt9NMFJSM6KQVlJ03s94EdOpB2Tzu2FaykBb/tZTMUHoxeeiJaoJl+ bzGQS3d0cqbDQh6fOj3OgU7AihfV65A= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-Ggl81SF0OBuWatJ5Yi7Eog-1; Wed, 02 Oct 2024 03:37:59 -0400 X-MC-Unique: Ggl81SF0OBuWatJ5Yi7Eog-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-42cb080ab53so48964165e9.0 for ; Wed, 02 Oct 2024 00:37:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727854678; x=1728459478; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j08eYaNn2uqZATIiA0jZfTZrfzeBz+jlQCTj6GcTpN8=; b=M5E9WsxtlBzVwcZsF95gfkaLw37/jcQWjdvg7uFkUrD2/FvTomfK6fScrsPt9v2Cbr ebdUxM0NAmvig4UTOg7EqtdCvyA3Pog6VhvMMq7nYt2+pRhYHpkMoMcKti5GJ9J6S9PL k8tBE83xEO2pyvkJM5/WyeHm4JkCdQWPZJt/jQJH2NlqIwGSrhffYBf+eJSgimqLv0Ld 0po9wBGJxwInOJ9922/PPRImro066w31HTnjYxZQ8XqDViyS7rpeMC3THWQ1drZOPK/o xT80nws7h8eQJZzlOjAFZyZWVe0jwtMf0whsRk9ah/xRfqHRtT/G3xxIrVC7s7baULyY r7Pw== X-Forwarded-Encrypted: i=1; AJvYcCVPnEOeIjjUQQnOh/Beo7TVBiG3XgKyR9hztQgL0rRmL2lGkupstu9FSxBGc0BH+fkRhK0=@vger.kernel.org X-Gm-Message-State: AOJu0YyhP0uu8srOktGNKry4QgxIsvmnzrxNtSLCUASGzz1OPfWsw4th 3iOWJQq8f8hCRWrm3qQBA+j2JJwh73Ch3MmUH4lJyMpHK3iCLwj3zRCl5qyjaFuJH7BNjYdi9bN pQtQUQ0Bv560dIqO8jvuOBHX/lLoRmxTBgneBqLZyXAPXZyDgCQ== X-Received: by 2002:a05:600c:1549:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42f778ffef3mr14810305e9.34.1727854678272; Wed, 02 Oct 2024 00:37:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEexnVZvq0noKxS76pRMj9/ZaTG1nDs7t0bSMBHW4+0LcSgagoa/Bz8vlb6jQ6CnVv6cUGFfw== X-Received: by 2002:a05:600c:1549:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42f778ffef3mr14809895e9.34.1727854677827; Wed, 02 Oct 2024 00:37:57 -0700 (PDT) Received: from [192.168.88.248] (146-241-47-72.dyn.eolo.it. [146.241.47.72]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f7a01fc92sm10806665e9.36.2024.10.02.00.37.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2024 00:37:57 -0700 (PDT) Message-ID: <4316fa2d-8dd8-44f2-b211-4b2ef3200d75@redhat.com> Date: Wed, 2 Oct 2024 09:37:54 +0200 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2 2/2] page_pool: fix IOMMU crash when driver has already unbound To: Yunsheng Lin , Yunsheng Lin , Ilias Apalodimas Cc: liuyonglong@huawei.com, fanghaiqing@huawei.com, zhangkun09@huawei.com, Robin Murphy , Alexander Duyck , IOMMU , Wei Fang , Shenwei Wang , Clark Wang , Eric Dumazet , Tony Nguyen , Przemek Kitszel , Alexander Lobakin , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Andrew Morton , imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org, linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-mm@kvack.org, davem@davemloft.net, kuba@kernel.org References: <20240925075707.3970187-1-linyunsheng@huawei.com> <20240925075707.3970187-3-linyunsheng@huawei.com> <4968c2ec-5584-4a98-9782-143605117315@redhat.com> <33f23809-abec-4d39-ab80-839dc525a2e6@gmail.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <33f23809-abec-4d39-ab80-839dc525a2e6@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 10/2/24 04:34, Yunsheng Lin wrote: > On 10/1/2024 9:32 PM, Paolo Abeni wrote: >> Is the problem only tied to VFs drivers? It's a pity all the page_pool >> users will have to pay a bill for it... > > I am afraid it is not only tied to VFs drivers, as: > attempting DMA unmaps after the driver has already unbound may leak > resources or at worst corrupt memory. > > Unloading PFs driver might cause the above problems too, I guess the > probability of crashing is low for the PF as PF can not be disable > unless it can be hot-unplug'ed, but the probability of leaking resources > behind the dma mapping might be similar. Out of sheer ignorance, why/how the refcount acquired by the page pool on the device does not prevent unloading? I fear the performance impact could be very high: AFICS, if the item array become fragmented, insertion will take linar time, with the quite large item_count/pool size. If so, it looks like a no-go. I fear we should consider blocking the device removal until all the pages are returned/unmapped ?!? (I hope that could be easier/faster) /P 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 smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 B347CCF31A0 for ; Wed, 2 Oct 2024 07:38:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3511640FA6; Wed, 2 Oct 2024 07:38:07 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id vPd9Nzwwzlh6; Wed, 2 Oct 2024 07:38:06 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 3160340F9E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1727854686; bh=j08eYaNn2uqZATIiA0jZfTZrfzeBz+jlQCTj6GcTpN8=; h=Date:To:References:From:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=UYc2/NR413OG+zPlcGr9SWH8sFqAGou+FehOmhcLkxjLnobE0AddY/1gyyvXNpH1Q lexPOJaIrJiAj4pANjEnpOi5Agl+OM8SgihRg32b+zkXaACvv8UoQ7l5W6670yLypw coZfKlwaUYOMrDpXSQNotSqc0rMJ7SkYwTmGTuOnYF8mn5egTLeTG7J/rgGzY9lPjB a0CmjVS09gGxhF2LJOwRYs7m005wdA6+z89KGyEQyUJDqkyroIdEe+4x/fvdwH4hAH CWt1SIY4F6I0wr8J821oGdk6RPFH2EUWaAD9JtJY6cIcbhJv9o4dzEB4XCHNZXOG4a hfJBpIclzm8jQ== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 3160340F9E; Wed, 2 Oct 2024 07:38:06 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id CA56E1BF280 for ; Wed, 2 Oct 2024 07:38:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B532040B3D for ; Wed, 2 Oct 2024 07:38:05 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id UgR7yKaesCFI for ; Wed, 2 Oct 2024 07:38:05 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=pabeni@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org AD9A2407BB DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org AD9A2407BB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id AD9A2407BB for ; Wed, 2 Oct 2024 07:38:04 +0000 (UTC) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-QPKMvr_ENA-j8FQVaz60cA-1; Wed, 02 Oct 2024 03:37:59 -0400 X-MC-Unique: QPKMvr_ENA-j8FQVaz60cA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42e611963c2so48907315e9.1 for ; Wed, 02 Oct 2024 00:37:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727854678; x=1728459478; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j08eYaNn2uqZATIiA0jZfTZrfzeBz+jlQCTj6GcTpN8=; b=A9NPEqOX/hIyJw4B2ywQuKUqaLsXUTtORsOzczXd8qFKBkk5UFPcoiXo7CIxxFvru0 XO9ckgVT+7lkY5IdhoziB32mSyP/sEhpBwi+Y3krSHXNLUG1qIFLH1hCybIxUhGhHWn9 wEI9Cu0vvT+Q7qFlNjrMDY+PwkdGUXO5w4auGz9OTTJETQhpAJl5ZhvUzIyUZjQPM07i b9CBvDk+b3cnJpvEsXqTJJ2XF3grJYNotBTRrTx5f+HQsadz5FVwriZmMF/UWeEU3qaQ oxe2netv+QH/pRkDBT/z5g8v4IH2fGEFbfBdcfUzUsxCVbKWYWptxAir04spsFKSmdIH AQfg== X-Forwarded-Encrypted: i=1; AJvYcCWK+ps0y1MHMC0LLZru6jK6IyYSeDYZFcsI31UhjLsEBWGtkzH1dfpvX7NAE90y9VKicM53QDXORnVn843hsxc=@lists.osuosl.org X-Gm-Message-State: AOJu0Yz432zj8BZF/8ra598Bpw45Dhs2x1PisnA1aaiLfj8uqbt54yPA 2sdHv2IKNUokG49ePV1FCLMzTOOwfyfmQoHZnpCKVP+pnOsBd2dISR7IcMiYsND4pelWT5aklRz WwmrEEkh1j3zpwto+q+1ayp3RVhyppWx5WxssACEmngyuVzbW1f8MhkokmKObzsXdNhY= X-Received: by 2002:a05:600c:1549:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42f778ffef3mr14810195e9.34.1727854678268; Wed, 02 Oct 2024 00:37:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEexnVZvq0noKxS76pRMj9/ZaTG1nDs7t0bSMBHW4+0LcSgagoa/Bz8vlb6jQ6CnVv6cUGFfw== X-Received: by 2002:a05:600c:1549:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42f778ffef3mr14809895e9.34.1727854677827; Wed, 02 Oct 2024 00:37:57 -0700 (PDT) Received: from [192.168.88.248] (146-241-47-72.dyn.eolo.it. [146.241.47.72]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f7a01fc92sm10806665e9.36.2024.10.02.00.37.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2024 00:37:57 -0700 (PDT) Message-ID: <4316fa2d-8dd8-44f2-b211-4b2ef3200d75@redhat.com> Date: Wed, 2 Oct 2024 09:37:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Yunsheng Lin , Yunsheng Lin , Ilias Apalodimas References: <20240925075707.3970187-1-linyunsheng@huawei.com> <20240925075707.3970187-3-linyunsheng@huawei.com> <4968c2ec-5584-4a98-9782-143605117315@redhat.com> <33f23809-abec-4d39-ab80-839dc525a2e6@gmail.com> From: Paolo Abeni In-Reply-To: <33f23809-abec-4d39-ab80-839dc525a2e6@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727854683; 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=j08eYaNn2uqZATIiA0jZfTZrfzeBz+jlQCTj6GcTpN8=; b=NmcAydelTMjVGr6u4Nr6rlYytTBKxUaTnW1Ut6R8SlnucaZXtQJTE05YPEBgqcmCnrIvBX Lxec51eOHp1muMzyMau/k1uruvKi1yE8f+t56pbCs9sNRX4Ms3xTW3KITkgUTTNobplzAx vd+ncJwHew8s0sZQlH906v6RO17Za2E= X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NmcAydel Subject: Re: [Intel-wired-lan] [PATCH net v2 2/2] page_pool: fix IOMMU crash when driver has already unbound X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imx@lists.linux.dev, Alexei Starovoitov , Alexander Duyck , linux-mm@kvack.org, Eric Dumazet , Tony Nguyen , Shenwei Wang , Ryder Lee , Daniel Borkmann , linux-rdma@vger.kernel.org, Przemek Kitszel , John Fastabend , IOMMU , liuyonglong@huawei.com, Clark Wang , zhangkun09@huawei.com, fanghaiqing@huawei.com, Lorenzo Bianconi , Jesper Dangaard Brouer , Kalle Valo , Sean Wang , Wei Fang , kuba@kernel.org, Matthias Brugger , intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , Leon Romanovsky , Saeed Mahameed , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Tariq Toukan , Alexander Lobakin , netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, Andrew Morton , Shayne Chen , Robin Murphy , davem@davemloft.net, Felix Fietkau Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Hi, On 10/2/24 04:34, Yunsheng Lin wrote: > On 10/1/2024 9:32 PM, Paolo Abeni wrote: >> Is the problem only tied to VFs drivers? It's a pity all the page_pool >> users will have to pay a bill for it... > > I am afraid it is not only tied to VFs drivers, as: > attempting DMA unmaps after the driver has already unbound may leak > resources or at worst corrupt memory. > > Unloading PFs driver might cause the above problems too, I guess the > probability of crashing is low for the PF as PF can not be disable > unless it can be hot-unplug'ed, but the probability of leaking resources > behind the dma mapping might be similar. Out of sheer ignorance, why/how the refcount acquired by the page pool on the device does not prevent unloading? I fear the performance impact could be very high: AFICS, if the item array become fragmented, insertion will take linar time, with the quite large item_count/pool size. If so, it looks like a no-go. I fear we should consider blocking the device removal until all the pages are returned/unmapped ?!? (I hope that could be easier/faster) /P