9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] print() in kernel space doesn't work like I would think
@ 2023-08-31 15:43 dusan3sic
  2023-08-31 15:48 ` Steve Simon
  2023-08-31 16:27 ` ori
  0 siblings, 2 replies; 12+ messages in thread
From: dusan3sic @ 2023-08-31 15:43 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]

I was editing plan9's realtime scheduler in /sys/src/9/port/edf.c and was trying to add a print to log something, but print didn't show anywhere(or I am looking at the wrong place). It has some prints in source code already, with this define.
#define DPRINT  if(Dontprint){}else print
And with Dontprint set to 0

I was expecting the output to be at boot time, in boot screen where it asks for bootargs, but it wasn't there. I thought it was either the wrong place I am looking at or it prints after I start the gui so I don't get to see it. 

Then i tried other prints,  iprint() seemed really cool and usefull but it does nothing. It builds ok, but doesn't output anything on serial (on Qemu serial window). Also, it didn't work in some user space program I made to test it. 

All I want is to have a normal log system so I can log things on screen.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-M7023d44f6d581fa0bf266fef
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1946 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 15:43 [9fans] print() in kernel space doesn't work like I would think dusan3sic
@ 2023-08-31 15:48 ` Steve Simon
  2023-08-31 16:27 ` ori
  1 sibling, 0 replies; 12+ messages in thread
From: Steve Simon @ 2023-08-31 15:48 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/html, Size: 2440 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 15:43 [9fans] print() in kernel space doesn't work like I would think dusan3sic
  2023-08-31 15:48 ` Steve Simon
@ 2023-08-31 16:27 ` ori
  2023-08-31 16:31   ` ori
  1 sibling, 1 reply; 12+ messages in thread
From: ori @ 2023-08-31 16:27 UTC (permalink / raw)
  To: 9fans

Quoth dusan3sic@gmail.com:
> I was editing plan9's realtime scheduler in /sys/src/9/port/edf.c and was trying to add a print to log something, but print didn't show anywhere(or I am looking at the wrong place). It has some prints in source code already, with this define.
> #define DPRINT  if(Dontprint){}else print
> And with Dontprint set to 0
> 
> I was expecting the output to be at boot time, in boot screen where it asks for bootargs, but it wasn't there. I thought it was either the wrong place I am looking at or it prints after I start the gui so I don't get to see it. 
> 
> Then i tried other prints,  iprint() seemed really cool and usefull but it does nothing. It builds ok, but doesn't output anything on serial (on Qemu serial window). Also, it didn't work in some user space program I made to test it. 
> 
> All I want is to have a normal log system so I can log things on screen.

show your diff.

(hint: bind -ac /dist/plan9front / && git/diff /sys/src/9 | webpaste)


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-M56ffb2bd609da38808a99006
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 16:27 ` ori
@ 2023-08-31 16:31   ` ori
  2023-08-31 16:46     ` dusan3sic
  2023-08-31 16:53     ` dusan3sic
  0 siblings, 2 replies; 12+ messages in thread
From: ori @ 2023-08-31 16:31 UTC (permalink / raw)
  To: 9fans

Quoth ori@eigenstate.org:
> 
> show your diff.
> 
> (hint: bind -ac /dist/plan9front / && git/diff /sys/src/9 | webpaste)

also, the steps you used to install and boot the new kernel.



------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-Mfb97c091f91a95eef8849f06
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 16:31   ` ori
@ 2023-08-31 16:46     ` dusan3sic
  2023-08-31 16:58       ` dusan3sic
  2023-08-31 16:53     ` dusan3sic
  1 sibling, 1 reply; 12+ messages in thread
From: dusan3sic @ 2023-08-31 16:46 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

> try
> 
> cat /dev/kmesg
> or
> cat /dev/kprint

/dev/kmesg outputs the boot output I was talking about, but there wasn't my print.

dev/kprint doesn't print anything and doesn't let me finish the program. I was looking at this <https://9p.io/wiki/plan9/avoiding_screen_pollution_from_kernel_messages/index.html> and did that but no luck there neither. It says null list concatenation when I am booting it and I think it's because $sysname is empty. When I say smth random instead of sysname it makes the file but it's still empty. 

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-Mc46eb4d9cbdcc3a2e9462e3c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1509 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 16:31   ` ori
  2023-08-31 16:46     ` dusan3sic
@ 2023-08-31 16:53     ` dusan3sic
  2023-08-31 17:20       ` ori
  1 sibling, 1 reply; 12+ messages in thread
From: dusan3sic @ 2023-08-31 16:53 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

> show your diff.

(hint: bind -ac /dist/plan9front / && git/diff /sys/src/9 | webpaste)

diff 66fc6a3e6443d7eb8298f65b0c9803197d196ec7 uncommitted
--- a//sys/src/9/mkfile
+++ b//sys/src/9/mkfile
@@ -1,17 +1,17 @@
ARCH=\
-       bcm\
-       bcm64\
-       cycv\
-       kw\
+       #bcm\
+       #bcm64\
+       #cycv\
+       #kw\
#mtx\
-       omap\
-       pc\
+       #omap\
+       #pc\
pc64\
#ppc\
-       sgi\
-       teg2\
-       xen\
-       zynq\
+       #sgi\
+       #teg2\
+       #xen\
+       #zynq\

all:V:
for(i in $ARCH)@{
--- a//sys/src/9/pc64/main.c
+++ b//sys/src/9/pc64/main.c
@@ -182,7 +182,7 @@
i8250console();
quotefmtinstall();
screeninit();
-       print("\nPlan 9\n");
+       print("\nPlan 69\n");
cpuidentify();
meminit0();
archinit();
--- a//sys/src/9/port/edf.c
+++ b//sys/src/9/port/edf.c
@@ -10,9 +10,10 @@

/* debugging */
enum {
-       Dontprint = 1,
+       Dontprint = 0,
};

+
#define DPRINT  if(Dontprint){}else print

static long     now;    /* Low order 32 bits of time in µs */
@@ -118,6 +119,7 @@
void
edfinit(Proc*p)
{
+       print("NESTO");
if(!edfinited){
fmtinstall('t', timeconv);
edfinited++;

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-M4ca4b50abdab602d087c7b2f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2874 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 16:46     ` dusan3sic
@ 2023-08-31 16:58       ` dusan3sic
  2023-08-31 17:25         ` dusan3sic
  0 siblings, 1 reply; 12+ messages in thread
