Re: Enhance ptyfs to handle multiple instances.
On 01.04.2014 23:38, Ilya Zykov wrote: > Hello! > > This patch introduces subject. > Some code refactoring, because we have more stronger ptm - ptyfs binding. > BSD pty compatibility improvement. > > Main explanation you can see in comments inside. > Also I am not sure about, how, correctly release unused vnode and return it > for system and call reclaim. Before anybody call for it getnewvnode. > > fs/ptyfs/ptyfs.h| 21 + > fs/ptyfs/ptyfs_subr.c |2 -- > fs/ptyfs/ptyfs_vfsops.c | 37 + > fs/ptyfs/ptyfs_vnops.c | 26 -- > kern/tty_bsdpty.c |4 ++-- > kern/tty_ptm.c | 31 +++ > sys/pty.h | 21 - > 7 files changed, 99 insertions(+), 43 deletions(-) > > Ilya. > XXX comments change. fs/ptyfs/ptyfs.h| 21 + fs/ptyfs/ptyfs_subr.c |2 -- fs/ptyfs/ptyfs_vfsops.c | 37 + fs/ptyfs/ptyfs_vnops.c | 26 -- kern/tty_bsdpty.c |4 ++-- kern/tty_ptm.c | 30 ++ sys/pty.h | 21 - 7 files changed, 98 insertions(+), 43 deletions(-) Ilya. Index: fs/ptyfs/ptyfs.h === RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs.h,v retrieving revision 1.6 diff -u -p -r1.6 ptyfs.h --- fs/ptyfs/ptyfs.h 24 Mar 2014 20:48:08 - 1.6 +++ fs/ptyfs/ptyfs.h 2 Apr 2014 06:28:40 - @@ -106,6 +106,8 @@ struct ptyfsnode { }; struct ptyfsmount { + LIST_ENTRY(ptyfsmount) pmnt_le; + struct mount *pmnt_mp; gid_t pmnt_gid; mode_t pmnt_mode; int pmnt_flags; @@ -113,6 +115,25 @@ struct ptyfsmount { #define VFSTOPTY(mp) ((struct ptyfsmount *)(mp)->mnt_data) +LIST_HEAD(ptyfs_lhmp, ptyfsmount); + +/* + * Ptm_pty is used for switch ptm{x} driver between BSDPTY, PTYFS. + * Functions' argument (struct mount *) is used only PTYFS, + * in the case BSDPTY can be NULL, and arg must be NULL. + */ +struct ptm_pty { + int (*allocvp)(struct mount *, struct lwp *, struct vnode **, dev_t, + char); + int (*makename)(struct mount *, struct lwp *, char *, size_t, dev_t, char); + void (*getvattr)(struct mount *, struct lwp *, struct vattr *); + struct ptyfs_lhmp *arg; +}; + +dev_t pty_makedev(char, int); +int pty_vn_open(struct vnode *, struct lwp *); +struct ptm_pty *pty_sethandler(struct ptm_pty *); + #endif /* _KERNEL */ struct ptyfs_args { Index: fs/ptyfs/ptyfs_subr.c === RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs_subr.c,v retrieving revision 1.6 diff -u -p -r1.6 ptyfs_subr.c --- fs/ptyfs/ptyfs_subr.c 28 Mar 2014 10:53:57 - 1.6 +++ fs/ptyfs/ptyfs_subr.c 2 Apr 2014 06:28:40 - @@ -86,8 +86,6 @@ __KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c #include #include #include -#include -#include #include #include Index: fs/ptyfs/ptyfs_vfsops.c === RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs_vfsops.c,v retrieving revision 1.13 diff -u -p -r1.13 ptyfs_vfsops.c --- fs/ptyfs/ptyfs_vfsops.c 28 Mar 2014 10:53:57 - 1.13 +++ fs/ptyfs/ptyfs_vfsops.c 2 Apr 2014 06:28:40 - @@ -54,8 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops #include #include #include -#include -#include #include #include @@ -83,12 +81,13 @@ static void ptyfs__getvattr(struct mount */ struct ptm_pty *ptyfs_save_ptm; static int ptyfs_count; +static struct ptyfs_lhmp mph; struct ptm_pty ptm_ptyfspty = { ptyfs__allocvp, ptyfs__makename, ptyfs__getvattr, - NULL + &mph }; static const char * @@ -130,6 +129,7 @@ ptyfs__makename(struct mount *mp, struct { size_t len; const char *np; + struct cwdinfo *cwdi = l->l_proc->p_cwdi; switch (ms) { case 'p': @@ -137,6 +137,15 @@ ptyfs__makename(struct mount *mp, struct len = snprintf(tbuf, bufsiz, "/dev/null"); break; case 't': + /* + * We support traditional ptys, so we can get here, + * if pty had been opened before PTYFS was mounted, + * or was opened through /dev/ptyXX devices. + * Return it only outside chroot for more security :). + */ + if (cwdi->cwdi_rdir == NULL && ptyfs_save_ptm != NULL && +ptyfs_used_get(PTYFSptc, minor(dev), mp, 0) == NULL) + return (*ptyfs_save_ptm->makename)(mp, l, tbuf, bufsiz, dev, ms); np = ptyfs__getpath(l, mp); if (np == NULL) return EOPNOTSUPP; @@ -188,7 +197,7 @@ ptyfs__getvattr(struct mount *mp, struct void ptyfs_init(void) { - + LIST_INIT(ptm_ptyfspty.arg); malloc_type_attach(M_PTYFSMNT); malloc_type_attach(M_PTYFSTMP); ptyfs_hashinit(); @@ -218,7 +227,7 @@ ptyfs_mount(struct mount *mp, const char { struct lwp *l = curlwp; int error = 0; - struct ptyfsmount *pmnt; + struct ptyfsmount *pmnt, *pmnt_next; struct ptyfs_args *args = data; if (*
Re: HP Proliant won't reboot
From: "D'Arcy J.M. Cain" Subject: HP Proliant won't reboot Date: Tue, 1 Apr 2014 10:03:58 -0400 > I am having a strange error. I just picked up a HP Proliant G5 and > installed NetBSD 6.1.3 AMD64 on it. Everything is fine as far as > installing and running goes but when I reboot it goes through most of > the stuff, detaches a bunch of devices and then says "rebooting" and > stops. NumLock doesn't change the light and the system won't respond > to the keyboard or the network. Luckily it has already unmounted the > drive so I can safely power cycle but that's going to be extremely > inconvenient in a lights out situation. Try to cold boot. if it works,try to update iLO firmware if you can. 1. plug off power cable from power supply. 2. wait 3 min and pray. 3. plug in power cable and boot. -- Jun Ebihara
Re: asymmetric smp
On Apr 1, 2014, at 5:49 AM, Johnny Billquist wrote: > Good points. > Is this the right time to ask why booting NetBSD on a VAX (a 3500) now takes > more than 15 minutes? What is the system doing all that time??? FreeBSD used to take forever to boot on certain low-end ARM CPUs with /etc/rc.d after it was imported from NetBSD. This was due to crappy root-device performance (100kB/s is enough for anybody, right?) and crappy, at the time, pmap code that caused excess page traffic in the /etc/rc.d environment. Perhaps those areas would be fruitful to profile? Also, there were some inefficiencies that were either the result of a botched port, or were basic to the system that got fixed. Between fixing all these things, the boot time went from 10 minutes down to ~20s. Warner
Re: Enhance ptyfs to handle multiple instances.
Hello! This patch introduces subject. Some code refactoring, because we have more stronger ptm - ptyfs binding. BSD pty compatibility improvement. Main explanation you can see in comments inside. Also I am not sure about, how, correctly release unused vnode and return it for system and call reclaim. Before anybody call for it getnewvnode. fs/ptyfs/ptyfs.h| 21 + fs/ptyfs/ptyfs_subr.c |2 -- fs/ptyfs/ptyfs_vfsops.c | 37 + fs/ptyfs/ptyfs_vnops.c | 26 -- kern/tty_bsdpty.c |4 ++-- kern/tty_ptm.c | 31 +++ sys/pty.h | 21 - 7 files changed, 99 insertions(+), 43 deletions(-) Ilya. Index: fs/ptyfs/ptyfs.h === RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs.h,v retrieving revision 1.6 diff -u -p -r1.6 ptyfs.h --- fs/ptyfs/ptyfs.h 24 Mar 2014 20:48:08 - 1.6 +++ fs/ptyfs/ptyfs.h 1 Apr 2014 19:00:15 - @@ -106,6 +106,8 @@ struct ptyfsnode { }; struct ptyfsmount { + LIST_ENTRY(ptyfsmount) pmnt_le; + struct mount *pmnt_mp; gid_t pmnt_gid; mode_t pmnt_mode; int pmnt_flags; @@ -113,6 +115,25 @@ struct ptyfsmount { #define VFSTOPTY(mp) ((struct ptyfsmount *)(mp)->mnt_data) +LIST_HEAD(ptyfs_lhmp, ptyfsmount); + +/* + * Ptm_pty is used for switch ptm{x} driver between BSDPTY, PTYFS. + * Functions' argument (struct mount *) is used only PTYFS, + * in the case BSDPTY can be NULL, and arg must be NULL. + */ +struct ptm_pty { + int (*allocvp)(struct mount *, struct lwp *, struct vnode **, dev_t, + char); + int (*makename)(struct mount *, struct lwp *, char *, size_t, dev_t, char); + void (*getvattr)(struct mount *, struct lwp *, struct vattr *); + struct ptyfs_lhmp *arg; +}; + +dev_t pty_makedev(char, int); +int pty_vn_open(struct vnode *, struct lwp *); +struct ptm_pty *pty_sethandler(struct ptm_pty *); + #endif /* _KERNEL */ struct ptyfs_args { Index: fs/ptyfs/ptyfs_subr.c === RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs_subr.c,v retrieving revision 1.6 diff -u -p -r1.6 ptyfs_subr.c --- fs/ptyfs/ptyfs_subr.c 28 Mar 2014 10:53:57 - 1.6 +++ fs/ptyfs/ptyfs_subr.c 1 Apr 2014 19:00:15 - @@ -86,8 +86,6 @@ __KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c #include #include #include -#include -#include #include #include Index: fs/ptyfs/ptyfs_vfsops.c === RCS file: /cvsil/nbcur/src/sys/fs/ptyfs/ptyfs_vfsops.c,v retrieving revision 1.13 diff -u -p -r1.13 ptyfs_vfsops.c --- fs/ptyfs/ptyfs_vfsops.c 28 Mar 2014 10:53:57 - 1.13 +++ fs/ptyfs/ptyfs_vfsops.c 1 Apr 2014 19:00:15 - @@ -54,8 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: ptyfs_vfsops #include #include #include -#include -#include #include #include @@ -83,12 +81,13 @@ static void ptyfs__getvattr(struct mount */ struct ptm_pty *ptyfs_save_ptm; static int ptyfs_count; +static struct ptyfs_lhmp mph; struct ptm_pty ptm_ptyfspty = { ptyfs__allocvp, ptyfs__makename, ptyfs__getvattr, - NULL + &mph }; static const char * @@ -130,6 +129,7 @@ ptyfs__makename(struct mount *mp, struct { size_t len; const char *np; + struct cwdinfo *cwdi = l->l_proc->p_cwdi; switch (ms) { case 'p': @@ -137,6 +137,15 @@ ptyfs__makename(struct mount *mp, struct len = snprintf(tbuf, bufsiz, "/dev/null"); break; case 't': + /* + * We support traditional ptys, so we can get here, + * if pty had been opened before PTYFS was mounted, + * or was opened through /dev/ptyXX devices. + * Return it only outside chroot for more security :). + */ + if (cwdi->cwdi_rdir == NULL && ptyfs_save_ptm != NULL && +ptyfs_used_get(PTYFSptc, minor(dev), mp, 0) == NULL) + return (*ptyfs_save_ptm->makename)(mp, l, tbuf, bufsiz, dev, ms); np = ptyfs__getpath(l, mp); if (np == NULL) return EOPNOTSUPP; @@ -188,7 +197,7 @@ ptyfs__getvattr(struct mount *mp, struct void ptyfs_init(void) { - + LIST_INIT(ptm_ptyfspty.arg); malloc_type_attach(M_PTYFSMNT); malloc_type_attach(M_PTYFSTMP); ptyfs_hashinit(); @@ -218,7 +227,7 @@ ptyfs_mount(struct mount *mp, const char { struct lwp *l = curlwp; int error = 0; - struct ptyfsmount *pmnt; + struct ptyfsmount *pmnt, *pmnt_next; struct ptyfs_args *args = data; if (*data_len != sizeof *args && *data_len != OSIZE) @@ -274,10 +283,16 @@ ptyfs_mount(struct mount *mp, const char return error; } - /* Point pty access to us */ + pmnt->pmnt_mp = mp; if (ptyfs_count == 0) { - ptm_ptyfspty.arg = mp; + LIST_INSERT_HEAD(ptm_ptyfspty.arg, pmnt, pmnt_le); + /* Point pty access to us */ ptyfs_save_ptm = pty_sethandler(&ptm_ptyfspty); + } else { + pmnt_next = LIST_FIRST(ptm_ptyfspty.arg); + while(LIST_NEXT(pmnt_next, pmnt_le) != NULL) + pmnt_next = LIST_NEXT(pmnt_next, pmnt_le); + LIST_I
Re: Proposal for kernel clock changes
On Fri, Mar 28, 2014 at 06:16:23PM -0400, Dennis Ferguson wrote: > I would like to rework the clock support in the kernel a bit to correct > some deficiencies which exist now, and to provide new functionality. The > issues I would like to try to address include: A few comments, I've deleted the body so they aren't hidden! One problem I do see is knowing which counter to trust most. You are trying to cross synchronise values and it might be that the clock with the best long term accuracy is a very slow one with a lot of jitter (NTP over dialup anyone?). Whereas the fastest clock is likely to have the least jitter, but may not have the long term stability. There are places where you are only interested in the difference between timestamps - rather than needing them converting to absolute times. I also wonder whether there are timestamps for which you are never really interested in the absolute accuracy of old values. Possibly because 'old' timestamps will already have been converted to some other clock. This might be the case for ethernet packet timestamps, you may want to be able to synchronise the timestamps from different interfaces, but you may not be interested in the absolute accuracy of timestamps from packets takem several hours ago. This may mean that you can (effectively) count the ticks on all your clocks since 'boot' and then scale the frequency of each to give the same 'time since boot' - even though that will slightly change the relationship between old timestamps taken on different clocks. Possibly you do need a small offset for each clock to avoid discrepencies in the 'current time' when you recalculate the clocks frequency. If the 128bit divides are being done to generate corrected frequences, it might be that you can use the error term to adjust the current value - and remove the need for the divide at all (after the initial setup). One thought I've sometimes had is that, instead of trying to synchronise the TSC counters in an SMP system, move them as far from each other as possible! Then, when you read the TSC, you can tell from the value which cpu it must have come from! David
Re: HP Proliant won't reboot
On Tue, Apr 1, 2014 at 8:18 AM, D'Arcy J.M. Cain wrote: > On Tue, 1 Apr 2014 07:13:11 -0700 > Andy Ruhl wrote: >> > installing and running goes but when I reboot it goes through most >> > of the stuff, detaches a bunch of devices and then says "rebooting" >> > and stops. NumLock doesn't change the light and the system won't >> >> Does it power down if you use shutdown -p? > > If ACPI is enabled, yes. > >> If you use a current or 5 boot disk (or linux) does anything change? > > Linux (XUbuntu) and FreeBSD both work fine. > >> Try to decide if it's a kernel problem or a hardware problem. A >> bios/firmware update might be in order. Could be an acpi bug. > > I tried booting without ACPI and no love. I also tried no ACPI and no > SMP but still it hangs. > > I am downloading the BIOS upgrade DVD now. That seems more like a kernel issue to me, but it can't hurt to update the firmware. It would be interesting to know if other versions of NetBSD work, current especially. Maybe try with ACPIVERBOSE enabled just see what's happening? Andy
Re: HP Proliant won't reboot
On Tue, 1 Apr 2014 07:13:11 -0700 Andy Ruhl wrote: > > installing and running goes but when I reboot it goes through most > > of the stuff, detaches a bunch of devices and then says "rebooting" > > and stops. NumLock doesn't change the light and the system won't > > Does it power down if you use shutdown -p? If ACPI is enabled, yes. > If you use a current or 5 boot disk (or linux) does anything change? Linux (XUbuntu) and FreeBSD both work fine. > Try to decide if it's a kernel problem or a hardware problem. A > bios/firmware update might be in order. Could be an acpi bug. I tried booting without ACPI and no love. I also tried no ACPI and no SMP but still it hangs. I am downloading the BIOS upgrade DVD now. -- D'Arcy J.M. Cain http://www.NetBSD.org/ IM:da...@vex.net
Re: HP Proliant won't reboot
On Apr 1, 2014 7:04 AM, "D'Arcy J.M. Cain" wrote: > > I am having a strange error. I just picked up a HP Proliant G5 and > installed NetBSD 6.1.3 AMD64 on it. Everything is fine as far as > installing and running goes but when I reboot it goes through most of > the stuff, detaches a bunch of devices and then says "rebooting" and > stops. NumLock doesn't change the light and the system won't respond > to the keyboard or the network. Luckily it has already unmounted the > drive so I can safely power cycle but that's going to be extremely > inconvenient in a lights out situation. > > Anyone ever seen this? Anyone know where to start debugging this? > > Attached is my dmesg. Does it power down if you use shutdown -p? If you use a current or 5 boot disk (or linux) does anything change? Try to decide if it's a kernel problem or a hardware problem. A bios/firmware update might be in order. Could be an acpi bug. Andy
HP Proliant won't reboot
I am having a strange error. I just picked up a HP Proliant G5 and installed NetBSD 6.1.3 AMD64 on it. Everything is fine as far as installing and running goes but when I reboot it goes through most of the stuff, detaches a bunch of devices and then says "rebooting" and stops. NumLock doesn't change the light and the system won't respond to the keyboard or the network. Luckily it has already unmounted the drive so I can safely power cycle but that's going to be extremely inconvenient in a lights out situation. Anyone ever seen this? Anyone know where to start debugging this? Attached is my dmesg. -- D'Arcy J.M. Cain http://www.NetBSD.org/ IM:da...@vex.net dmesg.dusty Description: Binary data
Re: asymmetric smp
On 2014-04-01 01:47, Erik Fair wrote: On Mar 27, 2014, at 11:29 , matthew green wrote: it certainly can be improved for this situation, but i've got an SS10 with mis-matched cpus (2x100mhz, 1x150mhz, the latter with a bigger cache and thus significantly faster than the other cpus) and it works pretty fine. so - my guess is that some of the power and performance issues will still need work, but the system will boot and run normally without special work. I believe the point is to more nearly optimally schedule processes according to their needs on the processor(s) whose characteristics better match. Mr. Thomas also noted that this has energy use (power budget) implications. Apple started a push in the "energy efficient software" direction last year at WWDC, clearly to prod third-party software developers into ligher impact on the energy budgets of both iOS mobile devices and MacOS X based laptops, but this sort of thing also has implications for HVAC and power bills in large scale data centers too. As I have been wont to say for a decade or two, "the hardware giveth and the software taketh away" and it would be a good thing for NetBSD's ongoing relevance if we paid some attention to efficiency of our software's algorithms and execution efficiency with the explicit goal of minimizing energy use of the computers our system runs on. There are limits to what we can do; if users choose to run inefficient applications, or combine the software we provide in less-than-optimal ways with shell scripts, that's on them - we've (hopefully) done all we can do to provide them with the best tools. Good points. Is this the right time to ask why booting NetBSD on a VAX (a 3500) now takes more than 15 minutes? What is the system doing all that time??? Johnny