DNS options for sppp(4)

2012-10-05 Thread Gerhard Roth
Hi,

I trying to revive part of an old patch that was submitted by mpf
in 2007. If adds support for DNS server negotiation to the IPCP
part of sppp(4). If the PPP server provides IP addresses for
DNS servers, they will appear in the ifconfig(8) output.

A simple ifstated(8) script could then be used to re-write resolv.conf,
e.g.

# ifconfig pppoe | sed -n 's/^[[:space:]]*dns.:/nameserver/p'


Gerhard


Index: sbin/ifconfig/ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.257
diff -u -p -r1.257 ifconfig.c
--- sbin/ifconfig/ifconfig.c6 Sep 2012 19:41:59 -   1.257
+++ sbin/ifconfig/ifconfig.c5 Oct 2012 11:19:36 -
@@ -4265,6 +4265,12 @@ sppp_status(void)
if (spa.flags  AUTHFLAG_NORECHALLENGE)
printf(norechallenge );
putchar('\n');
+   if (spr.defs.dns_addrs[0] != INADDR_ANY)
+   printf(\tdns1: %s\n,
+   inet_ntoa(*(struct in_addr *)spr.defs.dns_addrs[0]));
+   if (spr.defs.dns_addrs[1] != INADDR_ANY)
+   printf(\tdns2: %s\n,
+   inet_ntoa(*(struct in_addr *)spr.defs.dns_addrs[1]));
 }
 
 void
Index: sys/net/if_sppp.h
===
RCS file: /cvs/src/sys/net/if_sppp.h,v
retrieving revision 1.17
diff -u -p -r1.17 if_sppp.h
--- sys/net/if_sppp.h   29 Jan 2012 10:21:54 -  1.17
+++ sys/net/if_sppp.h   5 Oct 2012 11:19:45 -
@@ -118,6 +118,7 @@ struct sppp {
time_t  pp_last_receive;/* peer's last sign of life */
time_t  pp_last_activity;   /* second of last payload data s/r */
enum ppp_phase pp_phase;/* phase we're currently in */
+   u_int32_t  dns_addrs[2];/* primary and secondary DNS server */
int state[IDX_COUNT];   /* state machine */
u_char  confid[IDX_COUNT];  /* id of last configuration request */
int rst_counter[IDX_COUNT]; /* restart counter */
Index: sys/net/if_spppsubr.c
===
RCS file: /cvs/src/sys/net/if_spppsubr.c,v
retrieving revision 1.98
diff -u -p -r1.98 if_spppsubr.c
--- sys/net/if_spppsubr.c   24 Jul 2012 15:16:20 -  1.98
+++ sys/net/if_spppsubr.c   5 Oct 2012 11:19:45 -
@@ -167,6 +167,8 @@
 #define IPCP_OPT_ADDRESSES 1   /* both IP addresses; deprecated */
 #define IPCP_OPT_COMPRESSION   2   /* IP compression protocol (VJ) */
 #define IPCP_OPT_ADDRESS   3   /* local IP address */
+#define IPCP_OPT_PRIMDNS   129 /* primary remote dns address */
+#define IPCP_OPT_SECDNS131 /* secondary remote dns address 
*/
 
 #define IPV6CP_OPT_IFID1   /* interface identifier */
 #define IPV6CP_OPT_COMPRESSION 2   /* IPv6 compression protocol */
@@ -2687,6 +2689,7 @@ sppp_ipcp_init(struct sppp *sp)
sp-ipcp.flags = 0;
sp-state[IDX_IPCP] = STATE_INITIAL;
sp-fail_counter[IDX_IPCP] = 0;
+   bzero(sp-dns_addrs, sizeof(sp-dns_addrs));
 #if defined (__FreeBSD__)
callout_handle_init(sp-ch[IDX_IPCP]);
 #endif
@@ -2954,6 +2957,9 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struc
struct ifnet *ifp = sp-pp_if;
int debug = ifp-if_flags  IFF_DEBUG;
u_int32_t wantaddr;
+   u_int32_t dns;
+   int dnsix;
+   int dns_changed = 0;
 
len -= 4;
 
@@ -2995,6 +3001,17 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struc
}
}
break;
+   case IPCP_OPT_PRIMDNS:
+   case IPCP_OPT_SECDNS:
+   if (len = 6  p[1] == 6) {
+   dnsix = (*p == IPCP_OPT_PRIMDNS) ? 0 : 1;
+   bcopy(p + 2, dns, sizeof dns);
+   if (sp-dns_addrs[dnsix] != dns) {
+   sp-dns_addrs[dnsix] = dns;
+   dns_changed = 1;
+   }
+   }
+   break;
 #ifdef notyet
case IPCP_OPT_COMPRESS:
/*
@@ -3004,6 +3021,8 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struc
 #endif
}
}
+   if ((ifp-if_flags  IFF_UP)  dns_changed)
+   rt_ifmsg(ifp);
if (debug)
addlog(\n);
 }
@@ -3109,12 +3128,13 @@ sppp_ipcp_tlf(struct sppp *sp)
/* we no longer need LCP */
sp-lcp.protos = ~(1  IDX_IPCP);
sppp_lcp_check_and_close(sp);
+   bzero(sp-dns_addrs, sizeof(sp-dns_addrs));
 }
 
 HIDE void
 sppp_ipcp_scr(struct sppp *sp)
 {
-   char opt[6 /* compression */ + 6 /* address */];
+   char opt[6 /* compression */ + 6 /* address */ + 12 /* dns addresses 
*/];
u_int32_t ouraddr;
int i = 0;
 
@@ -3143,6 +3163,16 @@ sppp_ipcp_scr(struct 

Re: add support for elantech touchpads to pms(4)

2012-10-05 Thread Martin Pieuchot
On 04/10/12(Thu) 15:24, Stefan Sperling wrote:
 This diff adds support for Elantech touchpads to pms(4), so that
 synpatics(4) will attach and allow configuration of edge-scrolling,
 2-finger scrolling, toggle tap-to-click on/off, etc.

Wow, nice to see more touchpad models supported.

 Currently, such pads only work in compat mode, which means they are
 recognized as regular PS/2 mice and cannot be properly configured.
 
 This patch adds support for hardware version 1, 2, and 3.
 Linux also supports version 4 but this driver does not yet.
 I have hardware version 3 which seems to work well, but code for
 the other versions is entirely untested. If you have a machine with
 a touchpad please try this diff. If it's an Elantech 1, 2, or 3,
 it should be detected as such automatically. (If you're looking
 for an easy way to configure the pad I'd suggest installing Xfce
 and going to the Mouse/Touchpad settings window.)
 
 If I don't get test reports for versions 1 and 2, my plan is to
 commit the support code for versions 1 and 2 but only attach to
 version 3. Bugs in touchpad support code can be rather irritating
 so I'd prefer to keep versions 1 and 2 in PS/2 compat mode until
 somebody can confirm that the code actually works. Thanks!

My first impression at looking the code is that the v2 and v3 use
totally different packet formats and I don't see a real benefit of
having only one entry in the protocol table if you need to check
for the hardware version in every function.

I would suggest to use 3 different entries in the protocol table and a
enable_elantech_common() function so you can get rid of the hw_version
check and the protocol-packetsize hack for the v1.

I got the same feeling when you set the absolute mode: every version
use different magic ps2 commands with different magic values, I'm not
sure adding generic read/write functions help to understand nor save
some lines of code.

Other than that, it looks to me that the flags ELANTECH_F_HW_V1_OLD and
ELANTECH_F_PARITY_REVERSED are redundant.

Martin



Re: Scheduler improvements

2012-10-05 Thread Antoine Jacoutot
On Thu, Oct 04, 2012 at 11:42:45PM +0200, Gregor Best wrote:
 As before, I'm looking forward to anything you have to comment, especially 
 cool
 benchmark ideas or the like.

I know my report is not a benchmark of any kind but I do see a slight 
improvements when running a full GNOME 3 installation.
ipis never go past 10K where they are regularly around 50K without this patch 
(confirmed with 2 different amd64 boxes).

I can't really see any interactive enhancements but I don't think that it's 
really the point.
That said, GNOME 3 is a nice interactive test for that kind of things, it's 
heavily threaded and currently the performance of the SP kernel outperforms by 
far the MP one.

Please count me as a guinea pig for any scheduler patch because my Desktop 
machines are become barely usable with an MP kernel since we switched to 
rthreads and I would really much want to see some improvements in that area.
I'll keep running with this (and any other mods) for the upcoming weeks and if 
I have time to do some real and useful benchmarking or see any regression, I'll 
let you know.

Thanks.

-- 
Antoine



Re: Scheduler improvements

2012-10-05 Thread Juan Francisco Cantero Hurtado
On Thu, Oct 04, 2012 at 11:42:45PM +0200, Gregor Best wrote:
 Hi people,
 
 after a (very) long time of silence on this, here's another go at it. This 
 time,
 I basically started from scratch and used a bit of code by Christiano 
 Haesberth
 which had been posted to tech@ a while ago to detect CPU topology on amd64 and
 take that into account when moving processes between CPUs.
 
 This version has one single queue per CPU, getting rid of a) the one single 
 system
 wide runqueue and b) the queue for expired processes. This simplifies things 
 a bit
 and performs just as well as my previous versions (the only difference is the 
 order
 in which expired procs get selected for running on a CPU). One advantage is 
 that
 process selection is in O(log n) of the number of processes on the CPU and 
 depends
 neither on the total number of processes nor the number of expired processes 
 in
 the runqueue.
 
 The factors for the cost of moving a process between hardware threads, cpu 
 dies
 and cpu packages are guesses now, I think those will have to be tuned further.
 Sadly, I haven't had access to a multiprocessor machine with a more diverse
 architecture than a bunch of cores on the same die.
 
 I tested this on some more machines than before; a Core i5, an i7 and my Core 
 2
 Duo and on all machines (perceived) interactivity was improved. The simplest
 benchmark I used was playing back a 1080p version of Big Buck Bunny with 
 mplayer.
 All machines I tested on had Intel graphics cards, one GM965 (on the 
 Core2Duo) and
 the others were Sandy Bridge devices. On all of them, playback was smoother 
 with
 the i7 being most visible. With the default scheduler, watching the movie was 
 a
 big pain due to heavy frame-dropping, with my patch, the movie was watchable 
 (with
 frame dropping only (barely) noticable in scenes with much movement).
 
 As before, I'm looking forward to anything you have to comment, especially 
 cool
 benchmark ideas or the like.

With your patch, html5 videos on firefox are smoother, even the playback
is better when I try firefox + dpb 2 jobs vs only firefox without your
patch installed. I use i3wm, so I can't comment about the performance of
a full desktop environment.

My hardware: AMD A4-3400, 8GB, ATI Radeon HD 4350.

Please, still working on this area :)

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



if_vr tx dma segs with zero pad

2012-10-05 Thread Chris Cappuccio
same as last diff, plus zero pad small frames with an extra, zeroed dma segment 
instead of a copy (a la myx)

Index: if_vr.c
===
RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.115
diff -u -r1.115 if_vr.c
--- if_vr.c 18 Sep 2012 14:49:44 -  1.115
+++ if_vr.c 5 Oct 2012 17:48:42 -
@@ -113,13 +113,16 @@
NULL, vr, DV_IFNET
 };
 
-int vr_encap(struct vr_softc *, struct vr_chain *, struct mbuf *);
+int vr_encap(struct vr_softc *, struct vr_chain **, struct mbuf *);
 void vr_rxeof(struct vr_softc *);
 void vr_rxeoc(struct vr_softc *);
 void vr_txeof(struct vr_softc *);
 void vr_tick(void *);
 void vr_rxtick(void *);
 int vr_intr(void *);
+int vr_dmamem_alloc(struct vr_softc *, struct vr_dmamem *,
+bus_size_t, u_int);
+void vr_dmamem_free(struct vr_softc *, struct vr_dmamem *);
 void vr_start(struct ifnet *);
 int vr_ioctl(struct ifnet *, u_long, caddr_t);
 void vr_chipinit(struct vr_softc *);
@@ -481,6 +484,46 @@
return(0);
 }
 
+int
+vr_dmamem_alloc(struct vr_softc *sc, struct vr_dmamem *vrm,
+bus_size_t size, u_int align)
+{
+   vrm-vrm_size = size;
+
+   if (bus_dmamap_create(sc-sc_dmat, vrm-vrm_size, 1,
+   vrm-vrm_size, 0, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
+   vrm-vrm_map) != 0)
+   return (1);
+   if (bus_dmamem_alloc(sc-sc_dmat, vrm-vrm_size,
+   align, 0, vrm-vrm_seg, 1, vrm-vrm_nsegs,
+   BUS_DMA_WAITOK | BUS_DMA_ZERO) != 0)
+   goto destroy;
+   if (bus_dmamem_map(sc-sc_dmat, vrm-vrm_seg, vrm-vrm_nsegs,
+   vrm-vrm_size, vrm-vrm_kva, BUS_DMA_WAITOK) != 0)
+   goto free;
+   if (bus_dmamap_load(sc-sc_dmat, vrm-vrm_map, vrm-vrm_kva,
+   vrm-vrm_size, NULL, BUS_DMA_WAITOK) != 0)
+   goto unmap;
+
+   return (0);
+ unmap:
+   bus_dmamem_unmap(sc-sc_dmat, vrm-vrm_kva, vrm-vrm_size);
+ free:
+   bus_dmamem_free(sc-sc_dmat, vrm-vrm_seg, 1);
+ destroy:
+   bus_dmamap_destroy(sc-sc_dmat, vrm-vrm_map);
+   return (1);
+}
+
+void
+vr_dmamem_free(struct vr_softc *sc, struct vr_dmamem *vrm)
+{
+   bus_dmamap_unload(sc-sc_dmat, vrm-vrm_map);
+   bus_dmamem_unmap(sc-sc_dmat, vrm-vrm_kva, vrm-vrm_size);
+   bus_dmamem_free(sc-sc_dmat, vrm-vrm_seg, 1);
+   bus_dmamap_destroy(sc-sc_dmat, vrm-vrm_map);
+}
+
 /*
  * Attach the interface. Allocate softc structures, do ifmedia
  * setup and ethernet/BPF attach.
@@ -497,8 +540,6 @@
const char  *intrstr = NULL;
struct ifnet*ifp = sc-arpcom.ac_if;
bus_size_t  size;
-   int rseg;
-   caddr_t kva;
 
/*
 * Handle power management nonsense.
@@ -555,7 +596,7 @@
/* Allocate interrupt */
if (pci_intr_map(pa, ih)) {
printf(: can't map interrupt\n);
-   goto fail_1;
+   goto fail;
}
intrstr = pci_intr_string(pc, ih);
sc-sc_ih = pci_intr_establish(pc, ih, IPL_NET, vr_intr, sc,
@@ -565,7 +606,7 @@
if (intrstr != NULL)
printf( at %s, intrstr);
printf(\n);
-   goto fail_1;
+   goto fail;
}
printf(: %s, intrstr);
 
@@ -593,29 +634,20 @@
printf(, address %s\n, ether_sprintf(sc-arpcom.ac_enaddr));
 
sc-sc_dmat = pa-pa_dmat;
-   if (bus_dmamem_alloc(sc-sc_dmat, sizeof(struct vr_list_data),
-   PAGE_SIZE, 0, sc-sc_listseg, 1, rseg,
-   BUS_DMA_NOWAIT | BUS_DMA_ZERO)) {
-   printf(: can't alloc list\n);
-   goto fail_2;
-   }
-   if (bus_dmamem_map(sc-sc_dmat, sc-sc_listseg, rseg,
-   sizeof(struct vr_list_data), kva, BUS_DMA_NOWAIT)) {
-   printf(: can't map dma buffers (%d bytes)\n,
-   sizeof(struct vr_list_data));
-   goto fail_3;
-   }
-   if (bus_dmamap_create(sc-sc_dmat, sizeof(struct vr_list_data), 1,
-   sizeof(struct vr_list_data), 0, BUS_DMA_NOWAIT, sc-sc_listmap)) {
-   printf(: can't create dma map\n);
-   goto fail_4;
-   }
-   if (bus_dmamap_load(sc-sc_dmat, sc-sc_listmap, kva,
-   sizeof(struct vr_list_data), NULL, BUS_DMA_NOWAIT)) {
-   printf(: can't load dma map\n);
-   goto fail_5;
+   if (vr_dmamem_alloc(sc, sc-sc_zeromap, 64, PAGE_SIZE) != 0) {
+   printf(: failed to allocate zero pad memory\n);
+   return;
+   }
+   bzero(sc-sc_zeromap.vrm_kva, 64);
+   bus_dmamap_sync(sc-sc_dmat, sc-sc_zeromap.vrm_map, 0,
+   sc-sc_zeromap.vrm_map-dm_mapsize, BUS_DMASYNC_PREREAD);
+   if (vr_dmamem_alloc(sc, sc-sc_listmap, sizeof(struct vr_list_data),
+   PAGE_SIZE) != 0) {
+   printf(: failed to allocate dma map\n);
+   goto free_zero;
}
-   sc-vr_ldata = (struct 

Re: Scheduler improvements

2012-10-05 Thread Alexandre Ratchov
On Thu, Oct 04, 2012 at 11:42:45PM +0200, Gregor Best wrote:
 @@ -222,14 +230,13 @@
  setrunqueue(struct proc *p)
  {
   struct schedstate_percpu *spc;
 - int queue = p-p_priority  2;
  
   SCHED_ASSERT_LOCKED();
   spc = p-p_cpu-ci_schedstate;
   spc-spc_nrun++;
  
 - TAILQ_INSERT_TAIL(spc-spc_qs[queue], p, p_runq);
 - spc-spc_whichqs |= (1  queue);
 + KASSERT(!RB_FIND(prochead, spc-spc_runq, p));
 + RB_INSERT(prochead, spc-spc_runq, p);
   cpuset_add(sched_queued_cpus, p-p_cpu);
  
   if (cpuset_isset(sched_idle_cpus, p-p_cpu))
 @@ -240,38 +247,29 @@
  remrunqueue(struct proc *p)
  {
   struct schedstate_percpu *spc;
 - int queue = p-p_priority  2;
  
   SCHED_ASSERT_LOCKED();
   spc = p-p_cpu-ci_schedstate;
   spc-spc_nrun--;
  
 - TAILQ_REMOVE(spc-spc_qs[queue], p, p_runq);
 - if (TAILQ_EMPTY(spc-spc_qs[queue])) {
 - spc-spc_whichqs = ~(1  queue);
 - if (spc-spc_whichqs == 0)
 - cpuset_del(sched_queued_cpus, p-p_cpu);
 - }
 + KASSERT(RB_REMOVE(prochead, spc-spc_runq, p));
 + if (RB_EMPTY(spc-spc_runq))
 + cpuset_del(sched_queued_cpus, p-p_cpu);
  }
  

This change is unclear for me; AFAIU, it removes the mechanism
which makes processes wake up with a priority depending on what  
they are blocked on.

For instance processes waking up from poll(2) or audio read/write
won't be prioritized any longer. If so, this would hurt audio and
other interactive processes but would improve cpu-intesive
bloatware.

haven't tested this though

 Index: kern/sched_bsd.c
 ===
 RCS file: /cvs/src/sys/kern/sched_bsd.c,v
 retrieving revision 1.30
 diff -u -r1.30 sched_bsd.c
 --- kern/sched_bsd.c  9 Jul 2012 17:27:32 -   1.30
 +++ kern/sched_bsd.c  4 Oct 2012 21:27:58 -
 @@ -77,20 +77,18 @@
  
   timeout_set(schedcpu_to, schedcpu, schedcpu_to);
  
 - rrticks_init = hz / 10;
 + rrticks_init = hz / 20;

this change is unrelated to the rest isn't it?

-- Alexandre



Re: Scheduler improvements

2012-10-05 Thread Kevin Chadwick
 It appears to have sped up porn. movies on the machine seem a bit better.
 
 I will try this in a few other places

Just not at the mother in laws or in public places no matter how
impressed you are at the difference?

-- 
___

'Write programs that do one thing and do it well. Write programs to work
together. Write programs to handle text streams, because that is a
universal interface'

(Doug McIlroy)
___



Re: add support for elantech touchpads to pms(4)

2012-10-05 Thread Stefan Sperling
On Fri, Oct 05, 2012 at 01:52:08PM +0200, Martin Pieuchot wrote:
 My first impression at looking the code is that the v2 and v3 use
 totally different packet formats and I don't see a real benefit of
 having only one entry in the protocol table if you need to check
 for the hardware version in every function.

 I would suggest to use 3 different entries in the protocol table and a
 enable_elantech_common() function so you can get rid of the hw_version
 check and the protocol-packetsize hack for the v1.

 I got the same feeling when you set the absolute mode: every version
 use different magic ps2 commands with different magic values, I'm not
 sure adding generic read/write functions help to understand nor save
 some lines of code.
 
 Other than that, it looks to me that the flags ELANTECH_F_HW_V1_OLD and
 ELANTECH_F_PARITY_REVERSED are redundant.

All good points. And the parity flag was even wrongly defined...

New version, hopefully better. Also fixes softc-elantech memory leak
in error paths (which synaptics and alps have, too, btw.)

Works for me with version 3, other versions still untested AFAIK.

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.31
diff -u -p -r1.31 pms.c
--- pms.c   22 Jul 2012 18:28:36 -  1.31
+++ pms.c   5 Oct 2012 18:21:53 -
@@ -57,6 +57,9 @@ struct pms_protocol {
 #define PMS_INTELLI1
 #define PMS_SYNAPTICS  2
 #define PMS_ALPS   3
+#define PMS_ELANTECH_V14
+#define PMS_ELANTECH_V25
+#define PMS_ELANTECH_V36
u_int packetsize;
int (*enable)(struct pms_softc *);
int (*ioctl)(struct pms_softc *, u_long, caddr_t, int, struct proc *);
@@ -108,6 +111,25 @@ struct alps_softc {
 #define ALPS_PRESSURE  40
 };
 
+struct elantech_softc {
+   int flags;
+#define ELANTECH_F_REPORTS_PRESSURE0x01
+#define ELANTECH_F_HAS_ROCKER  0x02
+#define ELANTECH_F_2FINGER_PACKET  0x04
+#define ELANTECH_F_HW_V1_OLD   0x08
+
+   int min_x, min_y;
+   int max_x, max_y;
+
+   u_char parity[256];
+   u_char p1, p2, p3;
+
+   /* Compat mode */
+   int wsmode;
+   int old_x, old_y;
+   u_int old_buttons;
+};
+
 struct pms_softc { /* driver status information */
struct device sc_dev;
 
@@ -129,6 +151,7 @@ struct pms_softc {  /* driver status inf
const struct pms_protocol *protocol;
struct synaptics_softc *synaptics;
struct alps_softc *alps;
+   struct elantech_softc *elantech;
 
u_char packet[8];
 
@@ -227,6 +250,18 @@ intpms_ioctl_alps(struct pms_softc *, u
 intpms_sync_alps(struct pms_softc *, int);
 void   pms_proc_alps(struct pms_softc *);
 
+intpms_enable_elantech_v1(struct pms_softc *);
+intpms_enable_elantech_v2(struct pms_softc *);
+intpms_enable_elantech_v3(struct pms_softc *);
+intpms_ioctl_elantech(struct pms_softc *, u_long, caddr_t, int,
+struct proc *);
+intpms_sync_elantech_v1(struct pms_softc *, int);
+intpms_sync_elantech_v2(struct pms_softc *, int);
+intpms_sync_elantech_v3(struct pms_softc *, int);
+void   pms_proc_elantech_v1(struct pms_softc *);
+void   pms_proc_elantech_v2(struct pms_softc *);
+void   pms_proc_elantech_v3(struct pms_softc *);
+
 intsynaptics_set_mode(struct pms_softc *, int);
 intsynaptics_query(struct pms_softc *, int, int *);
 intsynaptics_get_hwinfo(struct pms_softc *);
@@ -235,6 +270,17 @@ void   synaptics_sec_proc(struct pms_softc
 intalps_sec_proc(struct pms_softc *);
 intalps_get_hwinfo(struct pms_softc *);
 
+intelantech_knock(struct pms_softc *);
+void   elantech_send_input(struct pms_softc *, u_int, int, int, int, int);
+intelantech_get_hwinfo_v1(struct pms_softc *);
+intelantech_get_hwinfo_v2(struct pms_softc *);
+intelantech_get_hwinfo_v3(struct pms_softc *);
+intelantech_ps2_cmd(struct pms_softc *, u_char);
+intelantech_set_absolute_mode_v1(struct pms_softc *);
+intelantech_set_absolute_mode_v2(struct pms_softc *);
+intelantech_set_absolute_mode_v3(struct pms_softc *);
+
+
 struct cfattach pms_ca = {
sizeof(struct pms_softc), pmsprobe, pmsattach, NULL,
pmsactivate
@@ -293,6 +339,33 @@ const struct pms_protocol pms_protocols[
pms_proc_alps,
NULL
},
+   /* Elantech touchpad (hardware version 1) */
+   {
+   PMS_ELANTECH_V1, 4,
+   pms_enable_elantech_v1,
+   pms_ioctl_elantech,
+   pms_sync_elantech_v1,
+   pms_proc_elantech_v1,
+   NULL
+   },
+   /* Elantech touchpad (hardware version 2) */
+   {
+   PMS_ELANTECH_V2, 6,
+   pms_enable_elantech_v2,
+   pms_ioctl_elantech,
+   pms_sync_elantech_v2,
+   

one more

2012-10-05 Thread Chris Cappuccio
proper ring size check when runt segment is added

Index: if_vr.c
===
RCS file: /cvs/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.115
diff -u -r1.115 if_vr.c
--- if_vr.c 18 Sep 2012 14:49:44 -  1.115
+++ if_vr.c 5 Oct 2012 18:22:36 -
@@ -113,13 +113,16 @@
NULL, vr, DV_IFNET
 };
 
-int vr_encap(struct vr_softc *, struct vr_chain *, struct mbuf *);
+int vr_encap(struct vr_softc *, struct vr_chain **, struct mbuf *);
 void vr_rxeof(struct vr_softc *);
 void vr_rxeoc(struct vr_softc *);
 void vr_txeof(struct vr_softc *);
 void vr_tick(void *);
 void vr_rxtick(void *);
 int vr_intr(void *);
+int vr_dmamem_alloc(struct vr_softc *, struct vr_dmamem *,
+bus_size_t, u_int);
+void vr_dmamem_free(struct vr_softc *, struct vr_dmamem *);
 void vr_start(struct ifnet *);
 int vr_ioctl(struct ifnet *, u_long, caddr_t);
 void vr_chipinit(struct vr_softc *);
@@ -481,6 +484,46 @@
return(0);
 }
 
+int
+vr_dmamem_alloc(struct vr_softc *sc, struct vr_dmamem *vrm,
+bus_size_t size, u_int align)
+{
+   vrm-vrm_size = size;
+
+   if (bus_dmamap_create(sc-sc_dmat, vrm-vrm_size, 1,
+   vrm-vrm_size, 0, BUS_DMA_WAITOK | BUS_DMA_ALLOCNOW,
+   vrm-vrm_map) != 0)
+   return (1);
+   if (bus_dmamem_alloc(sc-sc_dmat, vrm-vrm_size,
+   align, 0, vrm-vrm_seg, 1, vrm-vrm_nsegs,
+   BUS_DMA_WAITOK | BUS_DMA_ZERO) != 0)
+   goto destroy;
+   if (bus_dmamem_map(sc-sc_dmat, vrm-vrm_seg, vrm-vrm_nsegs,
+   vrm-vrm_size, vrm-vrm_kva, BUS_DMA_WAITOK) != 0)
+   goto free;
+   if (bus_dmamap_load(sc-sc_dmat, vrm-vrm_map, vrm-vrm_kva,
+   vrm-vrm_size, NULL, BUS_DMA_WAITOK) != 0)
+   goto unmap;
+
+   return (0);
+ unmap:
+   bus_dmamem_unmap(sc-sc_dmat, vrm-vrm_kva, vrm-vrm_size);
+ free:
+   bus_dmamem_free(sc-sc_dmat, vrm-vrm_seg, 1);
+ destroy:
+   bus_dmamap_destroy(sc-sc_dmat, vrm-vrm_map);
+   return (1);
+}
+
+void
+vr_dmamem_free(struct vr_softc *sc, struct vr_dmamem *vrm)
+{
+   bus_dmamap_unload(sc-sc_dmat, vrm-vrm_map);
+   bus_dmamem_unmap(sc-sc_dmat, vrm-vrm_kva, vrm-vrm_size);
+   bus_dmamem_free(sc-sc_dmat, vrm-vrm_seg, 1);
+   bus_dmamap_destroy(sc-sc_dmat, vrm-vrm_map);
+}
+
 /*
  * Attach the interface. Allocate softc structures, do ifmedia
  * setup and ethernet/BPF attach.
@@ -497,8 +540,6 @@
const char  *intrstr = NULL;
struct ifnet*ifp = sc-arpcom.ac_if;
bus_size_t  size;
-   int rseg;
-   caddr_t kva;
 
/*
 * Handle power management nonsense.
@@ -555,7 +596,7 @@
/* Allocate interrupt */
if (pci_intr_map(pa, ih)) {
printf(: can't map interrupt\n);
-   goto fail_1;
+   goto fail;
}
intrstr = pci_intr_string(pc, ih);
sc-sc_ih = pci_intr_establish(pc, ih, IPL_NET, vr_intr, sc,
@@ -565,7 +606,7 @@
if (intrstr != NULL)
printf( at %s, intrstr);
printf(\n);
-   goto fail_1;
+   goto fail;
}
printf(: %s, intrstr);
 
@@ -593,29 +634,20 @@
printf(, address %s\n, ether_sprintf(sc-arpcom.ac_enaddr));
 
sc-sc_dmat = pa-pa_dmat;
-   if (bus_dmamem_alloc(sc-sc_dmat, sizeof(struct vr_list_data),
-   PAGE_SIZE, 0, sc-sc_listseg, 1, rseg,
-   BUS_DMA_NOWAIT | BUS_DMA_ZERO)) {
-   printf(: can't alloc list\n);
-   goto fail_2;
-   }
-   if (bus_dmamem_map(sc-sc_dmat, sc-sc_listseg, rseg,
-   sizeof(struct vr_list_data), kva, BUS_DMA_NOWAIT)) {
-   printf(: can't map dma buffers (%d bytes)\n,
-   sizeof(struct vr_list_data));
-   goto fail_3;
-   }
-   if (bus_dmamap_create(sc-sc_dmat, sizeof(struct vr_list_data), 1,
-   sizeof(struct vr_list_data), 0, BUS_DMA_NOWAIT, sc-sc_listmap)) {
-   printf(: can't create dma map\n);
-   goto fail_4;
-   }
-   if (bus_dmamap_load(sc-sc_dmat, sc-sc_listmap, kva,
-   sizeof(struct vr_list_data), NULL, BUS_DMA_NOWAIT)) {
-   printf(: can't load dma map\n);
-   goto fail_5;
+   if (vr_dmamem_alloc(sc, sc-sc_zeromap, 64, PAGE_SIZE) != 0) {
+   printf(: failed to allocate zero pad memory\n);
+   return;
+   }
+   bzero(sc-sc_zeromap.vrm_kva, 64);
+   bus_dmamap_sync(sc-sc_dmat, sc-sc_zeromap.vrm_map, 0,
+   sc-sc_zeromap.vrm_map-dm_mapsize, BUS_DMASYNC_PREREAD);
+   if (vr_dmamem_alloc(sc, sc-sc_listmap, sizeof(struct vr_list_data),
+   PAGE_SIZE) != 0) {
+   printf(: failed to allocate dma map\n);
+   goto free_zero;
}
-   sc-vr_ldata = (struct vr_list_data *)kva;
+
+   sc-vr_ldata = (struct vr_list_data 

Re: Scheduler improvements

2012-10-05 Thread Norman Golisz
On Fri Oct  5 2012 14:24, Antoine Jacoutot wrote:
 On Thu, Oct 04, 2012 at 11:42:45PM +0200, Gregor Best wrote:
  As before, I'm looking forward to anything you have to comment, especially 
  cool
  benchmark ideas or the like.
 
 I know my report is not a benchmark of any kind but I do see a slight
 improvements when running a full GNOME 3 installation.
 ipis never go past 10K where they are regularly around 50K without this
 patch (confirmed with 2 different amd64 boxes).

I can confirm this, too. GNOME 3 generated around 80.000 to over 100.000
ipis, by simply moving the mouse cursor over the menu entries for a few
seconds! The desktop felt sluggish. With this patch, the same
procedure feels less sluggish, and the ipi count dropped down to 9.000 to
15.000.

Further, the time it takes to compile the kernel more than halved from
~10min to 4,27min.

And, the best of all, the first time I'm able to watch html5 embedded
videos smoothly, even in full screen mode.



Re: Scheduler improvements

2012-10-05 Thread Mark Kettenis
 Date: Thu, 4 Oct 2012 23:42:45 +0200
 From: Gregor Best g...@ring0.de
 Index: kern/kern_sched.c
 ===
 RCS file: /cvs/src/sys/kern/kern_sched.c,v
 retrieving revision 1.27
 diff -u -r1.27 kern_sched.c
 --- kern/kern_sched.c 10 Jul 2012 18:20:37 -  1.27
 +++ kern/kern_sched.c 4 Oct 2012 21:27:58 -
 @@ -158,18 +167,17 @@
  
   cpuset_add(sched_idle_cpus, ci);
   cpu_idle_enter();
 - while (spc-spc_whichqs == 0) {
 - if (spc-spc_schedflags  SPCF_SHOULDHALT 
 - (spc-spc_schedflags  SPCF_HALTED) == 0) {
 - cpuset_del(sched_idle_cpus, ci);
 - SCHED_LOCK(s);
 - atomic_setbits_int(spc-spc_schedflags,
 - spc-spc_whichqs ? 0 : SPCF_HALTED);
 - SCHED_UNLOCK(s);
 - wakeup(spc);
 - }
 - cpu_idle_cycle();
 +
 + if (spc-spc_schedflags  SPCF_SHOULDHALT 
 +  (spc-spc_schedflags  SPCF_HALTED) == 0) {
 + cpuset_del(sched_idle_cpus, ci);
 + SCHED_LOCK(s);
 + atomic_setbits_int(spc-spc_schedflags, SPCF_HALTED);
 + SCHED_UNLOCK(s);
 + wakeup(spc);
   }
 + cpu_idle_cycle();
 +
   cpu_idle_leave();
   cpuset_del(sched_idle_cpus, ci);
   }
 @@ -222,14 +230,13 @@

I don't think changing the idle loop like this is ok.  You want to
continue checking whether the runqueue is empty in between
cpu_idle_enter() and cpu_idle_leave().



Hola -tech- No Te Lo Pierdas

2012-10-05 Thread tHE bEATLES BOX Set 2012 Una Reliquia
Hola tech, si no podes visualizar este correo, podes hacerlo clickeando
en este enlace.
The Beatles BOX-SET de ORO | 5 DVDs | Calidad 100% Digital HD

The
Beatles BOX-SET de ORO

UNICA OPORTUNIDAD A PRECIO PROMOCIONAL
Para visitar la web y ver mas detalles haga CLIC ACA

Este email tiene como unico destinatario tech

Para ser eliminado de nuestras listas envienos un email y en asunto
aclarar REMOVER

eapvptlqvrnkddrnswmc