From: dusan3sic @ 2023-08-31 16:58 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

> also, the steps you used to install and boot the new kernel.

I downloaded img from 9front.
I was changing the source code and building with this script I made
#!/bin/rc

mk install
9fs 9fat
cp /sys/src/9/pc64/9pc64 /n/9fat/9pc64
mk clean
I am running it from /sys/src/9/pc64/
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-Me2158acbfcbc451a0ed90ddf
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1354 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 16:53     ` dusan3sic
@ 2023-08-31 17:20       ` ori
  0 siblings, 0 replies; 12+ messages in thread
From: ori @ 2023-08-31 17:20 UTC (permalink / raw)
  To: 9fans

Quoth dusan3sic@gmail.com:
> +       print("\nPlan 69\n");

if you don't see this print, you're somehow 
running the wrong kernel.

> +       print("NESTO");

this one won't print until you start using
the edf scheduler.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-Md727cc0ff6722b4f770e79ab
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 16:58       ` dusan3sic
@ 2023-08-31 17:25         ` dusan3sic
  2023-08-31 17:34           ` ori
  2023-08-31 19:42           ` ori
  0 siblings, 2 replies; 12+ messages in thread
From: dusan3sic @ 2023-08-31 17:25 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

> if you don't see this print, you're somehow 
running the wrong kernel.
I can see that.

> this one won't print until you start using
the edf scheduler.
Isn't windowing handled like a realtime process? Does it not start any realtime process at boot? I can see that being the problem here. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-Mf55a3a1fe57d4eafe3104092
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1200 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 17:25         ` dusan3sic
@ 2023-08-31 17:34           ` ori
  2023-09-01 10:59             ` dusan3sic
  2023-08-31 19:42           ` ori
  1 sibling, 1 reply; 12+ messages in thread
From: ori @ 2023-08-31 17:34 UTC (permalink / raw)
  To: 9fans

Quoth dusan3sic@gmail.com:
> > if you don't see this print, you're somehow 
> running the wrong kernel.
> I can see that.
> 
> > this one won't print until you start using
> the edf scheduler.
> Isn't windowing handled like a realtime process? Does it not start any realtime process at boot? I can see that being the problem here. 

no. currently, no hard deadlines are set for any code shipped
with the system; the realtime subsystem is generally not used.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-M3fc8ade6a994541aafd5c68e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 17:25         ` dusan3sic
  2023-08-31 17:34           ` ori
@ 2023-08-31 19:42           ` ori
  1 sibling, 0 replies; 12+ messages in thread
From: ori @ 2023-08-31 19:42 UTC (permalink / raw)
  To: 9fans

Quoth dusan3sic@gmail.com:
> Isn't windowing handled like a realtime process?
> Does it not start any realtime process at boot?
> I can see that being the problem here. 

also, real time isn't a synonym for high priority;
it's saying that the OS *must* be able to run the
process at the specified times, and erroring when
starting the process is preferred if the OS can't
guarantee it has the resources.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-M75899828ae3fbea192ac248b
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [9fans] print() in kernel space doesn't work like I would think
  2023-08-31 17:34           ` ori
@ 2023-09-01 10:59             ` dusan3sic
  0 siblings, 0 replies; 12+ messages in thread
From: dusan3sic @ 2023-09-01 10:59 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

I tried actually running some realtime processes and the print msg appeared. Thanks
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Te1d00dae663114b2-M0b15b6c18936d12d96aa47dc
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 805 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-09-01 10:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 15:43 [9fans] print() in kernel space doesn't work like I would think dusan3sic
2023-08-31 15:48 ` Steve Simon
2023-08-31 16:27 ` ori
2023-08-31 16:31   ` ori
2023-08-31 16:46     ` dusan3sic
2023-08-31 16:58       ` dusan3sic
2023-08-31 17:25         ` dusan3sic
2023-08-31 17:34           ` ori
2023-09-01 10:59             ` dusan3sic
2023-08-31 19:42           ` ori
2023-08-31 16:53     ` dusan3sic
2023-08-31 17:20       ` ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).