Simplify tcpdump

2016-01-25 Thread Michael McConville
fddi_bitswap is only used once, and it just adds a layer of indirection
to its preprocessor condition.

This also removes macros for BSDi and Ultrix.

ok?


Index: print-fddi.c
===
RCS file: /cvs/src/usr.sbin/tcpdump/print-fddi.c,v
retrieving revision 1.17
diff -u -p -r1.17 print-fddi.c
--- print-fddi.c16 Nov 2015 00:16:39 -  1.17
+++ print-fddi.c26 Jan 2016 03:47:55 -
@@ -48,16 +48,6 @@ struct rtentry;
 #include "fddi.h"
 
 /*
- * Some FDDI interfaces use bit-swapped addresses.
- */
-#if defined(ultrix) || defined(__alpha) || defined(__bsdi) || \
-   defined(__NetBSD__) || defined(__OpenBSD__)
-intfddi_bitswap = 0;
-#else
-intfddi_bitswap = 1;
-#endif
-
-/*
  * FDDI support for tcpdump, by Jeffrey Mogul [DECWRL], June 1992
  *
  * Based in part on code by Van Jacobson, which bears this note:
@@ -200,20 +190,22 @@ extract_fddi_addrs(const struct fddi_hea
 {
int i;
 
-   if (fddi_bitswap) {
-   /*
-* bit-swap the fddi addresses (isn't the IEEE standards
-* process wonderful!) then convert them to names.
-*/
-   for (i = 0; i < 6; ++i)
-   fdst[i] = fddi_bit_swap[fddip->fddi_dhost[i]];
-   for (i = 0; i < 6; ++i)
-   fsrc[i] = fddi_bit_swap[fddip->fddi_shost[i]];
-   }
-   else {
-   memcpy(fdst, (char *)fddip->fddi_dhost, 6);
-   memcpy(fsrc, (char *)fddip->fddi_shost, 6);
-   }
+   /*
+* Some FDDI interfaces use bit-swapped addresses.
+*/
+#if defined(__alpha) || defined(__NetBSD__) || defined(__OpenBSD__)
+   memcpy(fdst, (char *)fddip->fddi_dhost, 6);
+   memcpy(fsrc, (char *)fddip->fddi_shost, 6);
+#else
+   /*
+* bit-swap the fddi addresses (isn't the IEEE standards
+* process wonderful!) then convert them to names.
+*/
+   for (i = 0; i < 6; ++i)
+   fdst[i] = fddi_bit_swap[fddip->fddi_dhost[i]];
+   for (i = 0; i < 6; ++i)
+   fsrc[i] = fddi_bit_swap[fddip->fddi_shost[i]];
+#endif
 }
 
 /*



htprot sanity check

2016-01-25 Thread Stefan Sperling
Don't try to interpret htprot data if the last beacon didn't
contain any such data. In other words, ensure we copied data
from the beacon to ni->ni_htop1 before using ni->ni_htop1.

Note that read and write of ni->ni_htop1 are not visible in
this diff's context, but happen close-by in surrounding lines.

Index: ieee80211_input.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v
retrieving revision 1.152
diff -u -p -r1.152 ieee80211_input.c
--- ieee80211_input.c   25 Jan 2016 11:27:11 -  1.152
+++ ieee80211_input.c   25 Jan 2016 12:43:02 -
@@ -1579,8 +1579,8 @@ ieee80211_recv_probe_resp(struct ieee802
 
if (htcaps)
ieee80211_setup_htcaps(ni, htcaps + 2, htcaps[1]);
-   if (htop)
-   ieee80211_setup_htop(ni, htop + 2, htop[1]);
+   if (htop && !ieee80211_setup_htop(ni, htop + 2, htop[1]))
+   htop = NULL; /* invalid HTOP */
 
/*
 * When operating in station mode, check for state updates
@@ -1603,7 +1603,7 @@ ieee80211_recv_probe_resp(struct ieee802
ic->ic_flags &= ~IEEE80211_F_USEPROT;
ic->ic_bss->ni_erp = erp;
}
-   if (ic->ic_bss->ni_flags & IEEE80211_NODE_HT) {
+   if (htop && (ic->ic_bss->ni_flags & IEEE80211_NODE_HT)) {
enum ieee80211_htprot htprot_last, htprot;
htprot_last =
((ic->ic_bss->ni_htop1 & IEEE80211_HTOP1_PROT_MASK)
Index: ieee80211_node.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
retrieving revision 1.97
diff -u -p -r1.97 ieee80211_node.c
--- ieee80211_node.c7 Jan 2016 23:22:31 -   1.97
+++ ieee80211_node.c25 Jan 2016 12:46:50 -
@@ -1308,12 +1308,12 @@ ieee80211_setup_htcaps(struct ieee80211_
 /*
  * Install received HT op information in the node's state block.
  */
-void
+int
 ieee80211_setup_htop(struct ieee80211_node *ni, const uint8_t *data,
 uint8_t len)
 {
if (len != 22)
-   return;
+   return 0;
 
ni->ni_primary_chan = data[0]; /* XXX corresponds to ni_chan */
 
@@ -1322,6 +1322,8 @@ ieee80211_setup_htop(struct ieee80211_no
ni->ni_htop2 = (data[3] | (data[4] << 8));
 
memcpy(ni->ni_basic_mcs, [6], sizeof(ni->ni_basic_mcs));
+
+   return 1;
 }
 
 /*
Index: ieee80211_node.h
===
RCS file: /cvs/src/sys/net80211/ieee80211_node.h,v
retrieving revision 1.52
diff -u -p -r1.52 ieee80211_node.h
--- ieee80211_node.h7 Jan 2016 23:22:31 -   1.52
+++ ieee80211_node.h21 Jan 2016 01:53:03 -
@@ -353,7 +353,7 @@ extern  void ieee80211_clean_cached(struc
 extern void ieee80211_clean_nodes(struct ieee80211com *, int);
 void ieee80211_setup_htcaps(struct ieee80211_node *, const uint8_t *,
 uint8_t);
-void ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
+int ieee80211_setup_htop(struct ieee80211_node *, const uint8_t *,
 uint8_t);
 extern int ieee80211_setup_rates(struct ieee80211com *,
struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int);



Re: Firefox, malloc(3) and threads

2016-01-25 Thread lists
I haven't tried anything too scientific yet, but pages seem to load
quicker and firefox seems to be more responsive under load for me.
Before this patch, loading a page would have a tendency to lock the
browser for a few seconds on complex pages.

Nothing seems to have broken, so I'll try harder.



Re: security(8) mailbox check question

2016-01-25 Thread Craig Skinner
Hi all,

On 2016-01-23 Sat 22:31 PM |, Joerg Jung wrote:
> On Sat, Jan 23, 2016 at 08:31:09PM +0100, Ingo Schwarze wrote:
> 
> This was discussed several times before.

e.g: 
http://openbsd-archive.7691.n7.nabble.com/security-8-check-maildir-as-well-as-mailbox-permissions-td239848.html

-- 
Ray's Rule of Precision:
Measure with a micrometer.  Mark with chalk.  Cut with an axe.



Re: security(8) mailbox check question

2016-01-25 Thread Craig Skinner
Hi Ted,

On 2016-01-23 Sat 17:27 PM |, Ted Unangst wrote:
> 
> I think the possibility to fill up /var makes it a poor choice.

For mail servers, /var/mail/ can be a seperate mount point.

/var/log/ is commonly a mount point on servers.

As is /var/www/ /var/spool/{smtpd,postfix} /var/[fav-SQL-db], etc.

-- 
Cheers.



DDB is elf

2016-01-25 Thread Martin Pieuchot
Removes the abstraction layer to support multiple executable binaries.
These days all our architectures are ELF and this would allows us to
reuse the ELF parsing code more easily.

Diff below includes the db_sifting() removal.

ok?

Index: db_elf.c
===
RCS file: /cvs/src/sys/ddb/db_elf.c,v
retrieving revision 1.15
diff -u -p -r1.15 db_elf.c
--- db_elf.c25 Jan 2016 14:56:03 -  1.15
+++ db_elf.c25 Jan 2016 15:02:05 -
@@ -53,30 +53,6 @@ static char *db_elf_find_linetab(db_symt
 #defineSTAB_TO_EHDR(stab)  ((Elf_Ehdr *)((stab)->private))
 #defineSTAB_TO_SHDR(stab, e)   ((Elf_Shdr *)((stab)->private + 
(e)->e_shoff))
 
-boolean_t  db_elf_sym_init(int, void *, void *, const char *);
-db_sym_t   db_elf_lookup(db_symtab_t *, char *);
-db_sym_t   db_elf_search_symbol(db_symtab_t *, db_addr_t,
-   db_strategy_t, db_expr_t *);
-void   db_elf_symbol_values(db_symtab_t *, db_sym_t,
-   char **, db_expr_t *);
-boolean_t  db_elf_line_at_pc(db_symtab_t *, db_sym_t,
-   char **, int *, db_expr_t);
-boolean_t  db_elf_sym_numargs(db_symtab_t *, db_sym_t, int *,
-   char **);
-void   db_elf_forall(db_symtab_t *,
-   db_forall_func_t db_forall_func, void *);
-
-db_symformat_t db_symformat_elf = {
-   "ELF",
-   db_elf_sym_init,
-   db_elf_lookup,
-   db_elf_search_symbol,
-   db_elf_symbol_values,
-   db_elf_line_at_pc,
-   db_elf_sym_numargs,
-   db_elf_forall
-};
-
 /*
  * Find the symbol table and strings; tell ddb about them.
  *
@@ -261,7 +237,7 @@ db_elf_find_linetab(db_symtab_t *stab, s
  * Lookup the symbol with the given name.
  */
 db_sym_t
-db_elf_lookup(db_symtab_t *stab, char *symstr)
+db_elf_sym_lookup(db_symtab_t *stab, char *symstr)
 {
Elf_Sym *symp, *symtab_start, *symtab_end;
char *strtab;
@@ -287,7 +263,7 @@ db_elf_lookup(db_symtab_t *stab, char *s
  * provided threshold).
  */
 db_sym_t
-db_elf_search_symbol(db_symtab_t *symtab, db_addr_t off, db_strategy_t 
strategy,
+db_elf_sym_search(db_symtab_t *symtab, db_addr_t off, db_strategy_t strategy,
 db_expr_t *diffp)
 {
Elf_Sym *rsymp, *symp, *symtab_start, *symtab_end;
@@ -350,7 +326,7 @@ db_elf_search_symbol(db_symtab_t *symtab
  * Return the name and value for a symbol.
  */
 void
-db_elf_symbol_values(db_symtab_t *symtab, db_sym_t sym, char **namep,
+db_elf_sym_values(db_symtab_t *symtab, db_sym_t sym, char **namep,
 db_expr_t *valuep)
 {
Elf_Sym *symp = (Elf_Sym *)sym;
@@ -396,23 +372,8 @@ db_elf_line_at_pc(db_symtab_t *symtab, d
return (TRUE);
 }
 
-/*
- * Returns the number of arguments to a function and their
- * names if we can find the appropriate debugging symbol.
- */
-boolean_t
-db_elf_sym_numargs(db_symtab_t *symtab, db_sym_t cursym, int *nargp,
-char **argnamep)
-{
-
-   /*
-* XXX We don't support this (yet).
-*/
-   return (FALSE);
-}
-
 void
-db_elf_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void *arg)
+db_elf_sym_forall(db_symtab_t *stab, db_forall_func_t db_forall_func, void 
*arg)
 {
char *strtab;
static char suffix[2];
Index: db_hangman.c
===
RCS file: /cvs/src/sys/ddb/db_hangman.c,v
retrieving revision 1.32
diff -u -p -r1.32 db_hangman.c
--- db_hangman.c14 Mar 2015 03:38:46 -  1.32
+++ db_hangman.c25 Jan 2016 15:02:05 -
@@ -103,14 +103,14 @@ db_randomsym(size_t *lenp)
stab = _symtabs[arc4random_uniform(nsymtabs)];
 
dfa.cnt = 0;
-   X_db_forall(stab, db_hang_forall, );
+   db_elf_sym_forall(stab, db_hang_forall, );
nsyms = -dfa.cnt;
 
if (nsyms == 0)
return (NULL);
 
dfa.cnt = arc4random_uniform(nsyms);
-   X_db_forall(stab, db_hang_forall, );
+   db_elf_sym_forall(stab, db_hang_forall, );
 
q = db_qualify(dfa.sym, stab->name);
 
Index: db_sym.c
===
RCS file: /cvs/src/sys/ddb/db_sym.c,v
retrieving revision 1.41
diff -u -p -r1.41 db_sym.c
--- db_sym.c25 Jan 2016 14:50:13 -  1.41
+++ db_sym.c25 Jan 2016 15:02:05 -
@@ -52,30 +52,10 @@ db_symtab_t db_symtabs[MAXNOSYMTABS] = {
 
 db_symtab_t*db_last_symtab;
 
-static db_forall_func_t db_sift;
-
 extern char end[];
 
-/*
- * Put the most picky symbol table formats at the top!
- */
-const db_symformat_t *db_symformats[] = {
-   _symformat_elf,
-   NULL,
-};
-
-const db_symformat_t *db_symformat;
-
-boolean_t  X_db_sym_init(int, void *, void *, const char *);
-db_sym_t   X_db_lookup(db_symtab_t *, char *);
-db_sym_t   X_db_search_symbol(db_symtab_t *, db_addr_t,
-   db_strategy_t, db_expr_t *);
-void   X_db_symbol_values(db_symtab_t *, db_sym_t, 

Kill db_sifting()

2016-01-25 Thread Martin Pieuchot
It is unused, ok?

Index: db_sym.c
===
RCS file: /cvs/src/sys/ddb/db_sym.c,v
retrieving revision 1.41
diff -u -p -r1.41 db_sym.c
--- db_sym.c25 Jan 2016 14:50:13 -  1.41
+++ db_sym.c25 Jan 2016 14:53:41 -
@@ -52,8 +52,6 @@ db_symtab_t   db_symtabs[MAXNOSYMTABS] = {
 
 db_symtab_t*db_last_symtab;
 
-static db_forall_func_t db_sift;
-
 extern char end[];
 
 /*
@@ -270,106 +268,6 @@ db_lookup(char *symstr)
}
return 0;
 }
-
-/* Private structure for passing args to db_sift() from db_sifting(). */
-struct db_sift_args {
-   char*symstr;
-   int mode;
-};
-
-/*
- * Does the work of db_sifting(), called once for each
- * symbol via X_db_forall(), prints out symbols matching
- * criteria.
- */
-static void
-db_sift(db_symtab_t *stab, db_sym_t sym, char *name, char *suffix, int prefix,
-void *arg)
-{
-   char c, sc;
-   char *find, *p;
-   size_t len;
-   struct db_sift_args *dsa;
-
-   dsa = (struct db_sift_args*)arg;
-
-   find = dsa->symstr; /* String we're looking for. */
-   p = name;   /* String we're searching within. */
-
-   /* Matching algorithm cribbed from strstr(), which is not
-  in the kernel. */
-   if ((c = *find++) != 0) {
-   len = strlen(find);
-   do {
-   do {
-   if ((sc = *p++) == 0)
-   return;
-   } while (sc != c);
-   } while (strncmp(p, find, len) != 0);
-   }
-   if (dsa->mode=='F') /* ala ls -F */
-   db_printf("%s%s ", name, suffix);
-   else
-   db_printf("%s ", name);
-}
-
-/*
- * "Sift" for a partial symbol.
- * Named for the Sun OpenPROM command ("sifting").
- * If the symbol has a qualifier (e.g., ux:vm_map),
- * then only the specified symbol table will be searched;
- * otherwise, all symbol tables will be searched..
- *
- * "mode" is how-to-display, set from modifiers.
- */
-void
-db_sifting(char *symstr, int mode)
-{
-   char *cp;
-   int i;
-   int symtab_start = 0;
-   int symtab_end = MAXNOSYMTABS;
-   struct db_sift_args dsa;
-
-   /*
-* Look for, remove, and remember any symbol table specifier.
-*/
-   for (cp = symstr; *cp; cp++) {
-   if (*cp == ':') {
-   *cp = '\0';
-   for (i = 0; i < MAXNOSYMTABS; i++) {
-   if (db_symtabs[i].name &&
-   ! strcmp(symstr, db_symtabs[i].name)) {
-   symtab_start = i;
-   symtab_end = i + 1;
-   break;
-   }
-   }
-   *cp = ':';
-   if (i == MAXNOSYMTABS) {
-   db_error("invalid symbol table name");
-   /*NOTREACHED*/
-   }
-   symstr = cp+1;
-   }
-   }
-
-   /* Pass args to db_sift(). */
-   dsa.symstr = symstr;
-   dsa.mode = mode;
-
-   /*
-* Look in the specified set of symbol tables.
-*/
-   for (i = symtab_start; i < symtab_end; i++)
-   if (db_symtabs[i].name) {
-   db_printf("Sifting table %s:\n", db_symtabs[i].name);
-   X_db_forall(_symtabs[i], db_sift, );
-   }
-
-   return;
-}
-
 
 /*
  * Does this symbol name appear in more than one symbol table?
Index: db_sym.h
===
RCS file: /cvs/src/sys/ddb/db_sym.h,v
retrieving revision 1.18
diff -u -p -r1.18 db_sym.h
--- db_sym.h25 Jan 2016 14:30:30 -  1.18
+++ db_sym.h25 Jan 2016 14:53:41 -
@@ -120,9 +120,6 @@ int db_value_of_name(char *, db_expr_t *
 
 db_sym_t db_lookup(char *);
 
-void db_sifting(char *, int);
-   /* print partially matching symbol names */
-
 boolean_t db_symbol_is_ambiguous(db_sym_t);
 
 db_sym_t db_search_symbol(db_addr_t, db_strategy_t, db_expr_t *);



honour ERP protection in 11n mode

2016-01-25 Thread Stefan Sperling
ERP (Extended Rate PHY) protection must be honoured in 11n mode
on 2 GHz channels.

>From an 11b client's point of view, 11n behaves like 11g in terms
of frame protection, and we must enable ERP protection in 11n mode
if requested by the AP.
The drivers already enable ERP protection if IEEE80211_F_USEPROT is set,
even in 11n mode. But the stack doesn't yet set this flag in 11n mode.

Note that ERP protection is called "TGG protection" in iwn/iwm driver
code. TGG expands to "Task Group G" after the IEEE task group which
worked on 802.11g.

Index: ieee80211_input.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v
retrieving revision 1.152
diff -u -p -r1.152 ieee80211_input.c
--- ieee80211_input.c   25 Jan 2016 11:27:11 -  1.152
+++ ieee80211_input.c   25 Jan 2016 13:32:29 -
@@ -2299,7 +2299,9 @@ ieee80211_recv_assoc_resp(struct ieee802
/*
 * Honor ERP protection.
 */
-   if (ic->ic_curmode == IEEE80211_MODE_11G &&
+   if ((ic->ic_curmode == IEEE80211_MODE_11G ||
+   (ic->ic_curmode == IEEE80211_MODE_11N &&
+   IEEE80211_IS_CHAN_2GHZ(ni->ni_chan))) &&
(ni->ni_erp & IEEE80211_ERP_USE_PROTECTION))
ic->ic_flags |= IEEE80211_F_USEPROT;
else
Index: ieee80211_node.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
retrieving revision 1.97
diff -u -p -r1.97 ieee80211_node.c
--- ieee80211_node.c7 Jan 2016 23:22:31 -   1.97
+++ ieee80211_node.c25 Jan 2016 13:32:29 -
@@ -1515,7 +1515,9 @@ ieee80211_node_join(struct ieee80211com 
ni->ni_associd = aid | 0xc000;
IEEE80211_AID_SET(ni->ni_associd, ic->ic_aid_bitmap);
newassoc = 1;
-   if (ic->ic_curmode == IEEE80211_MODE_11G)
+   if (ic->ic_curmode == IEEE80211_MODE_11G ||
+   (ic->ic_curmode == IEEE80211_MODE_11N &&
+   IEEE80211_IS_CHAN_2GHZ(ic->ic_bss->ni_chan)))
ieee80211_node_join_11g(ic, ni);
} else
newassoc = 0;
@@ -1682,7 +1684,9 @@ ieee80211_node_leave(struct ieee80211com
if (ic->ic_flags & IEEE80211_F_RSNON)
ieee80211_node_leave_rsn(ic, ni);
 
-   if (ic->ic_curmode == IEEE80211_MODE_11G)
+   if (ic->ic_curmode == IEEE80211_MODE_11G ||
+   (ic->ic_curmode == IEEE80211_MODE_11N &&
+   IEEE80211_IS_CHAN_2GHZ(ic->ic_bss->ni_chan)))
ieee80211_node_leave_11g(ic, ni);
 
if (ni->ni_flags & IEEE80211_NODE_HT)



Re: libgen.h: unreachable decls

2016-01-25 Thread Todd C. Miller
On Mon, 25 Jan 2016 06:14:39 +0100, =?utf-8?Q?J=C3=A9r=C3=A9mie_Courr=C3=A8ges-
Anglas?= wrote:

> I noticed those a while ago, the #if 0 is there since the beginning.
> Can't see the point in keeping this as is.

OK.  The __loc1 symbol and the regcmp() and regex() functions were
removed from Open Group Base Specifications Issue 6 so we are never
going to implement those.

 - todd



Re: Firefox, malloc(3) and threads

2016-01-25 Thread Stefan Wollny
Hi Mark,

even with 16GB RAM I needed to install smtube to get a decent view of
videos prior to your patches. Patched last night but only tonight I am
able to do some testing:

At present I have openend
- LibreOffice Writer with one doc
- LibreOffice Calc with one doc
- gimp with one picture
- Pidgin-OTR
- smplayer (nothing playing)
- Thunderbird (two mail boxes)
- Firefox with 10 tabs open, one of them being YT (Theo talking about
pledge at Hackfest 2015)

Even though YT is hanging every now an then it it now perfectly possible
to watch / listen / follow the presentation although I have just a
modest line. CPU usage (noticed via 'top') peaked at around 160% but
average seems to be around 100%.

I didn't notice any drawbacks from your patches. Every program is
responsive, only thunderbird had some delays while typing this post
(listening to Theo meanwhile).

While this is not a "serious" test (by academic terms as it is not 100%
repeatable) I can only report that I didn't come across any failures.
Instead the system "feels" to be highly responsive with any task I tried.

To summarize: THANK YOU!

Best,
STEFAN



OpenBSD 5.9-beta (GENERIC.MP) #1863: Sun Jan 24 21:35:42 MST 2016
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 17082359808 (16291MB)
avail mem = 16560455680 (15793MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xeb500 (35 entries)
bios0: vendor American Megatrends Inc. version "1.05.01" date 08/05/2015
bios0: Notebook W65_67SZ
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP APIC FPDT ASF! SSDT SSDT SSDT MCFG HPET SSDT
SSDT SSDT DMAR
acpi0: wakeup devices PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4)
RP03(S4) PXSX(S4) RP04(S4) RLAN(S4) PXSX(S4) RP05(S4) PXSX(S4) RP06(S4)
PXSX(S4) RP07(S4) PXSX(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz, 3093.23 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz, 3092.84 MHz
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
cpu2 at mainbus0: apid 1 (application processor)
cpu2: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz, 3092.84 MHz
cpu2:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 1, core 0, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-4210M CPU @ 2.60GHz, 3092.84 MHz
cpu3:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf800, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (RP01)
acpiprt2 at acpi0: bus 3 (RP03)
acpiprt3 at acpi0: bus 4 (RP04)
acpiprt4 at acpi0: bus 1 (P0P2)
acpiprt5 at acpi0: bus -1 (P0PA)
acpiprt6 at acpi0: bus -1 (P0PB)
acpiprt7 at acpi0: bus 1 (PEG0)
acpiec0 at acpi0
acpicpu0 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS
acpitz0 at acpi0: critical temperature is 120 degC
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: 

Re: Firefox, malloc(3) and threads

2016-01-25 Thread Edd Barrett
Hi Mark,

On Fri, Jan 22, 2016 at 10:46:39PM +0100, Mark Kettenis wrote:
> Firefox makes a lot of concurrent malloc(3) calls.  The locking to
> make malloc(3) thread-safe is a bit...suboptimal.  This diff makes
> things better by using a mutex instead of spinlock.  If you're running
> Firefox you want to try it; it makes video watchable on some machines.
> If you're not running Firefox you want to try it; to make sure it
> doesn't break things.

I tried your diff. Nothing bad happened.

I don't notice much difference in firefox using a highly unscientific
"gut-feeling" before and after test. Youtube videos still stutter -- too
much to watch. During this time firefox uses ~170% CPU.

I also tried iridium, my everyday browser and didn't notice a difference
here either. Youtube videos performance remains the same: much better
than firefox, but still skipping frequently.

My system is a thinkpad x240t tablet. Dmesg follows (sorry about the
suspend in there: I have to perform a zzz and wake before the HDMI2
output shows up in my docking station, so it's always the first thing I
do after booting fresh -- keep meaning to look into this):

OpenBSD 5.9-beta (GENERIC.MP) #17: Mon Jan 25 14:31:46 GMT 2016
e...@wilfred.dlink.com:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 16844521472 (16064MB)
avail mem = 16329822208 (15573MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdae9c000 (68 entries)
bios0: vendor LENOVO version "GCETA2WW (2.62 )" date 04/09/2015
bios0: LENOVO 3437CTO
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SLIC TCPA SSDT SSDT SSDT HPET APIC MCFG ECDT FPDT ASF! 
UEFI UEFI POAT SSDT SSDT DMAR UEFI DBG2
acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP3(S4) XHCI(S3) EHC1(S3) 
EHC2(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2594.59 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 2 (application processor)
cpu1: Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz, 2594.11 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf800, bus 0-63
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 2 (EXP1)
acpiprt3 at acpi0: bus 3 (EXP2)
acpiprt4 at acpi0: bus 4 (EXP3)
acpicpu0 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: PUBS, resource for XHCI, EHC1, EHC2
acpitz0 at acpi0: critical temperature is 103 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "45N1077" serial 14278 type LION oem "SANYO"
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: GDCK docked (15)
cpu0: Enhanced SpeedStep 2594 MHz: speeds: 2601, 2600, 2500, 2400, 2300, 2200, 
2100, 2000, 1900, 1800, 1700, 1600, 1500, 1400, 1300, 1200 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 3G Host" rev 0x09
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 4000" rev 0x09
drm0 at inteldrm0
inteldrm0: msi
inteldrm0: 1366x768
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel 7 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured
em0 at pci0 dev 25 function 0 "Intel 82579LM" rev 0x04: msi, address 
3c:97:0e:a5:02:69
ehci0 at pci0 dev 26 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 16
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi
azalia0: codecs: Realtek ALC269, Intel/0x2806, using Realtek ALC269
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 7 Series PCIE" rev 0xc4: msi
pci1 at ppb0 bus 2
sdhc0 at pci1 dev 0 function 0 "Ricoh 5U822 SD/MMC" rev 0x07: apic 2 int 16
sdmmc0 at sdhc0

Re: Xen virtual network (Netfront) driver

2016-01-25 Thread Jonathon Sisson
On Mon, Jan 25, 2016 at 12:04:03PM +0100, Mike Belopuhov wrote:
> On 25 January 2016 at 01:38, Jonathon Sisson  wrote:
> > Not certain if this is debug output put there intentionally or
> 
> Yes.
> 
> > if this is some error condition?
> 
> It is.  Transmission is stuck and these are watchdog timeouts.
> Did it get a lease on c4.8xlarge?  So far it looks like it happens
> on m4.10xlarge instance only.  No idea why.
> 
Here's the console output:

user@host:~$ grep 'tx prod' dmesg/*
dmesg/c4.8xlarge_dmesg.txt:xnf0: tx prod 2 cons 2,0 evt 3,1
dmesg/c4.8xlarge_dmesg.txt:xnf0: tx prod 3 cons 3,0 evt 4,1
dmesg/c4.8xlarge_dmesg.txt:xnf0: tx prod 4 cons 4,0 evt 5,1
dmesg/c4.8xlarge_dmesg.txt:xnf0: tx prod 5 cons 5,0 evt 6,1
dmesg/c4.8xlarge_dmesg.txt:xnf0: tx prod 6 cons 6,0 evt 7,1
dmesg/c4.8xlarge_dmesg.txt:xnf0: tx prod 7 cons 7,0 evt 8,1
dmesg/d2.8xlarge_dmesg.txt:xnf0: tx prod 2 cons 2,0 evt 3,1
dmesg/d2.8xlarge_dmesg.txt:xnf0: tx prod 3 cons 3,0 evt 4,1
dmesg/d2.8xlarge_dmesg.txt:xnf0: tx prod 4 cons 4,0 evt 5,1
dmesg/d2.8xlarge_dmesg.txt:xnf0: tx prod 5 cons 5,0 evt 6,1
dmesg/d2.8xlarge_dmesg.txt:xnf0: tx prod 6 cons 6,0 evt 7,1
dmesg/g2.8xlarge_dmesg.txt:xnf0: tx prod 5 cons 5,0 evt 6,1
dmesg/g2.8xlarge_dmesg.txt:xnf0: tx prod 6 cons 6,0 evt 7,1
dmesg/i2.8xlarge_dmesg.txt:xnf0: tx prod 3 cons 3,0 evt 4,1
dmesg/i2.8xlarge_dmesg.txt:xnf0: tx prod 4 cons 4,0 evt 5,1
dmesg/i2.8xlarge_dmesg.txt:xnf0: tx prod 5 cons 5,0 evt 6,1
dmesg/i2.8xlarge_dmesg.txt:xnf0: tx prod 6 cons 6,0 evt 7,1
dmesg/i2.8xlarge_dmesg.txt:xnf0: tx prod 7 cons 7,0 evt 8,1
dmesg/m4.10xlarge_dmesg.txt:xnf0: tx prod 2 cons 2,0 evt 3,1
dmesg/m4.10xlarge_dmesg.txt:xnf0: tx prod 3 cons 3,0 evt 4,1
dmesg/m4.10xlarge_dmesg.txt:xnf0: tx prod 4 cons 4,0 evt 5,1
dmesg/m4.10xlarge_dmesg.txt:xnf0: tx prod 5 cons 5,0 evt 6,1
dmesg/m4.10xlarge_dmesg.txt:xnf0: tx prod 6 cons 6,0 evt 7,1
dmesg/r3.8xlarge_dmesg.txt:xnf0: tx prod 5 cons 5,0 evt 6,1
dmesg/r3.8xlarge_dmesg.txt:xnf0: tx prod 6 cons 6,0 evt 7,1
dmesg/r3.8xlarge_dmesg.txt:xnf0: tx prod 7 cons 7,0 evt 8,1
dmesg/r3.8xlarge_dmesg.txt:xnf0: tx prod 8 cons 8,0 evt 9,1

It happens on c4.8x, d2.8x, g2.8x, i2.8x, m4.10x, r3.8x.  
Basically all of the largest instances sizes...on newer
gen instance types that support enhanced networking?  

I can re-test these and see if it occurs frequently or
if it was just a fluke.  I'll update in a bit.




Re: Firefox, malloc(3) and threads

2016-01-25 Thread Juan Francisco Cantero Hurtado
On Mon, Jan 25, 2016 at 10:06:22AM +0100, David Coppa wrote:
> On Sun, Jan 24, 2016 at 7:47 PM, Adam Wolk  wrote:
> > On Fri, 22 Jan 2016 22:46:39 +0100 (CET)
> > Mark Kettenis  wrote:
> >
> >> Firefox makes a lot of concurrent malloc(3) calls.  The locking to
> >> make malloc(3) thread-safe is a bit...suboptimal.  This diff makes
> >> things better by using a mutex instead of spinlock.  If you're running
> >> Firefox you want to try it; it makes video watchable on some machines.
> >> If you're not running Firefox you want to try it; to make sure it
> >> doesn't break things.
> >>
> >> Enjoy,
> >>
> >> Mark
> >>  '
> >
> > Applied to a Jan 15h snapshot sources. Youtube is not fully 'watchable'
> > on firefox but feels significantly better. I can also now watch full
> > screen youtube videos on chromium 1920x1080 with no stutter (lenovo
> > g50-70).
> >
> > Generally gnome 3 feels a bit snappier especially on first load,
> > bringing up the menu searching for 'terminal' leads to a faster
> > rendering of the results. This might be just 'imagined' by me.
> >
> > On a more measurable front. I ran the octane benchmark against firefox
> > post and before the patch. It resulted in a slight improvement from
> > 12486 to 12826 score [1].
> 
> Besides performance related issues, the problem we saw in the past was
> firefox using a huge amount of CPU resources with no apparent
> reasons...

I've seen the same behavior on Linux. Probably not 100% related to the
OS.

-- 
Juan Francisco Cantero Hurtado http://juanfra.info



RCS: Mdocdate expansion

2016-01-25 Thread Ingo Schwarze
Hi,

tj@ just noticed that our RCS still doesn't know how to expand Mdocdate.  
One consequence is that rcsdiff(1) shows wrong Mdocdate lines -
typically, for each revision, the ones from the previous revision.
That in turn causes cvsweb to show wrong Mdocdate lines in diffs.

I'm showing the patch here because RCS is still somewhat important
infrastructure.

OK?
  Ingo


Index: rcs.c
===
RCS file: /cvs/src/usr.bin/rcs/rcs.c,v
retrieving revision 1.84
diff -u -p -r1.84 rcs.c
--- rcs.c   2 Nov 2015 16:45:21 -   1.84
+++ rcs.c   25 Jan 2016 17:41:18 -
@@ -66,6 +66,7 @@ struct rcs_kw rcs_expkw[] =  {
{ "Revision",   RCS_KW_REVISION },
{ "Source", RCS_KW_SOURCE   },
{ "State",  RCS_KW_STATE},
+   { "Mdocdate",   RCS_KW_MDOCDATE },
 };
 
 int rcs_errno = RCS_ERR_NOERR;
@@ -1594,6 +1595,16 @@ rcs_expand_keywords(char *rcsfile_in, st
if (kwtype & RCS_KW_SOURCE) {
buf_puts(newbuf, rcsfile);
buf_putc(newbuf, ' ');
+   }
+
+   if (kwtype & RCS_KW_MDOCDATE) {
+   strftime(buf, sizeof(buf), "%B", );
+   buf_puts(newbuf, buf);
+   /* Only one blank before single-digit day. */
+   snprintf(buf, sizeof(buf), " %d", tb.tm_mday);
+   buf_puts(newbuf, buf);
+   strftime(buf, sizeof(buf), " %Y ", );
+   buf_puts(newbuf, buf);
}
 
if (kwtype & RCS_KW_NAME)
Index: rcs.h
===
RCS file: /cvs/src/usr.bin/rcs/rcs.h,v
retrieving revision 1.16
diff -u -p -r1.16 rcs.h
--- rcs.h   3 Jun 2013 17:04:35 -   1.16
+++ rcs.h   25 Jan 2016 17:41:18 -
@@ -69,6 +69,7 @@
 #define RCS_KW_SOURCE  0x0400
 #define RCS_KW_STATE   0x0800
 #define RCS_KW_FULLPATH0x0010
+#define RCS_KW_MDOCDATE0x0020
 #define RCS_KW_LOCKER  0x1
 
 #define RCS_KW_ID \



Willing to help

2016-01-25 Thread Rodrigo Mosconi
Hi OpenBSD developers,

First of all: Thanks by the project.


I would like to receive some help/mentoring. I`m cursing a master degree
course at PUC-Rio, and I need to "create a useful program that performs a
service of interest to anyone other than exsively the student." So I would
like to create something to the openbsd project.

I would like to know in which areas need some work?  I have partial time to
work on it and only this half year to do it.  Some of the old google summer
of code is still need?  There are some need to a new daemon, or replace an
old one, aligned with the openbsd style ( configuration files, privsep,
plegde)?

Thanks for any help,

Mosconi


Re: Firefox, malloc(3) and threads

2016-01-25 Thread Daniel Bolgheroni
On Sat, Jan 23, 2016 at 03:53:32PM +0100, Martin Natano wrote:
> Yes! This absolutely makes Youtube videos watchable for me (on a
> Thinkpad T520). There still is occassional stuttering, but _far_ less
> disruptive than before. Another usecase where I see improvements is
> reloading a resource-heavy web page while switching tabs. Before
> applying the patch, this caused the browser to hang for several seconds.
> Now it doesn't.

The same here on a ThinkPad T420.

dmesg:
OpenBSD 5.9-beta (GENERIC.MP) #0: Mon Jan 25 19:14:50 BRST 2016
dbolgher...@iron.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8451125248 (8059MB)
avail mem = 8190803968 (7811MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xdae9c000 (65 entries)
bios0: vendor LENOVO version "83ET70WW (1.40 )" date 06/12/2012
bios0: LENOVO 4180DL4
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SLIC SSDT SSDT SSDT HPET APIC MCFG ECDT ASF! TCPA SSDT 
SSDT DMAR UEFI UEFI UEFI
acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP4(S4) EHC1(S3) EHC2(S3) 
HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2492.32 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2491.91 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2491.91 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz, 2491.92 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf800, bus 0-63
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 2 (EXP1)
acpiprt3 at acpi0: bus 3 (EXP2)
acpiprt4 at acpi0: bus 5 (EXP4)
acpiprt5 at acpi0: bus 13 (EXP5)
acpicpu0 at acpi0: C3(350@104 io@0x415), C1(1000@1 halt), PSS
acpicpu1 at acpi0: C3(350@104 io@0x415), C1(1000@1 halt), PSS
acpicpu2 at acpi0: C3(350@104 io@0x415), C1(1000@1 halt), PSS
acpicpu3 at acpi0: C3(350@104 io@0x415), C1(1000@1 halt), PSS
acpipwrres0 at acpi0: PUBS, resource for EHC1, EHC2
acpitz0 at acpi0: critical temperature is 98 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model "42T4710" serial  1694 type LION oem "SANYO"
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
cpu0: Enhanced SpeedStep 2492 MHz: speeds: 2501, 2500, 2200, 2000, 1800, 1600, 
1400, 1200, 1000, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 2G Host" rev 0x09
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 3000" rev 0x09
drm0 at inteldrm0
inteldrm0: msi
inteldrm0: 1600x900
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
"Intel 6 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured
puc0 at pci0 dev 22 function 3 "Intel 6 Series KT" rev 0x04: ports: 1 com
com4 at puc0 port 0 apic 2 int 19: ns16550a, 16 byte fifo
com4: probed fifo depth: 0 bytes
em0 at pci0 dev 25 function 0 "Intel 82579LM" rev 0x04: msi, address 
00:21:cc:ba:e3:5d
ehci0 at pci0 dev 26 function 0 "Intel 6 Series USB" rev 0x04: apic 2 int 16
usb0 at ehci0: USB revision 2.0

Re: Willing to help

2016-01-25 Thread Ingo Schwarze
Hi,

Rodrigo Mosconi wrote on Mon, Jan 25, 2016 at 06:54:32PM -0200:

> I would like to receive some help/mentoring.

Please don't reply on tech@, this is off-topic here.
I replied on misc@.

Yours,
  Ingo



Re: Firefox, malloc(3) and threads

2016-01-25 Thread Matthew Via
I've had the patch applied for two days now and have not seen any ill
efects.  This is a Thinkpad T410 running snapshots.

Before, youtube was unwatchable.  Sound would continue normally while
video would freeze for long stretches, often over 10 seconds.  Its not
perfect now, but its very nearly so when not fullscreen.

It does seem that cpu usage of firefox is also significantly reduced,
and is generally snappier.

Thank you!
-via

On 22:46 Fri 22 Jan , Mark Kettenis wrote:
> Firefox makes a lot of concurrent malloc(3) calls.  The locking to
> make malloc(3) thread-safe is a bit...suboptimal.  This diff makes
> things better by using a mutex instead of spinlock.  If you're running
> Firefox you want to try it; it makes video watchable on some machines.
> If you're not running Firefox you want to try it; to make sure it
> doesn't break things.
> 
> Enjoy,
> 
> Mark


pgpADkOhkH3M0.pgp
Description: PGP signature


poll gpio ihidev interrupts

2016-01-25 Thread Jonathan Gray
acpi described hid devices can have interrupts signalled by gpio.
As there is currently no support for that here is an alternative to poll
the devices at a fixed interval.  This makes the keyboard/trackpad on
the ideapad 100s mostly useable, clicking and dragging windows in X
seems a bit off.  I'm mostly interested in not having to use a usb
hub and keyboard for now.

Index: acpi/dwiic.c
===
RCS file: /cvs/src/sys/dev/acpi/dwiic.c,v
retrieving revision 1.9
diff -u -p -r1.9 dwiic.c
--- acpi/dwiic.c22 Jan 2016 22:57:23 -  1.9
+++ acpi/dwiic.c22 Jan 2016 23:01:49 -
@@ -563,12 +563,6 @@ dwiic_acpi_foundhid(struct aml_node *nod
aml_parse_resource(, dwiic_acpi_parse_crs, );
aml_freevalue();
 
-   if (crs.irq_int <= 0) {
-   printf("%s: couldn't find irq for %s\n", sc->sc_dev.dv_xname,
-   aml_nodename(node->parent));
-   return 0;
-   }
-
ia.ia_int = crs.irq_int;
ia.ia_int_flags = crs.irq_flags;
ia.ia_addr = crs.i2c_addr;
Index: i2c/ihidev.c
===
RCS file: /cvs/src/sys/dev/i2c/ihidev.c,v
retrieving revision 1.8
diff -u -p -r1.8 ihidev.c
--- i2c/ihidev.c20 Jan 2016 01:19:28 -  1.8
+++ i2c/ihidev.c23 Jan 2016 00:00:44 -
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -60,12 +61,15 @@ enum {
 static int I2C_HID_POWER_ON= 0x0;
 static int I2C_HID_POWER_OFF   = 0x1;
 
+#define IHIDEV_POLL_MS 20
+
 intihidev_match(struct device *, void *, void *);
 void   ihidev_attach(struct device *, struct device *, void *);
 intihidev_detach(struct device *, int);
 
 intihidev_hid_command(struct ihidev_softc *, int, void *);
 intihidev_intr(void *);
+void   ihidev_poll(void *);
 intihidev_reset(struct ihidev_softc *);
 intihidev_hid_desc_parse(struct ihidev_softc *);
 
@@ -164,6 +168,9 @@ ihidev_attach(struct device *parent, str
printf(", failed establishing intr\n");
return;
}
+   } else {
+   timeout_set(>sc_poll, ihidev_poll, sc);
+   timeout_add_msec(>sc_poll, IHIDEV_POLL_MS);
}
 
iha.iaa = ia;
@@ -209,6 +216,8 @@ ihidev_detach(struct device *self, int f
if (sc->sc_ih != NULL) {
intr_disestablish(sc->sc_ih);
sc->sc_ih = NULL;
+   } else {
+   timeout_del(>sc_poll);
}
 
if (sc->sc_ibuf != NULL) {
@@ -629,6 +638,16 @@ ihidev_intr(void *arg)
scd->sc_intr(scd, p, psize);
 
return (1);
+}
+
+void
+ihidev_poll(void *arg)
+{
+   struct ihidev_softc *sc = arg;
+   int s = spltty();
+   ihidev_intr(sc);
+   timeout_add_msec(>sc_poll, IHIDEV_POLL_MS);
+   splx(s);
 }
 
 int
Index: i2c/ihidev.h
===
RCS file: /cvs/src/sys/dev/i2c/ihidev.h,v
retrieving revision 1.3
diff -u -p -r1.3 ihidev.h
--- i2c/ihidev.h20 Jan 2016 01:19:28 -  1.3
+++ i2c/ihidev.h22 Jan 2016 14:01:08 -
@@ -87,6 +87,8 @@ struct ihidev_softc {
u_char  *sc_ibuf;
 
int sc_refcnt;
+
+   struct timeout  sc_poll;
 };
 
 struct ihidev {
Index: i2c/ims.c
===
RCS file: /cvs/src/sys/dev/i2c/ims.c,v
retrieving revision 1.1
diff -u -p -r1.1 ims.c
--- i2c/ims.c   12 Jan 2016 01:11:15 -  1.1
+++ i2c/ims.c   22 Jan 2016 14:09:05 -
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
Index: i2c/imt.c
===
RCS file: /cvs/src/sys/dev/i2c/imt.c,v
retrieving revision 1.1
diff -u -p -r1.1 imt.c
--- i2c/imt.c   20 Jan 2016 01:26:00 -  1.1
+++ i2c/imt.c   22 Jan 2016 14:08:50 -
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 



Re: Firefox, malloc(3) and threads

2016-01-25 Thread Landry Breuil
On Mon, Jan 25, 2016 at 08:48:21AM +0100, Mark Kettenis wrote:
> > From: "Peter N. M. Hansteen" 
> > Date: Sun, 24 Jan 2016 23:10:41 +0100
> > 
> > On 01/22/16 22:46, Mark Kettenis wrote:
> > > Firefox makes a lot of concurrent malloc(3) calls.  The locking to
> > > make malloc(3) thread-safe is a bit...suboptimal.  This diff makes
> > > things better by using a mutex instead of spinlock.  If you're running
> > > Firefox you want to try it; it makes video watchable on some machines.
> > > If you're not running Firefox you want to try it; to make sure it
> > > doesn't break things.
> > 
> > Running this since early Saturday, Firefox is definitely more responsive
> > than earlier.
> > 
> > I haven't tried running other resource hogs such as LibreOffice with
> > several large documents, but I guess I could try that too if it's a
> > relevant scenario.
> 
> Please do!

Albeit small, x11/xfce4/thunar makes a heavy use of threads (in general,
and even more when talking to gvfs mounts). It feels now 200% snappier.

Landry



Re: Firefox, malloc(3) and threads

2016-01-25 Thread David Coppa
On Sun, Jan 24, 2016 at 7:47 PM, Adam Wolk  wrote:
> On Fri, 22 Jan 2016 22:46:39 +0100 (CET)
> Mark Kettenis  wrote:
>
>> Firefox makes a lot of concurrent malloc(3) calls.  The locking to
>> make malloc(3) thread-safe is a bit...suboptimal.  This diff makes
>> things better by using a mutex instead of spinlock.  If you're running
>> Firefox you want to try it; it makes video watchable on some machines.
>> If you're not running Firefox you want to try it; to make sure it
>> doesn't break things.
>>
>> Enjoy,
>>
>> Mark
>>  '
>
> Applied to a Jan 15h snapshot sources. Youtube is not fully 'watchable'
> on firefox but feels significantly better. I can also now watch full
> screen youtube videos on chromium 1920x1080 with no stutter (lenovo
> g50-70).
>
> Generally gnome 3 feels a bit snappier especially on first load,
> bringing up the menu searching for 'terminal' leads to a faster
> rendering of the results. This might be just 'imagined' by me.
>
> On a more measurable front. I ran the octane benchmark against firefox
> post and before the patch. It resulted in a slight improvement from
> 12486 to 12826 score [1].

Besides performance related issues, the problem we saw in the past was
firefox using a huge amount of CPU resources with no apparent
reasons...
So please also try to test if you still see this erratic behavior with
Mark's patch applied.

ciao,
David



Re: Xen virtual network (Netfront) driver

2016-01-25 Thread Mike Belopuhov
On 25 January 2016 at 01:38, Jonathon Sisson  wrote:
> tech@,
>
> I've uploaded a few of the dmesgs gathered to dmesgd.nycbug.org:
>
> http://dmesgd.nycbug.org/index.cgi?action=dmesgd=index=Jonathon
>
> Currently I have m4.10xlarge, c4.8xlarge, m3.medium, and t2.nano
> uploaded for perusal.
>

Thanks!

> I noticed some new output in the m4.10xlarge console output here:
>
> starting network
> DHCPDISCOVER on xnf0 - interval 3
> DHCPDISCOVER on xnf0 - interval 5
> xnf0: tx prod 2 cons 2,0 evt 3,1
> DHCPDISCOVER on xnf0 - interval 8
> xnf0: tx prod 3 cons 3,0 evt 4,1
> DHCPDISCOVER on xnf0 - interval 10
> xnf0: tx prod 4 cons 4,0 evt 5,1
> DHCPDISCOVER on xnf0 - interval 15
> xnf0: tx prod 5 cons 5,0 evt 6,1
> DHCPDISCOVER on xnf0 - interval 20
> xnf0: tx prod 6 cons 6,0 evt 7,1
> No acceptable DHCPOFFERS received.
> No working leases in persistent database - sleeping.
>
> Not certain if this is debug output put there intentionally or

Yes.

> if this is some error condition?

It is.  Transmission is stuck and these are watchdog timeouts.
Did it get a lease on c4.8xlarge?  So far it looks like it happens
on m4.10xlarge instance only.  No idea why.

> At any rate, there it is =)
>
> -Jonathon



Loops depending on undefined behavior

2016-01-25 Thread Michael McConville
I've discussed the below with otto@, who thought it was sound but wanted
confirmation before I commit.

While debugging rarpd(8) for unrelated reasons, I noticed a loop of the
following form:

> for (i = 1; i; i <<= 1)

where i is an int.

This relies on shifting into and then out of the sign bit, both of which
are undefined operations. The loop contains no breaks or returns, so
they are always executed.

It was copied around a few times, so there are a few nearly identical
instances included in the below diff.

These instances use i for:

 o boolean tests
 o comparison with small positive constants (RTA_*)
 o  with an int

The third case seems questionable. However, (IIUC) integer conversion
rules dictate that the int is implicitly cast to an unsigned int[1] and
that two's complement arithmetic is preserved in this cast.[2]

C integer type rules are such a joy to work with...

Am I interpreting this correctly?

[1] Usual Arithmetic Conversions #3 in:
https://www.securecoding.cert.org/confluence/x/QgE

[2] C99/C11 6.3.1.3
http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1570.pdf


Index: sbin/dhclient/dhclient.c
===
RCS file: /cvs/src/sbin/dhclient/dhclient.c,v
retrieving revision 1.370
diff -u -p -r1.370 dhclient.c
--- sbin/dhclient/dhclient.c12 Dec 2015 14:48:17 -  1.370
+++ sbin/dhclient/dhclient.c21 Jan 2016 02:16:17 -
@@ -160,7 +160,7 @@ int
 findproto(char *cp, int n)
 {
struct sockaddr *sa;
-   int i;
+   unsigned int i;
 
if (n == 0)
return -1;
Index: usr.sbin/arp/arp.c
===
RCS file: /cvs/src/usr.sbin/arp/arp.c,v
retrieving revision 1.70
diff -u -p -r1.70 arp.c
--- usr.sbin/arp/arp.c  8 Dec 2015 14:20:24 -   1.70
+++ usr.sbin/arp/arp.c  21 Jan 2016 02:16:17 -
@@ -695,7 +695,7 @@ rtget(struct sockaddr_inarp **sinp, stru
struct sockaddr_dl *sdl = NULL;
struct sockaddr *sa;
char *cp;
-   int i;
+   unsigned int i;
 
if (rtmsg(RTM_GET) < 0)
return (1);
Index: usr.sbin/ndp/ndp.c
===
RCS file: /cvs/src/usr.sbin/ndp/ndp.c,v
retrieving revision 1.68
diff -u -p -r1.68 ndp.c
--- usr.sbin/ndp/ndp.c  12 Jan 2016 09:47:13 -  1.68
+++ usr.sbin/ndp/ndp.c  21 Jan 2016 02:16:17 -
@@ -879,7 +879,7 @@ rtget(struct sockaddr_in6 **sinp, struct
struct sockaddr_dl *sdl = NULL;
struct sockaddr *sa;
char *cp;
-   int i;
+   unsigned int i;
 
if (rtmsg(RTM_GET) < 0)
return (1);
Index: usr.sbin/rarpd/arptab.c
===
RCS file: /cvs/src/usr.sbin/rarpd/arptab.c,v
retrieving revision 1.25
diff -u -p -r1.25 arptab.c
--- usr.sbin/rarpd/arptab.c 19 Nov 2015 19:31:20 -  1.25
+++ usr.sbin/rarpd/arptab.c 21 Jan 2016 02:16:17 -
@@ -240,7 +240,7 @@ rtget(struct sockaddr_inarp **sinp, stru
struct sockaddr_dl *sdl = NULL;
struct sockaddr *sa;
char *cp;
-   int i;
+   unsigned int i;
 
if (rtmsg(RTM_GET) < 0)
return (1);