Re: serial console detection during boot

2012-09-22 Thread Olivier Cochard-Labbé
On Mon, Sep 17, 2012 at 10:23 PM, Andriy Gapon a...@freebsd.org wrote:

 Guys,

 With this patch I am able to boot with
 boot_multicons=YES
 console=vidconsole,comconsole
 in loader.conf on hardware where serial ports are disabled in BIOS.
 Previously loader would just hang trying to apply the console setting.

I confirm that I can boot under Virtualbox without serial port
configured with your patch and dual console configuration in
/boot/loader.conf.

But, I've still the same hang problem with a system configured for
booting with dual console configuration like that:
echo -D  /boot.config

Regards,

Olivier
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: serial console detection during boot

2012-09-22 Thread Andriy Gapon
on 22/09/2012 11:40 Olivier Cochard-Labbé said the following:
 On Mon, Sep 17, 2012 at 10:23 PM, Andriy Gapon a...@freebsd.org wrote:

 Guys,

 With this patch I am able to boot with
 boot_multicons=YES
 console=vidconsole,comconsole
 in loader.conf on hardware where serial ports are disabled in BIOS.
 Previously loader would just hang trying to apply the console setting.
 
 I confirm that I can boot under Virtualbox without serial port
 configured with your patch and dual console configuration in
 /boot/loader.conf.
 
 But, I've still the same hang problem with a system configured for
 booting with dual console configuration like that:
 echo -D  /boot.config

This is because -D affects behavior of boot2 as well and boot2 uses different
serial console code (in BTX).

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: serial console detection during boot

2012-09-22 Thread Andriy Gapon

Here is an update on the changes:
http://people.freebsd.org/~avg/boot-comconsole.diff

Please note that the file is actually a patchset that consists of three
individual changes:
- a generic change in common boot code
- libi386 comconsole change
- BTX and boot2-ish comconsole change

All the code is lightly tested.
As I am not an expert in the assembly code and also because boot2 is quite
size-sensitive I would like to ask for a special attention to the last change.

Thank you!!

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


kern_exec: check p_tracecred instead of p_cred

2012-09-22 Thread Andriy Gapon

Currently even if root ktraces an unprivileged process that execs a sguid
executable, then tracing aborted at that point.  I think that that happens
because wrong credentials are checked at that point.

What do you think about the following patch?

commit 956a80783bc39162b1d64383188c5037f9767413
Author: Andriy Gapon a...@icyb.net.ua
Date:   Sat Sep 22 18:17:46 2012 +0300

kern_exec: check p_tracecred instead of p_cred

... when deciding whether to continue tracing across suid/sgid exec

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 90f7311..8d62c1e 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -694,7 +694,8 @@ interpret:
setsugid(p);

 #ifdef KTRACE
-   if (priv_check_cred(oldcred, PRIV_DEBUG_DIFFCRED, 0))
+   if (p-p_tracecred != NULL 
+   priv_check_cred(p-p_tracecred, PRIV_DEBUG_DIFFCRED, 0))
ktrprocexec(p, tracecred, tracevp);
 #endif
/*

-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: cpu_spinwait in cngetc

2012-09-22 Thread Andriy Gapon
on 18/09/2012 16:25 Andriy Gapon said the following:
 
 (Why[*]) Would anyone object to a change like this?
 
 diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
 index 5346bc3..d17846a 100644
 --- a/sys/kern/kern_cons.c
 +++ b/sys/kern/kern_cons.c
 @@ -384,7 +384,7 @@ cngetc(void)
   if (cn_mute)
   return (-1);
   while ((c = cncheckc()) == -1)
 - ;
 + cpu_spinwait();
   if (c == '\r')
   c = '\n';   /* console input is always ICRNL */
   return (c);
 
 [*] :-)
 

I would to re-ping with this question.
Is there any architecture where a cpu_spinwait could cause a surprise?
Or is universally safe?

The most visible place which this change can affect is ddb prompt.


-- 
Andriy Gapon
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: serial console detection during boot

2012-09-22 Thread Olivier Cochard-Labbé
On Sat, Sep 22, 2012 at 5:35 PM, Andriy Gapon a...@freebsd.org wrote:

 Here is an update on the changes:
 http://people.freebsd.org/~avg/boot-comconsole.diff


Patch applied on 9.1-RC1 with success.
Tested under virtualbox with /boot.config that include -D and
multi-console in /boot/loader.conf with these VM configurations:
- vga and serial port: OK
- vga only: OK
And under qemu with a -nographic option: OK

Thanks a lot's !

Olivier
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: [CFT/RFC]: refactor bsd.prog.mk to understand multiple programs instead of a singular program

2012-09-22 Thread Garrett Cooper
On Sun, Sep 2, 2012 at 11:01 PM, Garrett Cooper yaneg...@gmail.com wrote:
 Hello,
 I've been a bit busy working on porting over ATF from NetBSD, and
 one of the pieces that's currently not available in FreeBSD that's
 available in NetBSD is the ability to understand and compile multiple
 programs. In order to do this I had to refactor bsd.prog.mk (a lot).
 The attached patch is the end result so far, and I was wondering if
 anyone could please review it and/or test it (outside of me doing so).
 I wrote over 40 tests, but it's not exercising everything, and I would
 like for someone to please review/test this out who has an interest in
 NLS support (ala bsd.nls.mk) in particular. AFAICT this is the only
 gap that I couldn't resolve right away (there isn't a ton of recent
 documentation on how to use bsd.nls.mk).
 I'll run a micro benchmark and buildworld a few times (in
 progress) with and without the change to measure the performance
 effect.
 Any assistance would be much appreciated.

I've attached an updated version of the patch (run through
buildworld successfully multiple times; make universe successfully;
going to submit for an -exp run). I needed to modify bsd.crunchgen.mk
to grok OBJS.${PROG}, but apart from that backwards compatibility has
been maintained -- sans-INSTALLFLAGS_EDIT (does anyone still use that
undocumented functionality?).
Performance wise, it's slightly slower on my W3520 with the
change, but not by much (~20 seconds).
As always, questions and comments are welcome, and if someone has
a chance, please review the proposed patch.
Thanks!
-Garrett

Without the change:

$ python calc_runtime.py bw.*_without.log | ministat -w 72
x stdin
++
| x  |
|xx  x  x x xx  x   x|
| |_A_M| |
++
N   Min   MaxMedian   AvgStddev
x  10   919  1010   972 958.9 33.994934

With the change:

$ python calc_runtime.py bw.*.log | ministat -w 72
x stdin
++
|   x|
|xx   xx  x x  x   xx|
| |___A_M_|  |
++
N   Min   MaxMedian   AvgStddev
x  10   940  1002   988 972.3 24.476973

make universe results:

# make universe MAKE_JUST_WORLDS=y
--
 make universe started on Tue Sep 18 09:30:04 PDT 2012
--
 amd64 started on Tue Sep 18 09:30:04 PDT 2012
 amd64.amd64 buildworld started on Tue Sep 18 09:30:04 PDT 2012
 amd64.amd64 buildworld completed on Tue Sep 18 11:20:19 PDT 2012
 amd64 completed on Tue Sep 18 11:20:19 PDT 2012
 arm started on Tue Sep 18 11:20:19 PDT 2012
 arm.arm buildworld started on Tue Sep 18 11:20:19 PDT 2012
 arm.arm buildworld completed on Tue Sep 18 12:25:24 PDT 2012
 arm.armeb buildworld started on Tue Sep 18 12:25:24 PDT 2012
 arm.armeb buildworld completed on Tue Sep 18 13:30:25 PDT 2012
 arm.armv6 buildworld started on Tue Sep 18 13:30:25 PDT 2012
 arm.armv6 buildworld completed on Tue Sep 18 14:35:14 PDT 2012
 arm.armv6eb buildworld started on Tue Sep 18 14:35:14 PDT 2012
 arm.armv6eb buildworld completed on Tue Sep 18 15:40:05 PDT 2012
 arm completed on Tue Sep 18 15:40:05 PDT 2012
 i386 started on Tue Sep 18 15:40:05 PDT 2012
 i386.i386 buildworld started on Tue Sep 18 15:40:05 PDT 2012
 i386.i386 buildworld completed on Tue Sep 18 16:56:06 PDT 2012
 i386 completed on Tue Sep 18 16:56:06 PDT 2012
 ia64 started on Tue Sep 18 16:56:06 PDT 2012
 ia64.ia64 buildworld started on Tue Sep 18 16:56:06 PDT 2012
 ia64.ia64 buildworld completed on Tue Sep 18 18:27:49 PDT 2012
 ia64 completed on Tue Sep 18 18:27:49 PDT 2012
 mips started on Tue Sep 18 18:27:49 PDT 2012
 mips.mipsel buildworld started on Tue Sep 18 18:27:49 PDT 2012
 mips.mipsel buildworld completed on Tue Sep 18 19:34:50 PDT 2012
 mips.mips buildworld started on Tue Sep 18 19:34:50 PDT 2012
 mips.mips buildworld completed on Tue Sep 18 20:41:49 PDT 2012
 mips.mips64el buildworld started on Tue Sep 18 20:41:49 PDT 2012
 mips.mips64el buildworld completed on Tue Sep 18 21:49:21 PDT 2012
 mips.mips64 buildworld started on Tue Sep 18 21:49:21 PDT 2012
 mips.mips64 buildworld completed on Tue Sep 18 22:57:13 PDT 2012
 mips.mipsn32 buildworld started on Tue Sep 18 22:57:13 PDT 2012
 mips.mipsn32 buildworld 

Re: cpu_spinwait in cngetc

2012-09-22 Thread Julian Elischer

On 9/22/12 10:46 AM, Andriy Gapon wrote:

on 18/09/2012 16:25 Andriy Gapon said the following:

(Why[*]) Would anyone object to a change like this?

diff --git a/sys/kern/kern_cons.c b/sys/kern/kern_cons.c
index 5346bc3..d17846a 100644
--- a/sys/kern/kern_cons.c
+++ b/sys/kern/kern_cons.c
@@ -384,7 +384,7 @@ cngetc(void)
if (cn_mute)
return (-1);
while ((c = cncheckc()) == -1)
-   ;
+   cpu_spinwait();
if (c == '\r')
c = '\n';   /* console input is always ICRNL */
return (c);

[*] :-)


I would to re-ping with this question.
Is there any architecture where a cpu_spinwait could cause a surprise?
Or is universally safe?

The most visible place which this change can affect is ddb prompt.




looks like the right thing to do
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org