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 shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 B81B2C54EBC for ; Thu, 12 Jan 2023 15:27:13 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.96) (envelope-from ) id 1pFzTp-0000ge-0G; Thu, 12 Jan 2023 10:27:01 -0500 Received: from ngcobalt04.manitu.net ([217.11.48.104]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1pFz9I-0007rS-0d for kernelnewbies@kernelnewbies.org; Thu, 12 Jan 2023 10:05:48 -0500 Received: from [192.168.250.58] (dynamic-089-204-130-234.89.204.130.pool.telefonica.de [89.204.130.234]) (Authenticated sender: cstalp) by ngcobalt04.manitu.net (Postfix) with ESMTPSA id 67C701060DED for ; Thu, 12 Jan 2023 16:05:37 +0100 (CET) Message-ID: Date: Thu, 12 Jan 2023 16:05:36 +0100 MIME-Version: 1.0 Subject: Re: linked list within a kernel probe Content-Language: en-GB To: kernelnewbies@kernelnewbies.org References: <75bc2d47-a2f9-187b-8ac8-e0ee2c10226a@chrishell.de> <77ba5293-292c-9163-9a54-a2066e93fe14@chrishell.de> From: chrishell In-Reply-To: X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kernelnewbies-bounces@kernelnewbies.org Hi Tom, thank you for your support. in my example, I used a spin_lock(&sl) for blocking traversing the list, despite this function does nothing but reading or traversing the linked list. No adding or removing is done within the kprobe function. The other function called _kprobe_setup_cache_elements, which creates the linked list, is called from the _init function, only once. So I think there is no concurrency in this situation? BR Christian > Hint. > Inside the kernel always address the issue of concurrency. > Adding and removing from lists commonly needs a protective mutual > exclusive lock. > Look for like data structures and use the macro/standard tools to get > it ALL correct including cache coherency. > > There are two strategies -- a data lock or a code monitor. > https://www.geeksforgeeks.org/deadlock-starvation-and-livelock/ > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies