Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp2080415rwn; Fri, 9 Sep 2022 08:15:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5acYARNdBn/i0K3ZleNu/+vF0V9ZT7bauJzUlmFP4a2AzVG2BXaw9TLowMPTlcTP+XpN/c X-Received: by 2002:a17:906:fd82:b0:770:7e61:3707 with SMTP id xa2-20020a170906fd8200b007707e613707mr9907614ejb.143.1662736502551; Fri, 09 Sep 2022 08:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662736502; cv=none; d=google.com; s=arc-20160816; b=xM9Lv8RdP6uZOgfh7XPGVOKEFTcbi9vMz6ffX3K6LYuLR4jF5awrI+FlgzKTpTFg2W 1cGlZfx6OFWPrKwhJw2WqaiWSEbUDwoHVnJnvH07L+G5+/OAyS3ej7MAEE0KjJhTuo0K wvkYxt9iFIK/nd5Rx4NNW2yY/f57YutLhv9PmeA6Zq3Zl+7mcZMk5b9Y9nH/uCmZB7Bg Q1vss1AZ8nmevv5jPholyVoFv1rkQRfVMd4QBDMiWAAznUabRrd3QrehmNBnCYl5J7VD S/NorgVZxERhuf2CwDSnahtewaz8eKPkSIAJU+qRvHjjsIfeiMSYcm8Z82QgG7tbg+hR sZ/Q== 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 :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=UXQvdGOAGkppG3guuHc+JsI8tGuFPIWJNyNfYcaiBwg=; b=fTd/e5htfYAI6Z3Zr+j7CzbXSR9BdHCHge3cUxBWfWWsD5gRHFQDLGgu7s/OfXYzCm SamcjMHvz7NFT0f+17rmgMo8+B6y7RLsUYVJ4CCxd7jdRP6SZ9GxUdr29o0sMGtVh41u OeWTSH/8Wq6GQl2v+bGKhfY2R0XoUJmASqfOxI/k3pdZfA3AH/ehfRFDN6KJB0ibpPfK X/Kk9h8A4uvvkaj9GS8pecJN35cuf4M4crQsOB4ztTR09jvghdxzh0M4dCQWUocLGLSZ j18evRLqBODd7VrrwW+kBzsAA1vLpSDmcrLTiUSNJfhjITvYfDGbm00Hr1Ufs/0xKu0w suow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=maglAEPB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp25-20020a1709073e1900b007429c6f2908si811208ejc.128.2022.09.09.08.14.35; Fri, 09 Sep 2022 08:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@intel.com header.s=Intel header.b=maglAEPB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232126AbiIIPLI (ORCPT + 99 others); Fri, 9 Sep 2022 11:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232138AbiIIPLC (ORCPT ); Fri, 9 Sep 2022 11:11:02 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0322EE984; Fri, 9 Sep 2022 08:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662736260; x=1694272260; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vGy4fIFwjFSNzA65qv4QDCYsy+swZzfD5tvaJcOb5X4=; b=maglAEPBCMFqi8C/cflgtKDpV2ASrc1p2Ui21rpg+cpNTeU4DHUrmCuV 1RiybquVl3mCHYi5VNJFP7wRqL3RosMkboX0MnjApyQkAxkdfbUMMBAj7 e6MfEdJ/8pQu6c8+oV7vWRIaggJdSTi2b/Q6jT0k6V12/vOF2V7DRklBa LAga3kgWGgMzFW7M/BBwAqOBD5JO5MT1vAS3XKupikCn+bKbEwdZ3K0CJ bUbSJHeShnH0YfMOAHVOcH6wTZX7/TNEcDPYXVLwLyYrJRm49Rz98BQA0 +ZSbjsINIisT/JYC3tTioHrNyKIlyZCmBCUFHKftrpKhnmW9pBk4duokw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10465"; a="359217074" X-IronPort-AV: E=Sophos;i="5.93,303,1654585200"; d="scan'208";a="359217074" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 08:10:59 -0700 X-IronPort-AV: E=Sophos;i="5.93,303,1654585200"; d="scan'208";a="611085785" Received: from jkrzyszt-mobl1.ger.corp.intel.com ([10.213.25.143]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 08:10:54 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Cc: linux-kselftest@vger.kernel.org, daniel@ffwll.ch, kunit-dev@googlegroups.com, magalilemes00@gmail.com, maira.canal@usp.br, dlatypov@google.com, n@nfraprado.net, linux-kernel@vger.kernel.org, leandro.ribeiro@collabora.com, dri-devel@lists.freedesktop.org, davidgow@google.com, tales.aparecida@gmail.com, skhan@linuxfoundation.org, andrealmeid@riseup.net, Isabella Basso , brendanhiggins@google.com, twoerner@gmail.com, Isabella Basso Subject: Re: [igt-dev] [PATCH i-g-t v2 2/4] lib/igt_kmod.c: check if module is builtin before attempting to unload it Date: Fri, 09 Sep 2022 17:10:52 +0200 Message-ID: <13576898.RDIVbhacDa@jkrzyszt-mobl1.ger.corp.intel.com> Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 In-Reply-To: <20220829000920.38185-3-isabbasso@riseup.net> References: <20220829000920.38185-1-isabbasso@riseup.net> <20220829000920.38185-3-isabbasso@riseup.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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-kernel@vger.kernel.org On Monday, 29 August 2022 02:09:18 CEST Isabella Basso wrote: > This change makes `igt_module_unload_r` safer as it checks whether the s/igt_module_unload_r/igt_kmod_unload_r/ > module can be unloaded before attempting it. > > Signed-off-by: Isabella Basso > --- > lib/igt_kmod.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c > index bb6cb7bb..97cac7f5 100644 > --- a/lib/igt_kmod.c > +++ b/lib/igt_kmod.c > @@ -256,6 +256,9 @@ static int igt_kmod_unload_r(struct kmod_module *kmod, unsigned int flags) > struct kmod_list *holders, *pos; > int err = 0; > > + if (kmod_module_get_initstate(kmod) == KMOD_MODULE_BUILTIN) > + return err; NIT: I think that return 0; would be more clear. Anyway, Acked-by: Janusz Krzysztofik > + > holders = kmod_module_get_holders(kmod); > kmod_list_foreach(pos, holders) { > struct kmod_module *it = kmod_module_get_module(pos); >