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 9BB3EC433FE for ; Sat, 8 Oct 2022 20:43:49 +0000 (UTC) Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.96) (envelope-from ) id 1ohGfT-0006Eu-1G; Sat, 08 Oct 2022 16:43:31 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ohGfQ-0006En-1U for kernelnewbies@kernelnewbies.org; Sat, 08 Oct 2022 16:43:28 -0400 Received: by mail-ej1-x630.google.com with SMTP id k2so17873825ejr.2 for ; Sat, 08 Oct 2022 13:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OWa0UvgEOSzXdJSBYbhc/ZTAwqVInIejJWOKR+VAoak=; b=DWk3KG8E3EgfCp23geVbNOfO5BJku/2CKVw/ezqqQXWUftTxdFa8vhvRlhknJ90YDN SIZh7sYGnbLTFtBLOOyQHhg90m79QSOa6l5sw6HoJ/KqNyqCs5y9O6DMNGEoy/IYF+HX IFVOrP0l+XSPyB4fNAQEWatSj4osnwh7XpY7FzSrgp5Whu/GIKwbBB9UcLClpHsjX7GC VwapEfyKkFClTOrslk1fCpjheJKsLVxYWC2UrL8f06IS8IquxbO+rv+YFudZLChFirG+ xuEbK/2wwYFENc1Rf4OmOIn6cKgVRm1myWA/HFqPqvS8AlqEo9lt/fSrEre4M74a91Jv N88Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OWa0UvgEOSzXdJSBYbhc/ZTAwqVInIejJWOKR+VAoak=; b=x6OvzqJ0u0t+PjOSQ33Gwx0McrjFDy8p2leYoAIJ93cZ+xZFGy/iInB7weiXOpczzl wq2fRgmA51sDKao4M5si+wB/3I0s3/AXim3XsHWud7mZievZxL7UDchOawfvMtCplrTw icESO6pAHezduFTqv76vQoRcV0VxslpBqa80aS6rE+oJmMhKuOdhaKtqH7XuBf3ONRsz zvUqahXjq3dlKhNBPyCsINzr2ZhYaBgl1zK7tzpOKT8hf22BzRMoKi4klaLES1hQ5f9b 6V4df5BKCaGUhr6Ob45MHBGiHw+IxMcZ2GfOuLyfvEmmo1zew5gSxbqP0s+8F4M8+i3J ht7A== X-Gm-Message-State: ACrzQf1OW8eOELn/PaSDNMb2VgPD8Td/IAq0sbIdxC8RgWyww32iHugm WuuEOwE7TGBLLUrwK9pSsqK1Xx/lRvRkgg== X-Google-Smtp-Source: AMsMyM4+mJds6iX6SmGv8zBt0z1jzWAV3lEkuC7YGbjAKDzlfFx8gC05+8wqmJOapDatgmd4oHutEA== X-Received: by 2002:a17:907:3e98:b0:78d:288a:c951 with SMTP id hs24-20020a1709073e9800b0078d288ac951mr8951658ejc.749.1665261806796; Sat, 08 Oct 2022 13:43:26 -0700 (PDT) Received: from mypc.localnet (host-95-248-187-1.retail.telecomitalia.it. [95.248.187.1]) by smtp.gmail.com with ESMTPSA id oq4-20020a170906cc8400b0078c47463277sm3179369ejb.96.2022.10.08.13.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Oct 2022 13:43:26 -0700 (PDT) From: "Fabio M. De Francesco" To: kernelnewbies@kernelnewbies.org Subject: Re: Using printk, how can I know where the kernel jumps after schedule() function? Date: Sat, 08 Oct 2022 22:43:29 +0200 Message-ID: <1844688.CQOukoFCf9@mypc> In-Reply-To: <035a01d8b933$427f76b0$c77e6410$@etri.re.kr> References: <035a01d8b933$427f76b0$c77e6410$@etri.re.kr> MIME-Version: 1.0 Cc: Chan Kim 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Friday, August 26, 2022 12:04:41 PM CEST Chan Kim wrote: > Hello experts, > > I am faced with a problem on my experiment. (arm64) > When the linux kernel boots and after it jumped to /bin/sh in the initramfs > (by busybox), it hangs after the program jumps the schedule() function. > I can see it comes out of schedule() function using printk, but I don't know > where it had gone(or returned). > I tried printing the bottom two values in the schedule() function, because > the x29(=fp) and x30(=lr) is stored at the stack bottom during any function. > But the lr value is somewhere in then init stack(by examining the > System.map). So I guessed that lr value, a virtual address is a user virtual > address.. Is my guess correct or should the lr value point to a point in > kernel text section? > > Actually I don't know exactly how a user program is interrupted by the > schedule function initiated by the timer interrupt so I would be grateful if > someone explain it. > ( I tried reading part of a book or web posts but didn't get what I want > yet). > > Thank you! > Regards, > > Chan Kim > I suppose that "ftrace" is your best friend in this case. YouTube videos may be the easiest introductions. I have not the links to provide, however you may search them using something like the "ftrace Steven Rostedt" keywords (Steven is the author and maintainer). Otherwise read the man pages of the "trace-cmd" set of related userspace programs built with the purpose to serve as interfaces to the kernel "ftrace". In case you need more, you'll have to learn how ftrace actually works and how to write your custom tracers in the kernel. If so, you have no other choice than learning from the official docs at https://docs.kernel.org/trace/ index.html. Regards, Fabio _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies