Re: [patch] Enable support for Subpixel Antialiasing / LCD Filter

2017-01-15 Thread lists
Sun, 15 Jan 2017 14:04:01 + Stuart Henderson 
> > > There has been a privious discussion on this list on this topic [5]
> > > where tedu@ mentions, that this issue is irrelevant once you get a
> > > decent display with a higher DPI (or use bitmap fonts), which is of
> > > course true [6].  But at least for me, at work we still have (and buy)
> > > new monitors that have a DPI of 96 (e.g. Dell U2412M).  On these
> > > displays, bitmap fonts are too tiny for me and don't scale well, so
> > > subpixel rendering with enabled lcd filter really makes a difference.  
> 
> btw it is "li...@wrant.com" not tedu writing that. good for him/her
> to have a 27" high DPI display but I agree with you here.


Hi Stuart, Nils,

Synopsis:  No objections, please proceed, give sharpest contour fonts.
   My displays are same DPI as yours, I need single dot fonts.

My 27" is a Dell U2711, with about 107 x 108 DPI, which is technically
quite the same range as my 10" mobile Asus EEE-PC 1005AH and the older
17" LG L1750SQ monitors quite similar to the very one above mentioned.
This is to say we are in the same set of technical provisioning tools.

These may and will change in the next decades to come, but unless you,
or somebody else, please point to me an affordable ~400 DPI monitor at
a desktop size of about 27" (or similar), don't name it high DPI, yet.

I use the default bitmap font for Xterm, and everywhere else possible,
with slight variation where I can not figure how to do so, to Terminus
and DejaVu, for some less than correct functionally graphics programs.

I would prefer the programs were able to use the bitmap fonts as well.
Or if not bitmap, but vector fonts, to use single pixel font contours.
I would prefer to not have to go through many configurations to do so.

The bitmap fonts are indeed small and pixel perfect, this is precisely
the next best reason why I'm stuck with them, the primary though being
the Unicode support that comes by default with them, as part of M.Kuhn
coordinated efforts for character representation in X, and other work.

These pixel perfect bitmap fonts are quite sharp, and precise at ~0.5m
viewing distance and allow me to stick a lot of information on the 27"
primary screen, which is the becoming norm in desktop monitors screens
resulting in cost savings, eye sight preservation, and painless usage.
It is a matter of personal preferences, and also of physique & costs..

I have no objections to implementing the proposed or any other similar
improvements, to any aspect of the system, here sub-pixel and/or anti-
aliasing techniques.  Please, do not change, the default pixel perfect
or any sharp rendering capabilities, as this will cause many more folk
to lose their eye sight sharpness at close distance prematurely early.

I would insist to keep the sharp single pixel fonts available and pre-
selected as default up to resolutions of 2-4x the current widest range
of representations of about 100 DPI, for the classic desktop monitors.

Yet, I have absolutely NONE objection for the ability to go from these
default pixel perfect fonts, to the smudged uneven contour fonts where
people choose so to make better use of their diminishing eyesight or..
rather become equipped with a much higher resolution displays than the
current about 100 DPI.  Precisely the fact we're now at this stage, of
about 100 DPI, including me makes me want to use the single pixel wide
contour fonts, no matter bitmap or vector ones.  Which is the topic of
my post, to clarify current low DPI (and not high) including mine, are
forcing me to use the thinnest possible font,  and I want to continue.

Please keep me updated on this and I've no objections to improvements.
I would be glad to read more insights and suggestions on these topics.

Thank you all for the wonderful work and contributions which allow me,
and many other folk, to use sane defaults, with minimum investments in
hardware and time to learn, and stay current with our OpenBSD systems.

P.S.  What I think worth noting to X developers though is attention to
better support for two or more screens with different DPI as displays.
These must keep their independent of each other DPI and not get mixed.
Currently vector fonts change their physical size based on mixing DPI. 

Kind regards,
Anton



Re: unmount mountpoints

2017-01-15 Thread Alexander Bluhm
On Tue, Jan 10, 2017 at 09:46:30PM +0100, Alexander Bluhm wrote:
> When I force to unmount a filesystem where another mountpoint is
> located, an unlinked mountpoint will remain.  I have not found a
> way to restore the kernel to a sane state.
> 
> ok?

anyone?

bluhm

Index: kern/vfs_syscalls.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.268
diff -u -p -r1.268 vfs_syscalls.c
--- kern/vfs_syscalls.c 15 Jan 2017 23:18:05 -  1.268
+++ kern/vfs_syscalls.c 16 Jan 2017 00:01:54 -
@@ -88,6 +88,8 @@ int domkdirat(struct proc *, int, const 
 int doutimensat(struct proc *, int, const char *, struct timespec [2], int);
 int dovutimens(struct proc *, struct vnode *, struct timespec [2]);
 int dofutimens(struct proc *, int, struct timespec [2]);
+int dounmount_leaf(struct mount *, int, struct proc *);
+int unmount_vnode(struct vnode *, void *);
 
 /*
  * Virtual File System System Calls
@@ -368,11 +370,67 @@ sys_unmount(struct proc *p, void *v, reg
return (dounmount(mp, SCARG(uap, flags) & MNT_FORCE, p));
 }
 
+struct unmount_args {
+   TAILQ_HEAD(ua_mphead, mount)ua_mplist;
+   int ua_flags;
+};
+
+int
+unmount_vnode(struct vnode *vp, void *args)
+{
+   struct unmount_args *ua = args;
+   struct mount *mp;
+
+   if (vp->v_type != VDIR)
+   return (0);
+   if ((mp = vp->v_mountedhere) == NULL)
+   return (0);
+   if (!(ua->ua_flags & MNT_FORCE))
+   return (EBUSY);
+   if (vfs_busy(mp, VB_WRITE|VB_WAIT))
+   return ((ua->ua_flags & MNT_DOOMED) ? 0 : EBUSY);
+
+   TAILQ_INSERT_HEAD(>ua_mplist, mp, mnt_dounmount);
+
+   return (0);
+}
+
 /*
  * Do the actual file system unmount.
  */
 int
 dounmount(struct mount *mp, int flags, struct proc *p)
+{
+   struct unmount_args ua;
+   int error;
+
+   TAILQ_INIT(_mplist);
+   TAILQ_INSERT_HEAD(_mplist, mp, mnt_dounmount);
+   ua.ua_flags = flags;
+   TAILQ_FOREACH_REVERSE(mp, _mplist, ua_mphead, mnt_dounmount) {
+   error = vfs_mount_foreach_vnode(mp, unmount_vnode, );
+   if (error)
+   goto err;
+   }
+
+   while ((mp = TAILQ_FIRST(_mplist))) {
+   TAILQ_REMOVE(_mplist, mp, mnt_dounmount);
+   error = dounmount_leaf(mp, flags, p);
+   if (error)
+   goto err;
+   }
+   return (0);
+
+ err:
+   while ((mp = TAILQ_FIRST(_mplist))) {
+   TAILQ_REMOVE(_mplist, mp, mnt_dounmount);
+   vfs_unbusy(mp);
+   }
+   return (error);
+}
+
+int
+dounmount_leaf(struct mount *mp, int flags, struct proc *p)
 {
struct vnode *coveredvp;
int error;
Index: sys/mount.h
===
RCS file: /data/mirror/openbsd/cvs/src/sys/sys/mount.h,v
retrieving revision 1.128
diff -u -p -r1.128 mount.h
--- sys/mount.h 10 Jan 2017 19:48:32 -  1.128
+++ sys/mount.h 16 Jan 2017 00:01:54 -
@@ -347,6 +347,7 @@ LIST_HEAD(vnodelst, vnode);
 
 struct mount {
TAILQ_ENTRY(mount) mnt_list;/* mount list */
+   TAILQ_ENTRY(mount) mnt_dounmount;   /* unmount work queue */
const struct vfsops *mnt_op;/* operations on fs */
struct vfsconf  *mnt_vfc;   /* configuration info */
struct vnode*mnt_vnodecovered;  /* vnode we mounted on */



Re: 11n support for athn(4)

2017-01-15 Thread Stefan Sperling
On Sun, Jan 15, 2017 at 10:31:29PM +, Olivier Cherrier wrote:
> On Mon, Jan 09, 2017 at 01:54:55PM +0100, s...@stsp.name wrote:
> > Date: Mon, 9 Jan 2017 13:54:55 +0100
> > From: Stefan Sperling 
> > To: tech@openbsd.org
> > Subject: 11n support for athn(4)
> 
>   Hi Stefan,
> 
> Thank you for this extended work !
> 
> I just tested today the latest snapshot on my Alix GW.
> After some time, I got this uvm_fault :

> ieee80211_input_ba(d13a2030,d5778a00,d129,0,f3636eb0) at 
> ieee80211_input_ba
> +0x1b9
> ieee80211_input(d13a2030,d5778a00,d129,f3636eb0,1) at 
> ieee80211_input+0x5b0
> 
> ar5008_rx_intr(d13a2000,c0,d0bdb7cc,d57672d0,f3636f08) at ar5008_rx_intr+0x2f2
> ar5008_intr(d13a2000,d12b85c0) at ar5008_intr+0x235
> Xintr_legacy9() at Xintr_legacy9+0x85

Please try this diff:

Index: ieee80211_node.c
===
RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
retrieving revision 1.111
diff -u -p -r1.111 ieee80211_node.c
--- ieee80211_node.c9 Jan 2017 20:18:59 -   1.111
+++ ieee80211_node.c15 Jan 2017 11:26:42 -
@@ -1638,6 +1638,7 @@ ieee80211_node_leave_ht(struct ieee80211
int i;
 
/* free all Block Ack records */
+   ieee80211_ba_del(ni);
for (tid = 0; tid < IEEE80211_NUM_TID; tid++) {
ba = >ni_rx_ba[tid];
if (ba->ba_buf != NULL) {



Re: 11n support for athn(4)

2017-01-15 Thread Olivier Cherrier
On Mon, Jan 09, 2017 at 01:54:55PM +0100, s...@stsp.name wrote:
> Date: Mon, 9 Jan 2017 13:54:55 +0100
> From: Stefan Sperling 
> To: tech@openbsd.org
> Subject: 11n support for athn(4)

Hi Stefan,

Thank you for this extended work !

I just tested today the latest snapshot on my Alix GW.
After some time, I got this uvm_fault :

Script started on Mon Dec 26 11:51:10 2016
11:52:05 oclocal@odile $ 
11:52:05 oclocal@odile $ doas cu -l /dev/cuaU0 -s 38400 
Connected to /dev/cuaU0 (speed 38400)

ddb> show panic
the kernel did not panic
ddb> ps
   PID   PPID   PGRPUID  S   FLAGS  WAIT  COMMAND
 19968  32902  32902  0  30x100081  netio tcpdump
 32902   5116  32902 76  30x100093  bpf   tcpdump
  5116  18692   5116  0  30x10008b  pause ksh
 49320  80074  49320  0  30x100083  kqreadtmux
 68772  54609  54609  0  30x100081  netio tcpdump
 54609  10608  54609 76  30x100093  bpf   tcpdump
 10608  18692  10608  0  30x10008b  pause ksh
 18692  1  18692  0  30x100080  kqreadtmux
 61250  80815  61250  0  30x100083  kqreadtmux
 80815   5768  80815  0  30x10008b  pause ksh
  5768  55189   5768   1000  30x10008b  pause ksh
 55189  26739  26739   1000  30x90  selectsshd
 26739  17529  26739  0  30x92  poll  sshd
 80074  22879  80074  0  30x10008b  pause ksh
 73882   9948  73882   1000  30x100083  ttyin ksh
  9948  84034  84034   1000  30x90  selectsshd
 84034  17529  84034  0  30x92  poll  sshd
 22879  53776  22879   1000  30x10008b  pause ksh
 53776  94675  94675   1000  30x90  selectsshd
 94675  17529  94675  0  30x92  poll  sshd
 32955  1  32955  0  30x100083  ttyin getty
--db_more-- 8336  84223  84223 74  30x100090  bpf   
pflogd
 84223  1  84223  0  30x80  netio pflogd
 61055  66055  66055 74  30x100090  bpf   pflogd
 66055  1  66055  0  30x80  netio pflogd
 50995  1  50995  0  30x100098  poll  cron
 45087  1  45087110  30x100090  poll  sndiod
  7545  1   7545 99  30x100090  poll  sndiod
 66227  1  66227109  30x90  kqreadftp-proxy
 21402  82173  82173 95  30x100092  kqreadsmtpd
 11513  82173  82173103  30x100092  kqreadsmtpd
 54208  82173  82173 95  30x100092  kqreadsmtpd
   965  82173  82173 95  30x100092  kqreadsmtpd
   679  82173  82173 95  30x100092  kqreadsmtpd
 80539  82173  82173 95  30x100092  kqreadsmtpd
 82173  1  82173  0  30x100080  kqreadsmtpd
 74992  1  74992 77  30x100090  poll  dhcpd
 17529  1  17529  0  30x80  selectsshd
 22010  1  22010  0  30x100080  poll  ntpd
 31230  58512  31230 83  30x100092  poll  ntpd
 58512  1  58512 83  30x100092  poll  ntpd
 89749  1  89749 53  30x90  kqreadunbound
 38285   2753  92830 97  30x100090  kqreadnsd
  2753  92830  92830 97  30x100090  poll  nsd
--db_more--92830  1  92830 97  30x100090  kqread
nsd
  7026  26000  26000 73  20x100090syslogd
 26000  1  26000  0  30x100082  netio syslogd
 74378  1  74378  0  30x80  mfsidlmount_mfs
 16009  0  0  0  3 0x14200  pgzerozerothread
 57007  0  0  0  3 0x14200  aiodoned  aiodoned
 67486  0  0  0  3 0x14200  syncerupdate
 65321  0  0  0  3 0x14200  cleaner   cleaner
 23106  0  0  0  3 0x14200  reaperreaper
 51825  0  0  0  3 0x14200  pgdaemon  pagedaemon
 66180  0  0  0  3 0x14200  bored crynlk
 23157  0  0  0  3 0x14200  bored crypto
 83928  0  0  0  3 0x14200  pftm  pfpurge
 63889  0  0  0  3 0x14200  usbtskusbtask
 16061  0  0  0  3 0x14200  usbatsk   usbatsk
 81215  0  0  0  3 0x14200  bored sensors
 56615  0  0  0  3 0x14200  bored softnet
 31641  0  0  0  3 0x14200  bored systqmp
 59547  0  0  0  3 0x14200  bored systq
 73733  0  0  0  3  0x40014200  bored softclock
*23402  0  0  0  7  0x40014200idle0
  3265  0  0  0  3 0x14200  kmalloc   kmthread
 1  0  1  0  30x82  wait  

Re: 11n support for athn(4)

2017-01-15 Thread Tom Murphy
Hi Stefan,

  Thanks very much for the 11n support in athn(4)! Here's mine:

athn0 at pci5 dev 0 function 0 "Atheros AR9281" rev 0x01: apic 2 int 16
athn0: AR9280 rev 2 (2T2R), ROM rev 22, address 04:f0:21:24:c8:4f

  I did some netperf tests between OpenBSD athn(4) in hostap mode (11n)
and a Linux wifi client (using an iwn(4) type chipset) and couldn't
get up to 4 MBps:

# netperf -4 -H 10.13.0.2 -t TCP_STREAM -C -c -l 60
MIGRATED TCP STREAM TEST from (null) (0.0.0.0) port 0 AF_INET to (null) () port 
0 AF_INET : demo
Recv   SendSend  Utilization   Service Demand
Socket Socket  Message  Elapsed  Send Recv SendRecv
Size   SizeSize Time Throughput  localremote   local   remote
bytes  bytes   bytessecs.10^6bits/s  % C  % ?  us/KB   us/KB

 87380  16384  1638460.18 3.92   7.94 3.61 331.990  
-151.019 
# netperf -4 -H 10.13.0.2 -t TCP_STREAM -C -c -l 60 
MIGRATED TCP STREAM TEST from (null) (0.0.0.0) port 0 AF_INET to (null) () port 
0 AF_INET : demo
Recv   SendSend  Utilization   Service Demand
Socket Socket  Message  Elapsed  Send Recv SendRecv
Size   SizeSize Time Throughput  localremote   local   remote
bytes  bytes   bytessecs.10^6bits/s  % C  % ?  us/KB   us/KB

 87380  16384  1638461.11 3.95   7.41 2.11 307.442  -87.524

Linux iwconfig client shows Bit rate of 1 MB/s which doesn't look right.

Any ideas?

Thanks,
Tom



Re: Remove uvm hint address selector

2017-01-15 Thread Mark Kettenis
> Date: Sun, 15 Jan 2017 15:06:50 +0100
> From: Stefan Kempf 
> 
> When uvm pivots are enabled, allocations
> with an address hint provided by the user program are
> handled by the uaddr_hint selector.
> 
> I'd like to remove the uaddr_hint selector. The uaddr_rnd selector
> already deals with hinted allocations correctly, so why not use
> it for hinted allocations in the pivot selector?
> 
> This diff is a part of making pivots work.
> Getting rid of the hint selectors makes the code simpler.
> I'd to commit this part first, to make the actual pivot
> diffs smaller.
> 
> ok?

No objection from me.

> Some more details:
> 
> If you have multiple selectors per address space that manage
> overlapping address ranges, some selectors have priority
> over others. E.g. only the brk selector is allowed to make
> allocations within the brk area. The rnd selector
> gets all these checks right, but the hint selector does
> not, which causes panics when you use pivots and try to
> do a hinted allocation within the brk area.
> 
> So better use the code which is known to work for hinted
> allocations. Once pivots are enabled, maybe the parts of the
> rnd allocator that deal with hinted allocations can be factored
> out into a common function.
> 
> Index: uvm/uvm_addr.c
> ===
> RCS file: /cvs/src/sys/uvm/uvm_addr.c,v
> retrieving revision 1.22
> diff -u -p -r1.22 uvm_addr.c
> --- uvm/uvm_addr.c16 Sep 2016 02:50:54 -  1.22
> +++ uvm/uvm_addr.c14 Jan 2017 05:53:17 -
> @@ -46,17 +46,10 @@
>  
>  /* Pool with uvm_addr_state structures. */
>  struct pool uaddr_pool;
> -struct pool uaddr_hint_pool;
>  struct pool uaddr_bestfit_pool;
>  struct pool uaddr_pivot_pool;
>  struct pool uaddr_rnd_pool;
>  
> -/* uvm_addr state for hint based selector. */
> -struct uaddr_hint_state {
> - struct uvm_addr_stateuaddr;
> - vsize_t  max_dist;
> -};
> -
>  /* uvm_addr state for bestfit selector. */
>  struct uaddr_bestfit_state {
>   struct uvm_addr_stateubf_uaddr;
> @@ -118,7 +111,6 @@ void   uaddr_kremove(struct vm_map *,
>  void  uaddr_kbootstrapdestroy(struct uvm_addr_state *);
>  
>  void  uaddr_destroy(struct uvm_addr_state *);
> -void  uaddr_hint_destroy(struct uvm_addr_state *);
>  void  uaddr_kbootstrap_destroy(struct uvm_addr_state *);
>  void  uaddr_rnd_destroy(struct uvm_addr_state *);
>  void  uaddr_bestfit_destroy(struct uvm_addr_state *);
> @@ -138,10 +130,6 @@ int   uaddr_rnd_select(struct vm_map 
> *,
>   struct uvm_addr_state *, struct vm_map_entry **,
>   vaddr_t *, vsize_t, vaddr_t, vaddr_t, vm_prot_t,
>   vaddr_t);
> -int   uaddr_hint_select(struct vm_map *,
> - struct uvm_addr_state*, struct vm_map_entry **,
> - vaddr_t *, vsize_t, vaddr_t, vaddr_t, vm_prot_t,
> - vaddr_t);
>  int   uaddr_bestfit_select(struct vm_map *,
>   struct uvm_addr_state*, struct vm_map_entry **,
>   vaddr_t *, vsize_t, vaddr_t, vaddr_t, vm_prot_t,
> @@ -290,8 +278,6 @@ uvm_addr_init(void)
>  {
>   pool_init(_pool, sizeof(struct uvm_addr_state), 0,
>   IPL_VM, PR_WAITOK, "uaddr", NULL);
> - pool_init(_hint_pool, sizeof(struct uaddr_hint_state), 0,
> - IPL_VM, PR_WAITOK, "uaddrhint", NULL);
>   pool_init(_bestfit_pool, sizeof(struct uaddr_bestfit_state), 0,
>   IPL_VM, PR_WAITOK, "uaddrbest", NULL);
>   pool_init(_pivot_pool, sizeof(struct uaddr_pivot_state), 0,
> @@ -740,116 +726,6 @@ uaddr_rnd_print(struct uvm_addr_state *u
>  #endif
>  
>  /*
> - * An allocator that selects an address within distance of the hint.
> - *
> - * If no hint is given, the allocator refuses to allocate.
> - */
> -const struct uvm_addr_functions uaddr_hint_functions = {
> - .uaddr_select = _hint_select,
> - .uaddr_destroy = _hint_destroy,
> - .uaddr_name = "uaddr_hint"
> -};
> -
> -/*
> - * Create uaddr_hint state.
> - */
> -struct uvm_addr_state *
> -uaddr_hint_create(vaddr_t minaddr, vaddr_t maxaddr, vsize_t max_dist)
> -{
> - struct uaddr_hint_state *ua_hint;
> -
> - KASSERT(uaddr_hint_pool.pr_size == sizeof(*ua_hint));
> -
> - ua_hint = pool_get(_hint_pool, PR_WAITOK);
> - ua_hint->uaddr.uaddr_minaddr = minaddr;
> - ua_hint->uaddr.uaddr_maxaddr = maxaddr;
> - ua_hint->uaddr.uaddr_functions = _hint_functions;
> - ua_hint->max_dist = max_dist;
> - return _hint->uaddr;
> -}
> -
> -/*
> - * Destroy uaddr_hint state.
> - */
> -void
> -uaddr_hint_destroy(struct uvm_addr_state *uaddr)
> -{
> - pool_put(_hint_pool, uaddr);
> -}
> -
> -/*
> - * Hint selector.
> - *
> - * 

Refactor SIMPLEQ out of sk(4)

2017-01-15 Thread Visa Hankala
sk(4) uses a queue for managing Tx DMA maps. Because the queue would
require synchronization if the driver was unlocked, it might be best
to refactor the code a bit. This patch removes the queue by making
Tx and Rx DMA maps part of struct sk_chain.

OK?

Index: dev/pci/if_sk.c
===
RCS file: src/sys/dev/pci/if_sk.c,v
retrieving revision 1.185
diff -u -p -r1.185 if_sk.c
--- dev/pci/if_sk.c 8 Jan 2017 18:08:14 -   1.185
+++ dev/pci/if_sk.c 15 Jan 2017 13:56:06 -
@@ -97,7 +97,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -569,14 +568,11 @@ sk_init_tx_ring(struct sk_if_softc *sc_i
struct sk_softc *sc = sc_if->sk_softc;
struct sk_chain_data*cd = _if->sk_cdata;
struct sk_ring_data *rd = sc_if->sk_rdata;
-   bus_dmamap_tdmamap;
-   struct sk_txmap_entry   *entry;
int i, nexti;
 
bzero(sc_if->sk_rdata->sk_tx_ring,
sizeof(struct sk_tx_desc) * SK_TX_RING_CNT);
 
-   SIMPLEQ_INIT(_if->sk_txmap_head);
for (i = 0; i < SK_TX_RING_CNT; i++) {
cd->sk_tx_chain[i].sk_desc = >sk_tx_ring[i];
if (i == (SK_TX_RING_CNT - 1))
@@ -584,19 +580,12 @@ sk_init_tx_ring(struct sk_if_softc *sc_i
else
nexti = i + 1;
cd->sk_tx_chain[i].sk_next = >sk_tx_chain[nexti];
-   rd->sk_tx_ring[i].sk_next = htole32(SK_TX_RING_ADDR(sc_if, 
nexti));
+   rd->sk_tx_ring[i].sk_next = htole32(SK_TX_RING_ADDR(sc_if,
+   nexti));
 
if (bus_dmamap_create(sc->sc_dmatag, SK_JLEN, SK_NTXSEG,
-  SK_JLEN, 0, BUS_DMA_NOWAIT, ))
-   return (ENOBUFS);
-
-   entry = malloc(sizeof(*entry), M_DEVBUF, M_NOWAIT);
-   if (!entry) {
-   bus_dmamap_destroy(sc->sc_dmatag, dmamap);
+  SK_JLEN, 0, BUS_DMA_NOWAIT, >sk_tx_chain[i].sk_map))
return (ENOBUFS);
-   }
-   entry->dmamap = dmamap;
-   SIMPLEQ_INSERT_HEAD(_if->sk_txmap_head, entry, link);
}
 
sc_if->sk_cdata.sk_tx_prod = 0;
@@ -627,7 +616,8 @@ sk_newbuf(struct sk_if_softc *sc_if)
m_adj(m, ETHER_ALIGN);
 
prod = sc_if->sk_cdata.sk_rx_prod;
-   dmamap = sc_if->sk_cdata.sk_rx_map[prod];
+   c = _if->sk_cdata.sk_rx_chain[prod];
+   dmamap = c->sk_map;
 
error = bus_dmamap_load_mbuf(sc_if->sk_softc->sc_dmatag, dmamap, m,
BUS_DMA_READ|BUS_DMA_NOWAIT);
@@ -639,7 +629,6 @@ sk_newbuf(struct sk_if_softc *sc_if)
bus_dmamap_sync(sc_if->sk_softc->sc_dmatag, dmamap, 0,
dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
 
-   c = _if->sk_cdata.sk_rx_chain[prod];
c->sk_mbuf = m;
 
r = c->sk_desc;
@@ -979,7 +968,7 @@ sk_attach(struct device *parent, struct 
 
for (i = 0; i < SK_RX_RING_CNT; i++) {
error = bus_dmamap_create(sc->sc_dmatag, SK_JLEN, 1,
-   SK_JLEN, 0, 0, _if->sk_cdata.sk_rx_map[i]);
+   SK_JLEN, 0, 0, _if->sk_cdata.sk_rx_chain[i].sk_map);
if (error != 0) {
printf(": unable to create rx DMA map %d, "
"error = %d\n", i, error);
@@ -1051,10 +1040,11 @@ sk_attach(struct device *parent, struct 
return;
 fail_4:
for (i = 0; i < SK_RX_RING_CNT; i++) {
-   if (sc_if->sk_cdata.sk_rx_map[i] == NULL)
+   if (sc_if->sk_cdata.sk_rx_chain[i].sk_map == NULL)
continue;
 
-   bus_dmamap_destroy(sc->sc_dmatag, sc_if->sk_cdata.sk_rx_map[i]);
+   bus_dmamap_destroy(sc->sc_dmatag,
+   sc_if->sk_cdata.sk_rx_chain[i].sk_map);
}
 fail_3:
bus_dmamem_unmap(sc->sc_dmatag, kva, sizeof(struct sk_ring_data));
@@ -1391,19 +1381,12 @@ sk_encap(struct sk_if_softc *sc_if, stru
struct sk_tx_desc   *f = NULL;
u_int32_t   frag, cur, sk_ctl;
int i;
-   struct sk_txmap_entry   *entry;
bus_dmamap_ttxmap;
 
DPRINTFN(2, ("sk_encap\n"));
 
-   entry = SIMPLEQ_FIRST(_if->sk_txmap_head);
-   if (entry == NULL) {
-   DPRINTFN(2, ("sk_encap: no txmap available\n"));
-   return (ENOBUFS);
-   }
-   txmap = entry->dmamap;
-
cur = frag = *txidx;
+   txmap = sc_if->sk_cdata.sk_tx_chain[*txidx].sk_map;
 
 #ifdef SK_DEBUG
if (skdebug >= 2)
@@ -1446,10 +1429,12 @@ sk_encap(struct sk_if_softc *sc_if, stru
SK_INC(frag, SK_TX_RING_CNT);
}
 
+   sc_if->sk_cdata.sk_tx_chain[*txidx].sk_map =
+   sc_if->sk_cdata.sk_tx_chain[cur].sk_map;
+   sc_if->sk_cdata.sk_tx_chain[cur].sk_map = txmap;
+
sc_if->sk_cdata.sk_tx_chain[cur].sk_mbuf = 

Remove uvm hint address selector

2017-01-15 Thread Stefan Kempf
When uvm pivots are enabled, allocations
with an address hint provided by the user program are
handled by the uaddr_hint selector.

I'd like to remove the uaddr_hint selector. The uaddr_rnd selector
already deals with hinted allocations correctly, so why not use
it for hinted allocations in the pivot selector?

This diff is a part of making pivots work.
Getting rid of the hint selectors makes the code simpler.
I'd to commit this part first, to make the actual pivot
diffs smaller.

ok?

Some more details:

If you have multiple selectors per address space that manage
overlapping address ranges, some selectors have priority
over others. E.g. only the brk selector is allowed to make
allocations within the brk area. The rnd selector
gets all these checks right, but the hint selector does
not, which causes panics when you use pivots and try to
do a hinted allocation within the brk area.

So better use the code which is known to work for hinted
allocations. Once pivots are enabled, maybe the parts of the
rnd allocator that deal with hinted allocations can be factored
out into a common function.

Index: uvm/uvm_addr.c
===
RCS file: /cvs/src/sys/uvm/uvm_addr.c,v
retrieving revision 1.22
diff -u -p -r1.22 uvm_addr.c
--- uvm/uvm_addr.c  16 Sep 2016 02:50:54 -  1.22
+++ uvm/uvm_addr.c  14 Jan 2017 05:53:17 -
@@ -46,17 +46,10 @@
 
 /* Pool with uvm_addr_state structures. */
 struct pool uaddr_pool;
-struct pool uaddr_hint_pool;
 struct pool uaddr_bestfit_pool;
 struct pool uaddr_pivot_pool;
 struct pool uaddr_rnd_pool;
 
-/* uvm_addr state for hint based selector. */
-struct uaddr_hint_state {
-   struct uvm_addr_stateuaddr;
-   vsize_t  max_dist;
-};
-
 /* uvm_addr state for bestfit selector. */
 struct uaddr_bestfit_state {
struct uvm_addr_stateubf_uaddr;
@@ -118,7 +111,6 @@ void uaddr_kremove(struct vm_map *,
 voiduaddr_kbootstrapdestroy(struct uvm_addr_state *);
 
 voiduaddr_destroy(struct uvm_addr_state *);
-voiduaddr_hint_destroy(struct uvm_addr_state *);
 voiduaddr_kbootstrap_destroy(struct uvm_addr_state *);
 voiduaddr_rnd_destroy(struct uvm_addr_state *);
 voiduaddr_bestfit_destroy(struct uvm_addr_state *);
@@ -138,10 +130,6 @@ int uaddr_rnd_select(struct vm_map 
*,
struct uvm_addr_state *, struct vm_map_entry **,
vaddr_t *, vsize_t, vaddr_t, vaddr_t, vm_prot_t,
vaddr_t);
-int uaddr_hint_select(struct vm_map *,
-   struct uvm_addr_state*, struct vm_map_entry **,
-   vaddr_t *, vsize_t, vaddr_t, vaddr_t, vm_prot_t,
-   vaddr_t);
 int uaddr_bestfit_select(struct vm_map *,
struct uvm_addr_state*, struct vm_map_entry **,
vaddr_t *, vsize_t, vaddr_t, vaddr_t, vm_prot_t,
@@ -290,8 +278,6 @@ uvm_addr_init(void)
 {
pool_init(_pool, sizeof(struct uvm_addr_state), 0,
IPL_VM, PR_WAITOK, "uaddr", NULL);
-   pool_init(_hint_pool, sizeof(struct uaddr_hint_state), 0,
-   IPL_VM, PR_WAITOK, "uaddrhint", NULL);
pool_init(_bestfit_pool, sizeof(struct uaddr_bestfit_state), 0,
IPL_VM, PR_WAITOK, "uaddrbest", NULL);
pool_init(_pivot_pool, sizeof(struct uaddr_pivot_state), 0,
@@ -740,116 +726,6 @@ uaddr_rnd_print(struct uvm_addr_state *u
 #endif
 
 /*
- * An allocator that selects an address within distance of the hint.
- *
- * If no hint is given, the allocator refuses to allocate.
- */
-const struct uvm_addr_functions uaddr_hint_functions = {
-   .uaddr_select = _hint_select,
-   .uaddr_destroy = _hint_destroy,
-   .uaddr_name = "uaddr_hint"
-};
-
-/*
- * Create uaddr_hint state.
- */
-struct uvm_addr_state *
-uaddr_hint_create(vaddr_t minaddr, vaddr_t maxaddr, vsize_t max_dist)
-{
-   struct uaddr_hint_state *ua_hint;
-
-   KASSERT(uaddr_hint_pool.pr_size == sizeof(*ua_hint));
-
-   ua_hint = pool_get(_hint_pool, PR_WAITOK);
-   ua_hint->uaddr.uaddr_minaddr = minaddr;
-   ua_hint->uaddr.uaddr_maxaddr = maxaddr;
-   ua_hint->uaddr.uaddr_functions = _hint_functions;
-   ua_hint->max_dist = max_dist;
-   return _hint->uaddr;
-}
-
-/*
- * Destroy uaddr_hint state.
- */
-void
-uaddr_hint_destroy(struct uvm_addr_state *uaddr)
-{
-   pool_put(_hint_pool, uaddr);
-}
-
-/*
- * Hint selector.
- *
- * Attempts to find an address that is within max_dist of the hint.
- */
-int
-uaddr_hint_select(struct vm_map *map, struct uvm_addr_state *uaddr_param,
-struct vm_map_entry **entry_out, vaddr_t *addr_out,
-vsize_t sz, vaddr_t align, vaddr_t offset,
-vm_prot_t prot, 

Re: [patch] Enable support for Subpixel Antialiasing / LCD Filter

2017-01-15 Thread Stuart Henderson
> > Other Linux/BSD systems have this option enabled for a long time now,
> > under them Ubuntu, Debian [2], Freebsd [3], Arch Linux [4] and more.

> > There has been a privious discussion on this list on this topic [5]
> > where tedu@ mentions, that this issue is irrelevant once you get a
> > decent display with a higher DPI (or use bitmap fonts), which is of
> > course true [6].  But at least for me, at work we still have (and buy)
> > new monitors that have a DPI of 96 (e.g. Dell U2412M).  On these
> > displays, bitmap fonts are too tiny for me and don't scale well, so
> > subpixel rendering with enabled lcd filter really makes a difference.

btw it is "li...@wrant.com" not tedu writing that. good for him/her
to have a 27" high DPI display but I agree with you here.

> > [1] https://www.freetype.org/patents.html

"A survey from June 2007 shows no less than nine patents from Microsoft
that cover ClearType."

"Does FreeType Implement Any of the Patented Techniques?
Technically, no. The patents cover the whole process of generating
and displaying sub-pixel images. Since the font engine doesn't do the
display part, it cannot infringe."

... but xenocara as a whole does display.

> > [2] 
> > http://metadata.ftp-master.debian.org/changelogs/main/f/freetype/freetype_2.5.2-3+deb8u1_changelog

" * debian/patches-freetype/enable-subpixel-rendering.patch: enable subpixel
rendering features, used by libcairo and xft to provide LCD colour
filtering.  This is considered no more or less evil than the bytecode
interpreter which we also enable."

this doesn't strike me as a robust evaluation of the patent situation.

> > [3] http://www.freshports.org/print/freetype2/

"The following configuration options are available for freetype2-2.6.3:
LCD_FILTERING=on: Sub-pixel rendering (patented)"

optional and a warning about patents in the description. And FreeBSD's
inclusion of CDDL code (e.g. ZFS) shows they have a different approach
to patents than OpenBSD.

> > [4] 
> > https://git.archlinux.org/svntogit/packages.git/tree/trunk/0002-Enable-subpixel-rendering.patch?h=packages/freetype2

https://wiki.archlinux.org/index.php/Talk:Font_configuration - "does not
require patching FreeType and Fontconfig because Arch Linux already does
this. However, Arch Linux does not enable the patent encumbered settings
by default" - I don't really understand what arch are doing here.

> > Is there a chance to get this enabled in xenocara?

I don't think there's really been enough analysis of the patent
situation to give us the information to know whether enabling this
by default is going to get users or OpenBSD into patent-related
problems or not.



Re: correction on faq about ftp-proxy (was Re: FTP behind PF)

2017-01-15 Thread Theo Buehler
On Sun, Jan 15, 2017 at 12:26:41PM +0100, Sebastien Marie wrote:
> On Sun, Jan 15, 2017 at 11:04:39AM +, Mik J wrote:
> > Thank you Sebastien, it works.
> > I was confused because I tried so many things.
> > Yes the man tells "_ftp-proxy" and this page 
> > https://www.openbsd.org/faq/pf/ftp.html#natserverTells "proxy"
> > 
> 
> Congratulations, you found two documentation bugs !
> 
> The man page one was already commited by deraadt@, for the faq the
> following patch should do the work.

Indeed, thanks to both of you!

> 
> Thanks.
> -- 
> Sebastien Marie
> 
> 
> Index: faq/pf/ftp.html
> ===
> RCS file: /cvs/www/faq/pf/ftp.html,v
> retrieving revision 1.59
> diff -u -p -r1.59 ftp.html
> --- faq/pf/ftp.html   19 Sep 2016 23:44:47 -  1.59
> +++ faq/pf/ftp.html   15 Jan 2017 11:22:23 -
> @@ -197,12 +197,12 @@ ftp_ip = "10.10.10.1"
>  match out on egress inet from $int_if nat-to (egress)
>  anchor "ftp-proxy/*"
>  pass in  on  egress inet proto tcp to $ext_ip port 21
> -pass out on $int_if inet proto tcp to $ftp_ip port 21 user proxy
> +pass out on $int_if inet proto tcp to $ftp_ip port 21 user _ftp_proxy
>  
>  
>  Here we allow the connection inbound to port 21 on the external interface,
>  as well as the corresponding outbound connection to the FTP server.
> -The "user proxy" addition to the outbound rule ensures that only connections
> +The "user _ftp_proxy" addition to the outbound rule ensures that only 
> connections
>  initiated by ftp-proxy(8) are permitted.
>  
>  
> 



correction on faq about ftp-proxy (was Re: FTP behind PF)

2017-01-15 Thread Sebastien Marie
On Sun, Jan 15, 2017 at 11:04:39AM +, Mik J wrote:
> Thank you Sebastien, it works.
> I was confused because I tried so many things.
> Yes the man tells "_ftp-proxy" and this page 
> https://www.openbsd.org/faq/pf/ftp.html#natserverTells "proxy"
> 

Congratulations, you found two documentation bugs !

The man page one was already commited by deraadt@, for the faq the
following patch should do the work.

Thanks.
-- 
Sebastien Marie


Index: faq/pf/ftp.html
===
RCS file: /cvs/www/faq/pf/ftp.html,v
retrieving revision 1.59
diff -u -p -r1.59 ftp.html
--- faq/pf/ftp.html 19 Sep 2016 23:44:47 -  1.59
+++ faq/pf/ftp.html 15 Jan 2017 11:22:23 -
@@ -197,12 +197,12 @@ ftp_ip = "10.10.10.1"
 match out on egress inet from $int_if nat-to (egress)
 anchor "ftp-proxy/*"
 pass in  on  egress inet proto tcp to $ext_ip port 21
-pass out on $int_if inet proto tcp to $ftp_ip port 21 user proxy
+pass out on $int_if inet proto tcp to $ftp_ip port 21 user _ftp_proxy
 
 
 Here we allow the connection inbound to port 21 on the external interface,
 as well as the corresponding outbound connection to the FTP server.
-The "user proxy" addition to the outbound rule ensures that only connections
+The "user _ftp_proxy" addition to the outbound rule ensures that only 
connections
 initiated by ftp-proxy(8) are permitted.
 
 



Re: xenocara fontconfig: make slight hinting the default

2017-01-15 Thread Nils Reuße

On 01/04/2017 01:19 PM, Nils Reuße wrote:

Dear all,

fontconfig made slight hinting the default in version 2.11.95 (see commit at 
[1]).

xenocara currently ships, but does not install the new hinting conf files:

  $ cd /usr/xenocara/dist/fontconfig/conf.d/
  $ for file in *conf; do if ! test -f /etc/fonts/conf.avail/$file; then echo "$file 
not found"; fi; done
  10-hinting-full.conf not found
  10-hinting-medium.conf not found
  10-hinting-none.conf not found
  10-hinting-slight.conf not found

The patch below installs the missing files and makes slight hinting the default.

Any comments?

Kind regards
Nils

[1] 
https://cgit.freedesktop.org/fontconfig/commit/?id=98434b3392172233094cac25ade7225c93da9f1c


Index: distrib/sets/lists/xetc/mi
===
RCS file: /cvs/xenocara/distrib/sets/lists/xetc/mi,v
retrieving revision 1.31
diff -u -p -u -r1.31 mi
--- distrib/sets/lists/xetc/mi  28 Oct 2015 00:46:31 -  1.31
+++ distrib/sets/lists/xetc/mi  4 Jan 2017 11:21:03 -
@@ -12,6 +12,7 @@
 ./etc/X11/xdm/xdm-config
 ./etc/X11/xinit/xinitrc
 ./etc/X11/xsm/system.xsm
+./etc/fonts/conf.d/10-hinting-slight.conf
 ./etc/fonts/conf.d/10-scale-bitmap-fonts.conf
 ./etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf
 ./etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf
Index: lib/fontconfig/conf.d/Makefile
===
RCS file: /cvs/xenocara/lib/fontconfig/conf.d/Makefile,v
retrieving revision 1.10
diff -u -p -u -r1.10 Makefile
--- lib/fontconfig/conf.d/Makefile  19 Nov 2016 08:45:51 -  1.10
+++ lib/fontconfig/conf.d/Makefile  4 Jan 2017 11:21:03 -
@@ -9,6 +9,7 @@ DOC_FILES= \
README

 CONF_LINKS = \
+   10-hinting-slight.conf \
10-scale-bitmap-fonts.conf \
20-unhint-small-vera.conf \
30-lucida-aliases.conf \
@@ -29,6 +30,10 @@ CONF_LINKS = \

 AVAIL_FILES =  \
10-autohint.conf\
+   10-hinting-full.conf\
+   10-hinting-medium.conf  \
+   10-hinting-none.conf\
+   10-hinting-slight.conf  \
10-no-sub-pixel.conf\
10-scale-bitmap-fonts.conf  \
10-sub-pixel-bgr.conf   \



Any comment?