From patchwork Wed Feb 14 00:06:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 200760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp895225dyb; Tue, 13 Feb 2024 16:28:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWgZit/ispMqL/bn46nRmD2p48LcUHl02EjTnHD/a0Ybo+Yg3QGgDDB666zKfmzWP9ZXXv7Mp6ViW947FmaEAzt723D0w== X-Google-Smtp-Source: AGHT+IF4bFrpJffywHlT60dFLEGwMYVicKsDM8ZAoczx6P00y27CoAbIKm5zGyeyhP2ijSq9oa5+ X-Received: by 2002:a05:6358:7e0d:b0:17a:e9db:bc10 with SMTP id o13-20020a0563587e0d00b0017ae9dbbc10mr1088747rwm.20.1707870538095; Tue, 13 Feb 2024 16:28:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707870538; cv=pass; d=google.com; s=arc-20160816; b=atKoAkGaVWUgbPLV8lbyq+9/2mrPpLVezNEwweuSRG4FB+yZEhQ1xABIqtYgKuVK3O GE3CBeWwxooyLXVwS4SAYGvpLxehNA9TFsR3z4j74ZoReOKe/9ZDgj1q1TKtsMuRO5Hg HhOT0AYGAA/qWlBEyIDMCfJPPXOMpgMrxvg3vlRNflrcLHfI7yKrlDxwNcyJKNQZ+y8s /ssKWC9vX+S6Ggpu0VdCj8fUdK/sAW6dgO/OFQlRxzp73by3+JbIsbjaT9pNySaxUeLr wQhQ5R3In4ev9rlhX78w2I9wvyKp+30H3n9FM2OadehA3VM18/mTo+Amq+cdZiC6VLwU SGxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:from:cc:to:content-language:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=GhnQu6FmXGPVZCi3UFjGPAyQfbh2TxR1NXwH/TlSM+w=; fh=hfqVY6Hcq6U/X461Wy4UgTp4s5ZVtTOFqQoW5EWdij4=; b=VLNunJ+Fv0R6Ek1T3bBmQ40dkJ1NQNDDpPj0Ke+ZEfcPUFfBqm9qAvMOlcBKaxCaAo noUuXkbRvxnsDFFI3Wn7PKWqRuxinUF17POIx3H/zIUKdvzRe1+I9bk6juPmZTT8zTke BY7KSPjdT7g11ljeG6RVJCaYnZGh2+XeI33AIBhs8PXIkWhjFg9s1U0O48o8XzDmHvY4 PvSJu2itNQd7VIF/9MJaXI5pEJwoq+3lG9j0va79umKTXtFR2FIjWimlmagn11gg7/VI t8mr8gp/p4sqAIHRgEshExRSrnDHkwTzoMC862TDoW8umgmnK2qE8OqCaoFdfraFwD0Q 1ncg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=QwE61G5Q; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-64596-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64596-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org X-Forwarded-Encrypted: i=2; AJvYcCWOiP8QRaJvqZ/tsghdamXqm7rSNHackSAKke+PkJ31Kw5r/5rCY/VKWQwY/CUa3kbl6nW3WHNKYRojsPlHLwbmK8OiAA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id me12-20020a170902fc4c00b001d7857c99d0si2738924plb.282.2024.02.13.16.28.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 16:28:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64596-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=QwE61G5Q; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linuxfoundation.org dmarc=pass fromdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-64596-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64596-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 98E90B2AFE1 for ; Wed, 14 Feb 2024 00:07:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC4C8800; Wed, 14 Feb 2024 00:07:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QwE61G5Q" Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 136C94A00 for ; Wed, 14 Feb 2024 00:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707869221; cv=none; b=a3Iaw6msqAFwuVKXZPm2EZvOZiiaFQ2dDTKkPA1LWQxeY/Rwi3QDmd5J2kmA4uXnuuXC0dv3viVizRUTbVDn0sqE2gt2w+4YwillTWSKWS3ZTQysjWx7PZOKcFjck7++kOYE97YFYgJvz5IERW9CzGAfXSionixGyaRAiJzhUf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707869221; c=relaxed/simple; bh=kRl2xvjnEqYqUWOmQ7ofjTzJ/cSkkaVkiE+7IUsfJIA=; h=Content-Type:Message-ID:Date:MIME-Version:To:Cc:From:Subject; b=Otxs3ZUuhUD9nE7/jiFGsv9RUfE+xbNKyecggNtwvH9BoVHmdHZ6tJqAUeMCNkwfI0Xr3CKp//hKiX2CdOjLqXuPo9jirxM79J2ZVEO31WQhXTSFq5M0R4wauI7ctkUAXSGnMjTHDSUT+B+yiRn9h0NDofaOW/hVbUZaOCdB8vs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QwE61G5Q; arc=none smtp.client-ip=209.85.166.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-io1-f49.google.com with SMTP id ca18e2360f4ac-7bff2f6080aso25360139f.1 for ; Tue, 13 Feb 2024 16:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1707869219; x=1708474019; darn=vger.kernel.org; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=GhnQu6FmXGPVZCi3UFjGPAyQfbh2TxR1NXwH/TlSM+w=; b=QwE61G5QxGU6+NPISDK5K/zPcZoewOWpMO53VHQQhTvAeiRApupQZRirnDOMz4Mr7D osl1qNBUquu6R7VqofaZUxuBAOZM+vsMGUPrlcPZpsXy+MOq+b4geSgiMsdhIzm4XdbJ jGIt6QuSn8rJ/KaVXEsm2qa61KPBH6zymYsU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707869219; x=1708474019; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GhnQu6FmXGPVZCi3UFjGPAyQfbh2TxR1NXwH/TlSM+w=; b=a+AmvXc7h5fXulNVqRjgpXdnMk4/5OWNRgZfjSW/4wwoE7VxNPjMqUI9yEyXzyFN9v 3yjyomy9PZiHeoJFEWfrSkCEv97KKhNd35OjPcSJN8z/ALgM0sFrEDGZeSI9wjFQ3gzD QAIXCAg8HJMunRWqL75K+PNnrSglY6RZBN3rpkaIAGqLgWGmoH0SHj44WGKnHGsdQaJP GrvJNW232qJnwMMP5iJ8SA1JOj2XMcc/FzHSBFAKn5OxzuLJgY65UBEvaJNHFHKdRfhj EA7PrSTJyQ/S5qSY95OumQzaW1rYKPZaysPMgqyBK9MC7/8jFaFcSJaH3UpiQPbRV38v BYJQ== X-Forwarded-Encrypted: i=1; AJvYcCXNcGGIe1w3iwTKJrXBfmIrpxC3cKtgpF8H8h6ZnRQwCGIo+BOdZwNkpQoYoRXVZywcQeGBgiAwIBvRxYjXEbw5Qda2glljpa+OZO57 X-Gm-Message-State: AOJu0YzQ/Vb9R71+/WIyNbBwgM6jnExKvsZ41ILx6WSHlMfOJLeKLQEV mJO1nd5OyhIMhDPLi1/3d3HtDRZ3C/dpdZojtNInXGfCJ+R1LNwRENsSCCCjWKI= X-Received: by 2002:a6b:fe01:0:b0:7c4:8032:5724 with SMTP id x1-20020a6bfe01000000b007c480325724mr809467ioh.0.1707869219183; Tue, 13 Feb 2024 16:06:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXA4aTCw0RK9urTQ3ld4zkHTrIyDI62ZmJAw8XHTRnc+Cf9qmTZe9wUE4VytcuFEsKt28Assj+UwSbhwoKX1NH6EefWt9fsDYDqnZ4KSda9xxk2H3KI3oRUb0M3+TL6c7q8urMVMQgGg0aD/HORoX4GxOTZO6AUfDk6Mfy5td1nOyRw9JWXlHTE7ozVe12yoCDqpHIn574Da3TVmICHwQKIYphqF13wLv3vMRQYtn3CnJyfoUrutyZn Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id u25-20020a02cbd9000000b0047129817ee3sm2209721jaq.141.2024.02.13.16.06.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Feb 2024 16:06:58 -0800 (PST) Message-ID: <876716d6-f865-42cb-94d0-67e9193a96f3@linuxfoundation.org> Date: Tue, 13 Feb 2024 17:06:58 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Linus Torvalds Cc: shuah , Shuah Khan , Brendan Higgins , David Gow , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org From: Shuah Khan Subject: [GIT PULL] KUnit fixes update for Linux 6.8-rc5 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790832057499869789 X-GMAIL-MSGID: 1790832057499869789 Hi Linus, Please pull the following KUnit fixes update for Linux 6.8-rc5. This KUnit update for Linux 6.8-rc5 consists of one important fix to unregister kunit_bus when KUnit module is unloaded. Not doing so causes an error when KUnit module tries to re-register the bus when it gets reloaded. diff is attached. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit 1a9f2c776d1416c4ea6cb0d0b9917778c41a1a7d: Documentation: KUnit: Update the instructions on how to test static functions (2024-01-22 07:59:03 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-kunit-fixes-6.8-rc5 for you to fetch changes up to 829388b725f8d266ccec32a2f446717d8693eaba: kunit: device: Unregister the kunit_bus on shutdown (2024-02-06 17:07:37 -0700) ---------------------------------------------------------------- linux_kselftest-kunit-fixes-6.8-rc5 This KUnit update for Linux 6.8-rc5 consists of one important fix to unregister kunit_bus when KUnit module is unloaded. Not doing so causes an error when KUnit module tries to re-register the bus when it gets reloaded. ---------------------------------------------------------------- David Gow (1): kunit: device: Unregister the kunit_bus on shutdown lib/kunit/device-impl.h | 2 ++ lib/kunit/device.c | 14 ++++++++++++++ lib/kunit/test.c | 3 +++ 3 files changed, 19 insertions(+) ---------------------------------------------------------------- diff --git a/lib/kunit/device-impl.h b/lib/kunit/device-impl.h index 54bd55836405..5fcd48ff0f36 100644 --- a/lib/kunit/device-impl.h +++ b/lib/kunit/device-impl.h @@ -13,5 +13,7 @@ // For internal use only -- registers the kunit_bus. int kunit_bus_init(void); +// For internal use only -- unregisters the kunit_bus. +void kunit_bus_shutdown(void); #endif //_KUNIT_DEVICE_IMPL_H diff --git a/lib/kunit/device.c b/lib/kunit/device.c index 074c6dd2e36a..644a38a1f5b1 100644 --- a/lib/kunit/device.c +++ b/lib/kunit/device.c @@ -54,6 +54,20 @@ int kunit_bus_init(void) return error; } +/* Unregister the 'kunit_bus' in case the KUnit module is unloaded. */ +void kunit_bus_shutdown(void) +{ + /* Make sure the bus exists before we unregister it. */ + if (IS_ERR_OR_NULL(kunit_bus_device)) + return; + + bus_unregister(&kunit_bus_type); + + root_device_unregister(kunit_bus_device); + + kunit_bus_device = NULL; +} + /* Release a 'fake' KUnit device. */ static void kunit_device_release(struct device *d) { diff --git a/lib/kunit/test.c b/lib/kunit/test.c index 31a5a992e646..1d1475578515 100644 --- a/lib/kunit/test.c +++ b/lib/kunit/test.c @@ -928,6 +928,9 @@ static void __exit kunit_exit(void) #ifdef CONFIG_MODULES unregister_module_notifier(&kunit_mod_nb); #endif + + kunit_bus_shutdown(); + kunit_debugfs_cleanup(); } module_exit(kunit_exit);