From patchwork Tue Jan 14 22:31:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Daley X-Patchwork-Id: 857352 Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) (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 D749314A609; Tue, 14 Jan 2025 22:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=173.37.142.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736893930; cv=none; b=YaJsp+MNSu4gaNVwTdztup17kip8vk/7vwWQHKii9qd2be4wT7dfJfPGgYHZFKQEItbDqcDtuYU0xtw04r/3ejCYlz2YgbELJDPCgzhJNwd/+DeVon6P0x7FZCqNRzHr9a/nefvKWbBFRCqidfIZx8jl7W+Frby0VvXbC9kLF+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736893930; c=relaxed/simple; bh=gCyW+qFefQLCZCdyZmgttG6Uv6bmyarn6x6WAQfoxvU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mKo67g6+uEpUAXrJ3Y366FVxc//ZgTlAlbZdc7lk9smJD9lTvYRbz04EwEwvtxQtE/F2V7MBd2DXnWXMNUzagdXpAhlM8RWdmubO+m/8wE0cZahAinr2gakDOholLJFIV2K02wBqmOLTXlOaLN8uCPz9xKOtM3RC8ZDgi9spES8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cisco.com; spf=pass smtp.mailfrom=cisco.com; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b=ebsIpuzu; arc=none smtp.client-ip=173.37.142.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cisco.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cisco.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b="ebsIpuzu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.com; i=@cisco.com; l=2589; q=dns/txt; s=iport; t=1736893928; x=1738103528; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XcR7ArXYthKmMKSfoAEeX8zvPOHz40yremfyEvSSaxI=; b=ebsIpuzuPTSvCpImrlwR0AHCi0XLBQ0CtiIKHByFMOSjlZux9WyaKprw 7Iq4rB9zD08mY0bQ30pJ0lxsEGq0Wv7CoemeIzxGko9BNJbY85YLvLhMC 2pf4US3PDUXdNcs1UlGl4s36vd+/1u7q1v2rC/4aUOlh0l+6YyHX5eHJJ Y=; X-CSE-ConnectionGUID: Xb1zNljATBeV8b58vxbIGA== X-CSE-MsgGUID: PEUK3YXyTYapVviauClCfg== X-IPAS-Result: A0ANAADq5IZn/5T/Ja1aGwEBAQEBAQEBBQEBARIBAQEDAwEBAYF/BgEBAQsBgkp2WUNIjHJfpw2BJQNWDwEBAQ85CwQBAYUHAop0AiY0CQ4BAgQBAQEBAwIDAQEBAQEBAQEBAQELAQEFAQEBAgEHBYEOE4V7DYZbAgEDMgFGEFErKwcSgwEBgmQDEbMhgiyBAd4zgWcGgUgBhWqHX3CEdycbgUlEgRWDaIJhAgIBgiqFdwSDeYNuixSTZUiBIQNZLAFVEw0KCwcFgTo6AyILCwwLFBwVAhUeEAYQBG1EN4JGaUk3Ag0CNYIeJFiCK4RchEeEVYJHVIJHghR6gReEN0ADCxgNSBEsNwYOGwY+bgebOgE8g3J7FCuBEYE9LKUKoQOEJYFjijWVLhozqlMuh2SQaiKNYpZDhGaBZzyBWTMaCBsVgyJSGQ+OWYhWulUlMjwCBwsBAQMJkVMBAQ IronPort-Data: A9a23:XDV7vaq/H/4amr0u0CnG9lwL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A X-Talos-MUID: 9a23:MJmhwAza31mIT1Wow2wKsiuxCb6aqJyDNWNWoKUXh/iNLRJuOj6ApzCcTIByfw== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.12,315,1728950400"; d="scan'208";a="428748381" Received: from rcdn-l-core-11.cisco.com ([173.37.255.148]) by alln-iport-3.cisco.com with ESMTP/TLS/TLS_AES_256_GCM_SHA384; 14 Jan 2025 22:32:02 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-l-core-11.cisco.com (Postfix) with ESMTP id 47E8718000253; Tue, 14 Jan 2025 22:32:02 +0000 (GMT) Received: by cisco.com (Postfix, from userid 392789) id 220043FAB9C4; Tue, 14 Jan 2025 14:32:02 -0800 (PST) From: John Daley To: shuah@kernel.org, kuba@kernel.org, sdf@fomichev.me, willemb@google.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: John Daley Subject: [PATCH net-next 1/1] selftests: drv-net-hw: inject pp_alloc_fail errors in the right place Date: Tue, 14 Jan 2025 14:31:59 -0800 Message-Id: <20250114223159.29677-2-johndale@cisco.com> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20250114223159.29677-1-johndale@cisco.com> References: <20250114223159.29677-1-johndale@cisco.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-l-core-11.cisco.com The tool pp_alloc_fail.py tested error recovery by injecting errors into the function page_pool_alloc_pages(). The page pool allocation function page_pool_dev_alloc() does not end up calling page_pool_alloc_pages(). page_pool_alloc_netmems() seems to be the function that is called by all of the page pool alloc functions in the API, so move error injection to that function instead. Signed-off-by: John Daley --- net/core/page_pool.c | 2 +- tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 9733206d6406..a3de752c5178 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -595,13 +595,13 @@ netmem_ref page_pool_alloc_netmems(struct page_pool *pool, gfp_t gfp) return netmem; } EXPORT_SYMBOL(page_pool_alloc_netmems); +ALLOW_ERROR_INJECTION(page_pool_alloc_netmems, NULL); struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp) { return netmem_to_page(page_pool_alloc_netmems(pool, gfp)); } EXPORT_SYMBOL(page_pool_alloc_pages); -ALLOW_ERROR_INJECTION(page_pool_alloc_pages, NULL); /* Calculate distance between two u32 values, valid if distance is below 2^(31) * https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution diff --git a/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py b/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py index 05b6fbb3fcdd..ad192fef3117 100755 --- a/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py +++ b/tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py @@ -21,9 +21,9 @@ def _enable_pp_allocation_fail(): if not os.path.exists("/sys/kernel/debug/fail_function"): raise KsftSkipEx("Kernel built without function error injection (or DebugFS)") - if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"): + if not os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"): with open("/sys/kernel/debug/fail_function/inject", "w") as fp: - fp.write("page_pool_alloc_pages\n") + fp.write("page_pool_alloc_netmems\n") _write_fail_config({ "verbose": 0, @@ -37,7 +37,7 @@ def _disable_pp_allocation_fail(): if not os.path.exists("/sys/kernel/debug/fail_function"): return - if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_pages"): + if os.path.exists("/sys/kernel/debug/fail_function/page_pool_alloc_netmems"): with open("/sys/kernel/debug/fail_function/inject", "w") as fp: fp.write("\n")