svn commit: r295252 - in head/sys/arm: arm include

2016-02-04 Thread Michal Meloun
Author: mmel
Date: Thu Feb  4 12:11:18 2016
New Revision: 295252
URL: https://svnweb.freebsd.org/changeset/base/295252

Log:
  ARM: Don't use ugly (and hidden) global variable, control register is
  readable at any time.

Modified:
  head/sys/arm/arm/cpufunc.c
  head/sys/arm/arm/identcpu.c
  head/sys/arm/include/cpufunc.h

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Thu Feb  4 12:06:06 2016(r295251)
+++ head/sys/arm/arm/cpufunc.c  Thu Feb  4 12:11:18 2016(r295252)
@@ -88,8 +88,6 @@ u_int arm_cache_level;
 u_int  arm_cache_type[14];
 u_int  arm_cache_loc;
 
-int ctrl;
-
 #ifdef CPU_ARM9
 struct cpu_functions arm9_cpufuncs = {
/* CPU functions */
@@ -889,7 +887,6 @@ arm9_setup(void)
 
/* Set the control register */
cpu_control(cpuctrlmask, cpuctrl);
-   ctrl = cpuctrl;
 
 }
 #endif /* CPU_ARM9 */
@@ -928,7 +925,6 @@ arm10_setup(void)
cpuctrl |= CPU_CONTROL_VECRELOC;
 
/* Set the control register */
-   ctrl = cpuctrl;
cpu_control(0x, cpuctrl);
 
/* And again. */
@@ -1032,7 +1028,6 @@ arm11x6_setup(void)
cp15_cpacr_set(0x0fff);
 
/* Set the control register */
-   ctrl = cpuctrl;
cpu_control(~cpuctrl_wax, cpuctrl);
 
tmp = cp15_actlr_get();
@@ -1074,7 +1069,6 @@ pj4bv7_setup(void)
cpu_idcache_wbinv_all();
 
/* Set the control register */
-   ctrl = cpuctrl;
cpu_control(0x, cpuctrl);
 
/* And again. */
@@ -1120,7 +1114,6 @@ cortexa_setup(void)
cpu_idcache_wbinv_all();
 
/* Set the control register */
-   ctrl = cpuctrl;
cpu_control(cpuctrlmask, cpuctrl);
 
/* And again. */
@@ -1167,7 +1160,6 @@ fa526_setup(void)
cpu_idcache_wbinv_all();
 
/* Set the control register */
-   ctrl = cpuctrl;
cpu_control(0x, cpuctrl);
 }
 #endif /* CPU_FA526 */
@@ -1221,7 +1213,6 @@ xscale_setup(void)
 * Set the control register.  Note that bits 6:3 must always
 * be set to 1.
 */
-   ctrl = cpuctrl;
 /* cpu_control(cpuctrlmask, cpuctrl);*/
cpu_control(0x, cpuctrl);
 

Modified: head/sys/arm/arm/identcpu.c
==
--- head/sys/arm/arm/identcpu.c Thu Feb  4 12:06:06 2016(r295251)
+++ head/sys/arm/arm/identcpu.c Thu Feb  4 12:11:18 2016(r295252)
@@ -321,7 +321,6 @@ print_enadis(int enadis, char *s)
printf(" %s %sabled", s, (enadis == 0) ? "dis" : "en");
 }
 
-extern int ctrl;
 enum cpu_class cpu_class = CPU_CLASS_NONE;
 
 u_int cpu_pfr(int num)
@@ -388,9 +387,10 @@ void
 identify_arm_cpu(void)
 {
u_int cpuid, reg, size, sets, ways;
-   u_int8_t type, linesize;
+   u_int8_t type, linesize, ctrl;
int i;
 
+   ctrl = cpu_get_control();
cpuid = cpu_ident();
 
if (cpuid == 0) {

Modified: head/sys/arm/include/cpufunc.h
==
--- head/sys/arm/include/cpufunc.h  Thu Feb  4 12:06:06 2016
(r295251)
+++ head/sys/arm/include/cpufunc.h  Thu Feb  4 12:11:18 2016
(r295252)
@@ -202,6 +202,7 @@ u_int   cpufunc_control (u_int clear, u_i
 void   cpu_domains (u_int domains);
 u_int  cpu_faultstatus (void);
 u_int  cpu_faultaddress(void);
+u_int  cpu_get_control (void);
 u_int  cpu_pfr (int);
 
 #if defined(CPU_FA526)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295251 - in head/sys: arm/arm sparc64/sparc64

2016-02-04 Thread Ruslan Bukin
Author: br
Date: Thu Feb  4 12:06:06 2016
New Revision: 295251
URL: https://svnweb.freebsd.org/changeset/base/295251

Log:
  Fix build.

Modified:
  head/sys/arm/arm/vm_machdep.c
  head/sys/sparc64/sparc64/vm_machdep.c

Modified: head/sys/arm/arm/vm_machdep.c
==
--- head/sys/arm/arm/vm_machdep.c   Thu Feb  4 11:52:53 2016
(r295250)
+++ head/sys/arm/arm/vm_machdep.c   Thu Feb  4 12:06:06 2016
(r295251)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: head/sys/sparc64/sparc64/vm_machdep.c
==
--- head/sys/sparc64/sparc64/vm_machdep.c   Thu Feb  4 11:52:53 2016
(r295250)
+++ head/sys/sparc64/sparc64/vm_machdep.c   Thu Feb  4 12:06:06 2016
(r295251)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295249 - head/sys/kern

2016-02-04 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  4 10:49:34 2016
New Revision: 295249
URL: https://svnweb.freebsd.org/changeset/base/295249

Log:
  Guard against runnable td2 exiting and than being reused for unrelated
  process when the parent sleeps waiting for the debugger attach on
  fork.
  
  Diagnosed and reviewed by:mjg
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Thu Feb  4 09:39:08 2016(r295248)
+++ head/sys/kern/kern_fork.c   Thu Feb  4 10:49:34 2016(r295249)
@@ -777,7 +777,7 @@ do_fork(struct thread *td, struct fork_r
/*
 * Wait until debugger is attached to child.
 */
-   while ((td2->td_dbgflags & TDB_STOPATFORK) != 0)
+   while (td2->td_proc == p2 && (td2->td_dbgflags & TDB_STOPATFORK) != 0)
cv_wait(>p_dbgwait, >p_mtx);
_PRELE(p2);
racct_proc_fork_done(p2);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295253 - in head/sys/riscv: include riscv

2016-02-04 Thread Ruslan Bukin
Author: br
Date: Thu Feb  4 12:49:28 2016
New Revision: 295253
URL: https://svnweb.freebsd.org/changeset/base/295253

Log:
  Reuse gp register for pcpu pointer.
  
  gp (global pointer) is used by compiler in userland only,
  so re-use it for pcpup in kernel, save it on stack on switching
  out to userland and load back on return to kernel.
  
  Discussed with:   jhb, andrew, kib
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D5178

Modified:
  head/sys/riscv/include/pcpu.h
  head/sys/riscv/riscv/exception.S
  head/sys/riscv/riscv/genassym.c
  head/sys/riscv/riscv/machdep.c
  head/sys/riscv/riscv/swtch.S
  head/sys/riscv/riscv/vm_machdep.c

Modified: head/sys/riscv/include/pcpu.h
==
--- head/sys/riscv/include/pcpu.h   Thu Feb  4 12:11:18 2016
(r295252)
+++ head/sys/riscv/include/pcpu.h   Thu Feb  4 12:49:28 2016
(r295253)
@@ -47,8 +47,11 @@ extern struct pcpu *pcpup;
 static inline struct pcpu *
 get_pcpu(void)
 {
+   struct pcpu *pcpu;
 
-   return (pcpup);
+   __asm __volatile("mv %0, gp" : "="(pcpu));
+
+   return (pcpu);
 }
 
 static inline struct thread *
@@ -56,7 +59,7 @@ get_curthread(void)
 {
struct thread *td;
 
-   td = (struct thread *)*(uint64_t *)pcpup;
+   __asm __volatile("ld %0, 0(gp)" : "="(td));
 
return (td);
 }

Modified: head/sys/riscv/riscv/exception.S
==
--- head/sys/riscv/riscv/exception.SThu Feb  4 12:11:18 2016
(r295252)
+++ head/sys/riscv/riscv/exception.SThu Feb  4 12:49:28 2016
(r295253)
@@ -41,12 +41,16 @@ __FBSDID("$FreeBSD$");
 #include 
 
 .macro save_registers el
-   addisp, sp, -280
+   addisp, sp, -(TF_SIZE)
 
sd  ra, (TF_RA)(sp)
-   sd  gp, (TF_GP)(sp)
sd  tp, (TF_TP)(sp)
 
+.if \el == 0   /* We came from userspace. Load our pcpu */
+   sd  gp, (TF_GP)(sp)
+   ld  gp, (TF_SIZE)(sp)
+.endif
+
sd  t0, (TF_T + 0 * 8)(sp)
sd  t1, (TF_T + 1 * 8)(sp)
sd  t2, (TF_T + 2 * 8)(sp)
@@ -127,13 +131,16 @@ __FBSDID("$FreeBSD$");
csrwsepc, t0
 
 .if \el == 0
-   /* Load user sp */
+   /* We go to userspace. Load user sp */
ld  t0, (TF_SP)(sp)
csrwsscratch, t0
+
+   /* And store our pcpu */
+   sd  gp, (TF_SIZE)(sp)
+   ld  gp, (TF_GP)(sp)
 .endif
 
ld  ra, (TF_RA)(sp)
-   ld  gp, (TF_GP)(sp)
ld  tp, (TF_TP)(sp)
 
ld  t0, (TF_T + 0 * 8)(sp)
@@ -166,7 +173,7 @@ __FBSDID("$FreeBSD$");
ld  a6, (TF_A + 6 * 8)(sp)
ld  a7, (TF_A + 7 * 8)(sp)
 
-   addisp, sp, 280
+   addisp, sp, (TF_SIZE)
 .endm
 
 .macro do_ast

Modified: head/sys/riscv/riscv/genassym.c
==
--- head/sys/riscv/riscv/genassym.c Thu Feb  4 12:11:18 2016
(r295252)
+++ head/sys/riscv/riscv/genassym.c Thu Feb  4 12:49:28 2016
(r295253)
@@ -85,6 +85,7 @@ ASSYM(TD_FRAME, offsetof(struct thread, 
 ASSYM(TD_MD, offsetof(struct thread, td_md));
 ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
 
+ASSYM(TF_SIZE, sizeof(struct trapframe));
 ASSYM(TF_RA, offsetof(struct trapframe, tf_ra));
 ASSYM(TF_SP, offsetof(struct trapframe, tf_sp));
 ASSYM(TF_GP, offsetof(struct trapframe, tf_gp));

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Feb  4 12:11:18 2016
(r295252)
+++ head/sys/riscv/riscv/machdep.c  Thu Feb  4 12:49:28 2016
(r295253)
@@ -256,7 +256,9 @@ ptrace_clear_single_step(struct thread *
 void
 exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
 {
-   struct trapframe *tf = td->td_frame;
+   struct trapframe *tf;
+
+   tf = td->td_frame;
 
memset(tf, 0, sizeof(struct trapframe));
 
@@ -563,6 +565,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 static void
 init_proc0(vm_offset_t kstack)
 {
+
pcpup = &__pcpu[0];
 
proc_linkup0(, );
@@ -760,11 +763,7 @@ initriscv(struct riscv_bootparams *rvbp)
pcpu_init(pcpup, 0, sizeof(struct pcpu));
 
/* Set the pcpu pointer */
-#if 0
-   /* SMP TODO: try re-use gp for pcpu pointer */
-   __asm __volatile(
-   "mv gp, %0" :: "r"(pcpup));
-#endif
+   __asm __volatile("mv gp, %0" :: "r"(pcpup));
 
PCPU_SET(curthread, );
 

Modified: head/sys/riscv/riscv/swtch.S
==
--- head/sys/riscv/riscv/swtch.SThu Feb  4 12:11:18 2016
(r295252)
+++ head/sys/riscv/riscv/swtch.SThu Feb  4 12:49:28 2016
(r295253)
@@ -74,8 +74,6 @@ 

Re: svn commit: r292206 - in head/contrib/unbound: . compat daemon dns64 dnstap doc iterator libunbound libunbound/python libunbound/python/doc libunbound/python/doc/modules libunbound/python/examples

2016-02-04 Thread Dag-Erling Smørgrav
Peter Wemm  writes:
> An error was introduced here that breaks some of the support scripts:

It would help to name the script...

If it's unbound-control-setup, the solution is to remove it, as it is no
longer needed.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r295250 - in head/sys: arm64/arm64 mips/mips riscv/riscv

2016-02-04 Thread Ruslan Bukin
Author: br
Date: Thu Feb  4 11:52:53 2016
New Revision: 295250
URL: https://svnweb.freebsd.org/changeset/base/295250

Log:
  Fix build.

Modified:
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/riscv/riscv/vm_machdep.c

Modified: head/sys/arm64/arm64/vm_machdep.c
==
--- head/sys/arm64/arm64/vm_machdep.c   Thu Feb  4 10:49:34 2016
(r295249)
+++ head/sys/arm64/arm64/vm_machdep.c   Thu Feb  4 11:52:53 2016
(r295250)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: head/sys/mips/mips/vm_machdep.c
==
--- head/sys/mips/mips/vm_machdep.c Thu Feb  4 10:49:34 2016
(r295249)
+++ head/sys/mips/mips/vm_machdep.c Thu Feb  4 11:52:53 2016
(r295250)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

Modified: head/sys/riscv/riscv/vm_machdep.c
==
--- head/sys/riscv/riscv/vm_machdep.c   Thu Feb  4 10:49:34 2016
(r295249)
+++ head/sys/riscv/riscv/vm_machdep.c   Thu Feb  4 11:52:53 2016
(r295250)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295283 - head/share/man/man4

2016-02-04 Thread George V. Neville-Neil
Author: gnn
Date: Thu Feb  4 21:46:37 2016
New Revision: 295283
URL: https://svnweb.freebsd.org/changeset/base/295283

Log:
  Summary: Update the date

Modified:
  head/share/man/man4/inet.4

Modified: head/share/man/man4/inet.4
==
--- head/share/man/man4/inet.4  Thu Feb  4 21:39:58 2016(r295282)
+++ head/share/man/man4/inet.4  Thu Feb  4 21:46:37 2016(r295283)
@@ -28,7 +28,7 @@
 .\" From: @(#)inet.4   8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd April 7, 2015
+.Dd Feb 4, 2016
 .Dt INET 4
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295286 - head/sys/dev/mps

2016-02-04 Thread Scott Long
Author: scottl
Date: Thu Feb  4 23:38:55 2016
New Revision: 295286
URL: https://svnweb.freebsd.org/changeset/base/295286

Log:
  Add sysctls for dumping out the device mapping tables.  I'm finding this
  useful for debugging device-target translation bugs.
  
  MFC after:3 days
  Sponsored by: Netflix

Modified:
  head/sys/dev/mps/mps.c
  head/sys/dev/mps/mps_mapping.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mps/mps.c
==
--- head/sys/dev/mps/mps.c  Thu Feb  4 22:53:12 2016(r295285)
+++ head/sys/dev/mps/mps.c  Thu Feb  4 23:38:55 2016(r295286)
@@ -1476,6 +1476,14 @@ mps_setup_sysctl(struct mps_softc *sc)
OID_AUTO, "spinup_wait_time", CTLFLAG_RD,
>spinup_wait_time, DEFAULT_SPINUP_WAIT, "seconds to wait for "
"spinup after SATA ID error");
+
+   SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+   OID_AUTO, "mapping_table_dump", CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
+   mps_mapping_dump, "A", "Mapping Table Dump");
+
+   SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+   OID_AUTO, "encl_table_dump", CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
+   mps_mapping_encl_dump, "A", "Enclosure Table Dump");
 }
 
 int

Modified: head/sys/dev/mps/mps_mapping.c
==
--- head/sys/dev/mps/mps_mapping.c  Thu Feb  4 22:53:12 2016
(r295285)
+++ head/sys/dev/mps/mps_mapping.c  Thu Feb  4 23:38:55 2016
(r295286)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2263,3 +2264,61 @@ out:
if (sc->pending_map_events)
sc->pending_map_events--;
 }
+
+int
+mps_mapping_dump(SYSCTL_HANDLER_ARGS)
+{
+   struct mps_softc *sc;
+   struct dev_mapping_table *mt_entry;
+   struct sbuf sbuf;
+   int i, error;
+
+   sc = (struct mps_softc *)arg1;
+
+   error = sysctl_wire_old_buffer(req, 0);
+   if (error != 0)
+   return (error);
+   sbuf_new_for_sysctl(, NULL, 128, req);
+
+   sbuf_printf(, "\nindex physical_id   handle id\n");
+   for (i = 0; i < sc->max_devices; i++) {
+   mt_entry = >mapping_table[i];
+   if (mt_entry->physical_id == 0)
+   continue;
+   sbuf_printf(, "%4d  %jx  %04x   %hd\n",
+   i, mt_entry->physical_id, mt_entry->dev_handle,
+   mt_entry->id);
+   }
+   error = sbuf_finish();
+   sbuf_delete();
+   return (error);
+}
+
+int
+mps_mapping_encl_dump(SYSCTL_HANDLER_ARGS)
+{
+   struct mps_softc *sc;
+   struct enc_mapping_table *enc_entry;
+   struct sbuf sbuf;
+   int i, error;
+
+   sc = (struct mps_softc *)arg1;
+
+   error = sysctl_wire_old_buffer(req, 0);
+   if (error != 0)
+   return (error);
+   sbuf_new_for_sysctl(, NULL, 128, req);
+
+   sbuf_printf(, "\nindex enclosure_id  handle map_index\n");
+   for (i = 0; i < sc->max_enclosures; i++) {
+   enc_entry = >enclosure_table[i];
+   if (enc_entry->enclosure_id == 0)
+   continue;
+   sbuf_printf(, "%4d  %jx  %04x   %d\n",
+   i, enc_entry->enclosure_id, enc_entry->enc_handle,
+   enc_entry->start_index);
+   }
+   error = sbuf_finish();
+   sbuf_delete();
+   return (error);
+}

Modified: head/sys/dev/mps/mpsvar.h
==
--- head/sys/dev/mps/mpsvar.h   Thu Feb  4 22:53:12 2016(r295285)
+++ head/sys/dev/mps/mpsvar.h   Thu Feb  4 23:38:55 2016(r295286)
@@ -756,6 +756,8 @@ void mps_mapping_enclosure_dev_status_ch
 Mpi2EventDataSasEnclDevStatusChange_t *event_data);
 void mps_mapping_ir_config_change_event(struct mps_softc *sc,
 Mpi2EventDataIrConfigChangeList_t *event_data);
+int mps_mapping_dump(SYSCTL_HANDLER_ARGS);
+int mps_mapping_encl_dump(SYSCTL_HANDLER_ARGS);
 
 void mpssas_evt_handler(struct mps_softc *sc, uintptr_t data,
 MPI2_EVENT_NOTIFICATION_REPLY *event);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295282 - head/share/man/man4

2016-02-04 Thread George V. Neville-Neil
Author: gnn
Date: Thu Feb  4 21:39:58 2016
New Revision: 295282
URL: https://svnweb.freebsd.org/changeset/base/295282

Log:
  Summary: Remove discussion of fastforwarding.

Modified:
  head/share/man/man4/inet.4

Modified: head/share/man/man4/inet.4
==
--- head/share/man/man4/inet.4  Thu Feb  4 21:27:03 2016(r295281)
+++ head/share/man/man4/inet.4  Thu Feb  4 21:39:58 2016(r295282)
@@ -164,33 +164,11 @@ MIB.
 In addition to the variables supported by the transport protocols
 (for which the respective manual pages may be consulted),
 the following general variables are defined:
-.Bl -tag -width IPCTL_FASTFORWARDING
+.Bl -tag -width IPCTL_ACCEPTSOURCEROUTE
 .It Dv IPCTL_FORWARDING
 .Pq ip.forwarding
 Boolean: enable/disable forwarding of IP packets.
 Defaults to off.
-.It Dv IPCTL_FASTFORWARDING
-.Pq ip.fastforwarding
-Boolean: enable/disable the use of
-.Tn fast IP forwarding
-code.
-Defaults to off.
-When
-.Tn fast IP forwarding
-is enabled, IP packets are forwarded directly to the appropriate network
-interface with direct processing to completion, which greatly improves
-the throughput.
-All packets for local IP addresses, non-unicast, or with IP options are
-handled by the normal IP input processing path.
-All features of the normal (slow) IP forwarding path are supported
-including firewall (through
-.Xr pfil 9
-hooks) checking, except
-.Xr ipsec 4
-tunnel brokering.
-The
-.Tn IP fastforwarding
-path does not generate ICMP redirect or source quench messages.
 .It Dv IPCTL_SENDREDIRECTS
 .Pq ip.redirect
 Boolean: enable/disable sending of ICMP redirects in response to
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r294560 - head/etc/rc.d

2016-02-04 Thread Bryan Drewery
On 1/22/2016 4:14 AM, Dag-Erling Smørgrav wrote:
> Author: des
> Date: Fri Jan 22 12:14:08 2016
> New Revision: 294560
> URL: https://svnweb.freebsd.org/changeset/base/294560
> 
> Log:
>   Do not generate RSA1 or DSA keys by default.
> 
> Modified:
>   head/etc/rc.d/sshd
> 
> Modified: head/etc/rc.d/sshd
> ==
> --- head/etc/rc.d/sshdFri Jan 22 12:00:56 2016(r294559)
> +++ head/etc/rc.d/sshdFri Jan 22 12:14:08 2016(r294560)
> @@ -20,9 +20,9 @@ configtest_cmd="sshd_configtest"
>  pidfile="/var/run/${name}.pid"
>  extra_commands="configtest keygen reload"
>  
> -: ${sshd_rsa1_enable:="yes"}
> +: ${sshd_rsa1_enable:="no"}
>  : ${sshd_rsa_enable:="yes"}
> -: ${sshd_dsa_enable:="yes"}
> +: ${sshd_dsa_enable:="no"}
>  : ${sshd_ecdsa_enable:="yes"}
>  : ${sshd_ed25519_enable:="yes"}
>  
> 

I think perhaps you should also remove these as having default paths in
the .c as well and require they be enabled in the config. Otherwise a
warning is given:

Feb  4 15:25:22 VM sshd[874]: error: Could not load host key:
/etc/ssh/ssh_host_dsa_key

Or always generate them but only load them if enabled in the config.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r295284 - in head/sys: conf dev/cfi

2016-02-04 Thread Adrian Chadd
Author: adrian
Date: Thu Feb  4 22:39:27 2016
New Revision: 295284
URL: https://svnweb.freebsd.org/changeset/base/295284

Log:
  Provide a workaround for setting the correct endianness when doing CFI on
  a mips big-endian board.
  
  This is (hopefully! ish!) a temporary change until a slightly better way
  can be found to express this without a config option.
  
  Tested:
  
  * BUFFALO WZR-HP-G300NH 1stGen (by submitter)
  
  Submitted by: Mori Hiroki 

Modified:
  head/sys/conf/options
  head/sys/dev/cfi/cfi_core.c

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Thu Feb  4 21:46:37 2016(r295283)
+++ head/sys/conf/options   Thu Feb  4 22:39:27 2016(r295284)
@@ -918,6 +918,7 @@ VNET_DEBUG  opt_global.h
 # Common Flash Interface (CFI) options
 CFI_SUPPORT_STRATAFLASHopt_cfi.h
 CFI_ARMEDANDDANGEROUS  opt_cfi.h
+CFI_HARDWAREBYTESWAP   opt_cfi.h
 
 # Sound options
 SND_DEBUG  opt_snd.h

Modified: head/sys/dev/cfi/cfi_core.c
==
--- head/sys/dev/cfi/cfi_core.c Thu Feb  4 21:46:37 2016(r295283)
+++ head/sys/dev/cfi/cfi_core.c Thu Feb  4 22:39:27 2016(r295284)
@@ -99,11 +99,17 @@ cfi_read(struct cfi_softc *sc, u_int ofs
break;
case 2:
sval = bus_space_read_2(sc->sc_tag, sc->sc_handle, ofs);
+#ifdef CFI_HARDWAREBYTESWAP
+   val = sval;
+#else
val = le16toh(sval);
+#endif
break;
case 4:
val = bus_space_read_4(sc->sc_tag, sc->sc_handle, ofs);
+#ifndef CFI_HARDWAREBYTESWAP
val = le32toh(val);
+#endif
break;
default:
val = ~0;
@@ -122,10 +128,19 @@ cfi_write(struct cfi_softc *sc, u_int of
bus_space_write_1(sc->sc_tag, sc->sc_handle, ofs, val);
break;
case 2:
+#ifdef CFI_HARDWAREBYTESWAP
+   bus_space_write_2(sc->sc_tag, sc->sc_handle, ofs, val);
+#else
bus_space_write_2(sc->sc_tag, sc->sc_handle, ofs, htole16(val));
+
+#endif
break;
case 4:
+#ifdef CFI_HARDWAREBYTESWAP
+   bus_space_write_4(sc->sc_tag, sc->sc_handle, ofs, val);
+#else
bus_space_write_4(sc->sc_tag, sc->sc_handle, ofs, htole32(val));
+#endif
break;
}
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295309 - head/sys/dev/hyperv/vmbus

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 07:29:11 2016
New Revision: 295309
URL: https://svnweb.freebsd.org/changeset/base/295309

Log:
  hyperv: Use malloc for page allocation.
  
  We will eventually convert them to use busdma.
  
  Submitted by: Jun Su 
  Reviewed by:  adrian, sephe, Dexuan Cui 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5087

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==
--- head/sys/dev/hyperv/vmbus/hv_channel.c  Fri Feb  5 07:20:31 2016
(r295308)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c  Fri Feb  5 07:29:11 2016
(r295309)
@@ -68,9 +68,7 @@ vmbus_channel_set_event(hv_vmbus_channel
+ ((channel->offer_msg.child_rel_id >> 5;
 
monitor_page = (hv_vmbus_monitor_page *)
-   hv_vmbus_g_connection.monitor_pages;
-
-   monitor_page++; /* Get the child to parent monitor page */
+   hv_vmbus_g_connection.monitor_page_2;
 
synch_set_bit(channel->monitor_bit,
(uint32_t *)_page->

Modified: head/sys/dev/hyperv/vmbus/hv_connection.c
==
--- head/sys/dev/hyperv/vmbus/hv_connection.c   Fri Feb  5 07:20:31 2016
(r295308)
+++ head/sys/dev/hyperv/vmbus/hv_connection.c   Fri Feb  5 07:29:11 2016
(r295309)
@@ -86,11 +86,10 @@ hv_vmbus_negotiate_version(hv_vmbus_chan
hv_vmbus_g_connection.interrupt_page);
 
msg->monitor_page_1 = hv_get_phys_addr(
-   hv_vmbus_g_connection.monitor_pages);
+   hv_vmbus_g_connection.monitor_page_1);
 
msg->monitor_page_2 = hv_get_phys_addr(
-   ((uint8_t *) hv_vmbus_g_connection.monitor_pages
-   + PAGE_SIZE));
+   hv_vmbus_g_connection.monitor_page_2);
 
/**
 * Add to list before we send the request since we may receive the
@@ -176,11 +175,9 @@ hv_vmbus_connect(void) {
 * Setup the vmbus event connection for channel interrupt abstraction
 * stuff
 */
-   hv_vmbus_g_connection.interrupt_page = contigmalloc(
+   hv_vmbus_g_connection.interrupt_page = malloc(
PAGE_SIZE, M_DEVBUF,
-   M_WAITOK | M_ZERO, 0UL,
-   BUS_SPACE_MAXADDR,
-   PAGE_SIZE, 0);
+   M_WAITOK | M_ZERO);
 
hv_vmbus_g_connection.recv_interrupt_page =
hv_vmbus_g_connection.interrupt_page;
@@ -193,14 +190,14 @@ hv_vmbus_connect(void) {
 * Set up the monitor notification facility. The 1st page for
 * parent->child and the 2nd page for child->parent
 */
-   hv_vmbus_g_connection.monitor_pages = contigmalloc(
-   2 * PAGE_SIZE,
+   hv_vmbus_g_connection.monitor_page_1 = malloc(
+   PAGE_SIZE,
M_DEVBUF,
-   M_WAITOK | M_ZERO,
-   0UL,
-   BUS_SPACE_MAXADDR,
+   M_WAITOK | M_ZERO);
+   hv_vmbus_g_connection.monitor_page_2 = malloc(
PAGE_SIZE,
-   0);
+   M_DEVBUF,
+   M_WAITOK | M_ZERO);
 
msg_info = (hv_vmbus_channel_msg_info*)
malloc(sizeof(hv_vmbus_channel_msg_info) +
@@ -258,13 +255,8 @@ hv_vmbus_connect(void) {
hv_vmbus_g_connection.interrupt_page = NULL;
}
 
-   if (hv_vmbus_g_connection.monitor_pages != NULL) {
-   contigfree(
-   hv_vmbus_g_connection.monitor_pages,
-   2 * PAGE_SIZE,
-   M_DEVBUF);
-   hv_vmbus_g_connection.monitor_pages = NULL;
-   }
+   free(hv_vmbus_g_connection.monitor_page_1, M_DEVBUF);
+   free(hv_vmbus_g_connection.monitor_page_2, M_DEVBUF);
 
if (msg_info) {
sema_destroy(_info->wait_sema);

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Fri Feb  5 07:20:31 2016
(r295308)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Fri Feb  5 07:29:11 2016
(r295309)
@@ -350,7 +350,8 @@ typedef struct {
 * notification and 2nd is child->parent
 * notification
 */
-   void*monitor_pages;
+   void*monitor_page_1;
+   void*monitor_page_2;

svn commit: r295307 - in head/sys/dev/hyperv: include utilities vmbus

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 07:09:58 2016
New Revision: 295307
URL: https://svnweb.freebsd.org/changeset/base/295307

Log:
  hyperv: Use standard taskqueue instead of hv_work_queue
  
  HyperV code was ported from Linux.  There is an implementation of
  work queue called hv_work_queue.  In FreeBSD, taskqueue could be
  used for the same purpose.  Convert all the consumer of hv_work_queue
  to use taskqueue, and remove work queue implementation.
  
  Submitted by: Jun Su 
  Reviewed by:  adrian, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D4963

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/include/hyperv.h
==
--- head/sys/dev/hyperv/include/hyperv.hFri Feb  5 05:50:53 2016
(r295306)
+++ head/sys/dev/hyperv/include/hyperv.hFri Feb  5 07:09:58 2016
(r295307)
@@ -908,30 +908,6 @@ inthv_vmbus_channel_teardown_gpdal(
 
 struct hv_vmbus_channel* vmbus_select_outgoing_channel(struct hv_vmbus_channel 
*promary);
 
-/*
- * Work abstraction defines
- */
-typedef struct hv_work_queue {
-   struct taskqueue*   queue;
-   struct proc*proc;
-   struct sema*work_sema;
-} hv_work_queue;
-
-typedef struct hv_work_item {
-   struct task work;
-   void(*callback)(void *);
-   void*   context;
-   hv_work_queue*  wq;
-} hv_work_item;
-
-struct hv_work_queue*  hv_work_queue_create(char* name);
-
-void   hv_work_queue_close(struct hv_work_queue* wq);
-
-inthv_queue_work_item(
-   hv_work_queue*  wq,
-   void(*callback)(void *),
-   void*   context);
 /**
  * @brief Get physical address from virtual
  */
@@ -952,8 +928,8 @@ typedef struct hv_vmbus_service {
 hv_guid   guid; /* Hyper-V GUID */
 char  *name;/* name of service */
 boolean_t enabled;  /* service enabled */
-hv_work_queue *work_queue;  /* background work queue */
-
+   void*   context;
+   struct task task;
 /*
  * function to initialize service
  */
@@ -963,6 +939,11 @@ typedef struct hv_vmbus_service {
  * function to process Hyper-V messages
  */
 void (*callback)(void *);
+
+   /*
+* function to uninitilize service
+*/
+   int (*uninit)(struct hv_vmbus_service *);
 } hv_vmbus_service;
 
 extern uint8_t* receive_buffer[];

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Fri Feb  5 05:50:53 2016
(r295306)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Fri Feb  5 07:09:58 2016
(r295307)
@@ -98,7 +98,7 @@ static d_poll_t   hv_kvp_dev_daemon_poll;
 static int hv_kvp_req_in_progress(void);
 static voidhv_kvp_transaction_init(uint32_t, hv_vmbus_channel *, uint64_t, 
uint8_t *);
 static voidhv_kvp_send_msg_to_daemon(void);
-static voidhv_kvp_process_request(void *context);
+static voidhv_kvp_process_request(void *context, int pending);
 
 /* hv_kvp character device structure */
 static struct cdevsw hv_kvp_cdevsw =
@@ -123,9 +123,6 @@ static struct selinfo hv_kvp_selinfo;
  */
 static struct {
 
-   /* Pre-allocated work item for queue */
-   hv_work_itemwork_item;  
-
/* Unless specified the pending mutex should be 
 * used to alter the values of the following paramters:
 * 1. req_in_progress
@@ -642,7 +639,7 @@ hv_kvp_send_msg_to_daemon(void)
  * and interact with daemon
  */
 static void
-hv_kvp_process_request(void *context)
+hv_kvp_process_request(void *context, int pending)
 {
uint8_t *kvp_buf;
hv_vmbus_channel *channel = context;
@@ -756,23 +753,18 @@ hv_kvp_callback(void *context)
uint64_t pending_cnt = 0;
 
if (kvp_globals.register_done == false) {
-   
kvp_globals.channelp = context;
+   TASK_INIT(_table[HV_KVP].task, 0, 
hv_kvp_process_request, context);
} else {
-   
mtx_lock(_globals.pending_mutex);
kvp_globals.pending_reqs = kvp_globals.pending_reqs + 1;
pending_cnt = kvp_globals.pending_reqs;
mtx_unlock(_globals.pending_mutex);
if 

svn commit: r295308 - in head/sys/dev/hyperv: netvsc vmbus

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 07:20:31 2016
New Revision: 295308
URL: https://svnweb.freebsd.org/changeset/base/295308

Log:
  hyperv: Use WAITOK in the places where we can wait
  
  And convert rndis non-hot path spinlock to mutex.
  
  Submitted by: Jun Su 
  Reviewed by:  adrian, sephe
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5081

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/vmbus/hv_connection.c
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Feb  5 07:09:58 2016
(r295307)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Feb  5 07:20:31 2016
(r295308)
@@ -74,10 +74,7 @@ hv_nv_alloc_net_device(struct hv_device 
netvsc_dev *net_dev;
hn_softc_t *sc = device_get_softc(device->device);
 
-   net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_NOWAIT | M_ZERO);
-   if (net_dev == NULL) {
-   return (NULL);
-   }
+   net_dev = malloc(sizeof(netvsc_dev), M_NETVSC, M_WAITOK | M_ZERO);
 
net_dev->dev = device;
net_dev->destroy = FALSE;
@@ -224,11 +221,7 @@ hv_nv_init_rx_buffer_with_net_vsp(struct
init_pkt->msgs.vers_1_msgs.send_rx_buf_complete.num_sections;
 
net_dev->rx_sections = malloc(net_dev->rx_section_count *
-   sizeof(nvsp_1_rx_buf_section), M_NETVSC, M_NOWAIT);
-   if (net_dev->rx_sections == NULL) {
-   ret = EINVAL;
-   goto cleanup;
-   }
+   sizeof(nvsp_1_rx_buf_section), M_NETVSC, M_WAITOK);
memcpy(net_dev->rx_sections, 
init_pkt->msgs.vers_1_msgs.send_rx_buf_complete.sections,
net_dev->rx_section_count * sizeof(nvsp_1_rx_buf_section));
@@ -326,11 +319,7 @@ hv_nv_init_send_buffer_with_net_vsp(stru
BITS_PER_LONG);
net_dev->send_section_bitsmap =
malloc(net_dev->bitsmap_words * sizeof(long), M_NETVSC,
-   M_NOWAIT | M_ZERO);
-   if (NULL == net_dev->send_section_bitsmap) {
-   ret = ENOMEM;
-   goto cleanup;
-   }
+   M_WAITOK | M_ZERO);
 
goto exit;
 

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Feb  5 07:09:58 
2016(r295307)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cFri Feb  5 07:20:31 
2016(r295308)
@@ -135,12 +135,9 @@ hv_get_rndis_device(void)
 {
rndis_device *device;
 
-   device = malloc(sizeof(rndis_device), M_NETVSC, M_NOWAIT | M_ZERO);
-   if (device == NULL) {
-   return (NULL);
-   }
+   device = malloc(sizeof(rndis_device), M_NETVSC, M_WAITOK | M_ZERO);
 
-   mtx_init(>req_lock, "HV-FRL", NULL, MTX_SPIN | MTX_RECURSE);
+   mtx_init(>req_lock, "HV-FRL", NULL, MTX_DEF);
 
/* Same effect as STAILQ_HEAD_INITIALIZER() static initializer */
STAILQ_INIT(>myrequest_list);
@@ -171,10 +168,7 @@ hv_rndis_request(rndis_device *device, u
rndis_msg *rndis_mesg;
rndis_set_request *set;
 
-   request = malloc(sizeof(rndis_request), M_NETVSC, M_NOWAIT | M_ZERO);
-   if (request == NULL) {
-   return (NULL);
-   }
+   request = malloc(sizeof(rndis_request), M_NETVSC, M_WAITOK | M_ZERO);
 
sema_init(>wait_sema, 0, "rndis sema");

@@ -193,9 +187,9 @@ hv_rndis_request(rndis_device *device, u
set->request_id += 1;
 
/* Add to the request list */
-   mtx_lock_spin(>req_lock);
+   mtx_lock(>req_lock);
STAILQ_INSERT_TAIL(>myrequest_list, request, mylist_entry);
-   mtx_unlock_spin(>req_lock);
+   mtx_unlock(>req_lock);
 
return (request);
 }
@@ -206,14 +200,14 @@ hv_rndis_request(rndis_device *device, u
 static inline void
 hv_put_rndis_request(rndis_device *device, rndis_request *request)
 {
-   mtx_lock_spin(>req_lock);
+   mtx_lock(>req_lock);
/* Fixme:  Has O(n) performance */
/*
 * XXXKYS: Use Doubly linked lists.
 */
STAILQ_REMOVE(>myrequest_list, request, rndis_request_,
mylist_entry);
-   mtx_unlock_spin(>req_lock);
+   mtx_unlock(>req_lock);
 
sema_destroy(>wait_sema);
free(request, M_NETVSC);
@@ -270,7 +264,7 @@ hv_rf_receive_response(rndis_device *dev
rndis_request *next_request;
boolean_t found = FALSE;
 
-   mtx_lock_spin(>req_lock);
+   mtx_lock(>req_lock);
request = STAILQ_FIRST(>myrequest_list);
while (request != NULL) {
/*
@@ -285,7 +279,7 @@ 

Re: svn commit: r294560 - head/etc/rc.d

2016-02-04 Thread Bryan Drewery
On 2/4/2016 3:28 PM, Bryan Drewery wrote:
> On 1/22/2016 4:14 AM, Dag-Erling Smørgrav wrote:
>> Author: des
>> Date: Fri Jan 22 12:14:08 2016
>> New Revision: 294560
>> URL: https://svnweb.freebsd.org/changeset/base/294560
>>
>> Log:
>>   Do not generate RSA1 or DSA keys by default.
>>
>> Modified:
>>   head/etc/rc.d/sshd
>>
>> Modified: head/etc/rc.d/sshd
>> ==
>> --- head/etc/rc.d/sshd   Fri Jan 22 12:00:56 2016(r294559)
>> +++ head/etc/rc.d/sshd   Fri Jan 22 12:14:08 2016(r294560)
>> @@ -20,9 +20,9 @@ configtest_cmd="sshd_configtest"
>>  pidfile="/var/run/${name}.pid"
>>  extra_commands="configtest keygen reload"
>>  
>> -: ${sshd_rsa1_enable:="yes"}
>> +: ${sshd_rsa1_enable:="no"}
>>  : ${sshd_rsa_enable:="yes"}
>> -: ${sshd_dsa_enable:="yes"}
>> +: ${sshd_dsa_enable:="no"}
>>  : ${sshd_ecdsa_enable:="yes"}
>>  : ${sshd_ed25519_enable:="yes"}
>>  
>>
> 
> I think perhaps you should also remove these as having default paths in
> the .c as well and require they be enabled in the config. Otherwise a
> warning is given:
> 
> Feb  4 15:25:22 VM sshd[874]: error: Could not load host key:
> /etc/ssh/ssh_host_dsa_key

This happens on every login even. It's quite annoying.

> 
> Or always generate them but only load them if enabled in the config.
> 


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r295260 - head/bin/dd

2016-02-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb  4 15:10:08 2016
New Revision: 295260
URL: https://svnweb.freebsd.org/changeset/base/295260

Log:
  Reduce code duplication.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/bin/dd/args.c

Modified: head/bin/dd/args.c
==
--- head/bin/dd/args.c  Thu Feb  4 14:32:48 2016(r295259)
+++ head/bin/dd/args.c  Thu Feb  4 15:10:08 2016(r295260)
@@ -360,6 +360,38 @@ c_conv(const void *a, const void *b)
((const struct conv *)b)->name));
 }
 
+static uintmax_t
+postfix_to_mult(const char expr)
+{
+   uintmax_t mult;
+
+   mult = 0;
+   switch (expr) {
+   case 'B':
+   case 'b':
+   mult = 512;
+   break;
+   case 'K':
+   case 'k':
+   mult = 1 << 10;
+   break;
+   case 'M':
+   case 'm':
+   mult = 1 << 20;
+   break;
+   case 'G':
+   case 'g':
+   mult = 1 << 30;
+   break;
+   case 'W':
+   case 'w':
+   mult = sizeof(int);
+   break;
+   }
+
+   return (mult);
+}
+
 /*
  * Convert an expression of the following forms to a uintmax_t.
  * 1) A positive decimal number.
@@ -386,31 +418,7 @@ get_num(const char *val)
if (expr == val)/* No valid digits. */
errx(1, "%s: illegal numeric value", oper);
 
-   mult = 0;
-   switch (*expr) {
-   case 'B':
-   case 'b':
-   mult = 512;
-   break;
-   case 'K':
-   case 'k':
-   mult = 1 << 10;
-   break;
-   case 'M':
-   case 'm':
-   mult = 1 << 20;
-   break;
-   case 'G':
-   case 'g':
-   mult = 1 << 30;
-   break;
-   case 'W':
-   case 'w':
-   mult = sizeof(int);
-   break;
-   default:
-   ;
-   }
+   mult = postfix_to_mult(*expr);
 
if (mult != 0) {
prevnum = num;
@@ -460,29 +468,7 @@ get_off_t(const char *val)
if (expr == val)/* No valid digits. */
errx(1, "%s: illegal numeric value", oper);
 
-   mult = 0;
-   switch (*expr) {
-   case 'B':
-   case 'b':
-   mult = 512;
-   break;
-   case 'K':
-   case 'k':
-   mult = 1 << 10;
-   break;
-   case 'M':
-   case 'm':
-   mult = 1 << 20;
-   break;
-   case 'G':
-   case 'g':
-   mult = 1 << 30;
-   break;
-   case 'W':
-   case 'w':
-   mult = sizeof(int);
-   break;
-   }
+   mult = postfix_to_mult(*expr);
 
if (mult != 0) {
prevnum = num;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r295254 - head/sys/arm/arm

2016-02-04 Thread Zbigniew Bodek
Hello Michal,

I have a fix for that that I will send for review soon (I need to test in
on some other platforms):
https://people.freebsd.org/~zbb/arm/other/0001-Fix-debug_monitor-code-for-older-ARMs-ARM11.patch

If you don't mind I will add you to the review on Phabricator.

Best regards
zbb

2016-02-04 14:32 GMT+01:00 Michal Meloun :

> Author: mmel
> Date: Thu Feb  4 13:32:29 2016
> New Revision: 295254
> URL: https://svnweb.freebsd.org/changeset/base/295254
>
> Log:
>   ARM: RPI-B kernel was broken by r294740. Make it functional again.
>
> Modified:
>   head/sys/arm/arm/debug_monitor.c
>
> Modified: head/sys/arm/arm/debug_monitor.c
>
> ==
> --- head/sys/arm/arm/debug_monitor.cThu Feb  4 12:49:28 2016
> (r295253)
> +++ head/sys/arm/arm/debug_monitor.cThu Feb  4 13:32:29 2016
> (r295254)
> @@ -845,8 +845,10 @@ dbg_arch_supported(void)
>  {
>
> switch (dbg_model) {
> +#ifdef not_yet
> case ID_DFR0_CP_DEBUG_M_V6:
> case ID_DFR0_CP_DEBUG_M_V6_1:
> +#endif
> case ID_DFR0_CP_DEBUG_M_V7:
> case ID_DFR0_CP_DEBUG_M_V7_1:   /* fall through */
> return (TRUE);
> ___
> svn-src-...@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295257 - in head/sys/arm: arm include

2016-02-04 Thread Svatopluk Kraus
Author: skra
Date: Thu Feb  4 14:15:24 2016
New Revision: 295257
URL: https://svnweb.freebsd.org/changeset/base/295257

Log:
  Make VM_MEMATTR_xxx definitions independent on pmap internals
  for __ARM_ARCH >= 6.
  
  It's TEX class number now, so it still has some meaning.

Modified:
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/include/pmap-v6.h
  head/sys/arm/include/vm.h

Modified: head/sys/arm/arm/pmap-v6.c
==
--- head/sys/arm/arm/pmap-v6.c  Thu Feb  4 14:02:42 2016(r295256)
+++ head/sys/arm/arm/pmap-v6.c  Thu Feb  4 14:15:24 2016(r295257)
@@ -223,11 +223,13 @@ int pmap_debug_level = 1;
 /*
  *  PTE2 descriptors creation macros.
  */
+#define PTE2_TEX_DEFAULT   memattr_to_tex2(VM_MEMATTR_DEFAULT)
+
 #define PTE2_KPT(pa)   PTE2_KERN(pa, PTE2_AP_KRW, pt_memattr)
 #define PTE2_KPT_NG(pa)PTE2_KERN_NG(pa, PTE2_AP_KRW, pt_memattr)
 
-#define PTE2_KRW(pa)   PTE2_KERN(pa, PTE2_AP_KRW, PTE2_ATTR_NORMAL)
-#define PTE2_KRO(pa)   PTE2_KERN(pa, PTE2_AP_KR,  PTE2_ATTR_NORMAL)
+#define PTE2_KRW(pa)   PTE2_KERN(pa, PTE2_AP_KRW, PTE2_TEX_DEFAULT)
+#define PTE2_KRO(pa)   PTE2_KERN(pa, PTE2_AP_KR, PTE2_TEX_DEFAULT)
 
 #define PV_STATS
 #ifdef PV_STATS
@@ -262,10 +264,6 @@ static uint32_t ttb_flags;
 static vm_memattr_t pt_memattr;
 ttb_entry_t pmap_kern_ttb;
 
-/* XXX use converion function*/
-#define PTE2_ATTR_NORMAL   VM_MEMATTR_DEFAULT
-#define PTE1_ATTR_NORMAL   ATTR_TO_L1(PTE2_ATTR_NORMAL)
-
 struct pmap kernel_pmap_store;
 LIST_HEAD(pmaplist, pmap);
 static struct pmaplist allpmaps;
@@ -399,6 +397,37 @@ static uint32_t tex_class[8] = {
 };
 #undef TEX
 
+static uint32_t tex_attr2[8] = {
+   PTE2_ATTR_WB_WA,/* 0 - VM_MEMATTR_WB_WA */
+   PTE2_ATTR_NOCACHE,  /* 1 - VM_MEMATTR_NOCACHE */
+   PTE2_ATTR_DEVICE,   /* 2 - VM_MEMATTR_DEVICE */
+   PTE2_ATTR_SO,   /* 3 - VM_MEMATTR_SO */
+   PTE2_ATTR_WT,   /* 4 - VM_MEMATTR_WRITE_THROUGH */
+   0,  /* 5 - NOT USED YET */
+   0,  /* 6 - NOT USED YET */
+   0   /* 7 - NOT USED YET */
+};
+CTASSERT(VM_MEMATTR_WB_WA == 0);
+CTASSERT(VM_MEMATTR_NOCACHE == 1);
+CTASSERT(VM_MEMATTR_DEVICE == 2);
+CTASSERT(VM_MEMATTR_SO == 3);
+CTASSERT(VM_MEMATTR_WRITE_THROUGH == 4);
+
+static inline uint32_t
+memattr_to_tex2(vm_memattr_t ma)
+{
+
+   KASSERT(ma < 5, ("%s: bad vm_memattr_t %d", __func__, ma));
+   return (tex_attr2[(u_int)ma]);
+}
+
+static inline uint32_t
+page_tex2(vm_page_t m)
+{
+
+   return (memattr_to_tex2(m->md.pat_mode));
+}
+
 /*
  * Convert TEX definition entry to TTB flags.
  */
@@ -713,7 +742,7 @@ pmap_bootstrap_prepare(vm_paddr_t last)
pt1_entry_t *pte1p;
pt2_entry_t *pte2p;
u_int i;
-   uint32_t actlr_mask, actlr_set;
+   uint32_t actlr_mask, actlr_set, l1_attr;
 
/*
 * Now, we are going to make real kernel mapping. Note that we are
@@ -776,10 +805,10 @@ pmap_bootstrap_prepare(vm_paddr_t last)
pte1_store(pte1p++, PTE1_LINK(pa));
 
/* Make section mappings for kernel. */
+   l1_attr = ATTR_TO_L1(PTE2_TEX_DEFAULT);
pte1p = kern_pte1(KERNBASE);
for (pa = KERNEL_V2P(KERNBASE); pa < last; pa += PTE1_SIZE)
-   pte1_store(pte1p++, PTE1_KERN(pa, PTE1_AP_KRW,
-   ATTR_TO_L1(PTE2_ATTR_WB_WA)));
+   pte1_store(pte1p++, PTE1_KERN(pa, PTE1_AP_KRW, l1_attr));
 
/*
 * Get free and aligned space for PT2MAP and make L1 page table links
@@ -988,13 +1017,14 @@ pmap_preboot_map_attr(vm_paddr_t pa, vm_
 vm_prot_t prot, vm_memattr_t attr)
 {
u_int num;
-   u_int l1_attr, l1_prot, l2_prot;
+   u_int l1_attr, l1_prot, l2_prot, l2_attr;
pt1_entry_t *pte1p;
pt2_entry_t *pte2p;
 
l2_prot = prot & VM_PROT_WRITE ? PTE2_AP_KRW : PTE2_AP_KR;
+   l2_attr = memattr_to_tex2(attr);
l1_prot = ATTR_TO_L1(l2_prot);
-   l1_attr = ATTR_TO_L1(attr);
+   l1_attr = ATTR_TO_L1(l2_attr);
 
/* Map all the pages. */
num = round_page(size);
@@ -1007,7 +1037,7 @@ pmap_preboot_map_attr(vm_paddr_t pa, vm_
num -= PTE1_SIZE;
} else {
pte2p = pmap_preboot_vtopte2(va);
-   pte2_store(pte2p, PTE2_KERN(pa, l2_prot, attr));
+   pte2_store(pte2p, PTE2_KERN(pa, l2_prot, l2_attr));
va += PAGE_SIZE;
pa += PAGE_SIZE;
num -= PAGE_SIZE;
@@ -1247,7 +1277,7 @@ PMAP_INLINE void
 pmap_kenter(vm_offset_t va, vm_paddr_t pa)
 {
 
-   pmap_kenter_prot_attr(va, pa, PTE2_AP_KRW, PTE2_ATTR_NORMAL);
+   pmap_kenter_prot_attr(va, pa, PTE2_AP_KRW, PTE2_TEX_DEFAULT);
 }
 
 /*
@@ -1320,7 +1350,8 @@ pmap_map(vm_offset_t *virt, vm_paddr_t s
vm_offset_t va, sva;
vm_paddr_t pte1_offset;
 

Re: svn commit: r295254 - head/sys/arm/arm

2016-02-04 Thread Michal Meloun
Yep, I'm ready to review your patch.
Allow me one question in forward.
How this patch affects JTAG based debugging of kernel? Mainly if I start
kernel under JTAG debugger, with active breakpoints (or watchpoints).

Michal

Dne 04.02.2016 v 14:41 Zbigniew Bodek napsal(a):
> Hello Michal,
> 
> I have a fix for that that I will send for review soon (I need to test
> in on some other platforms):
> https://people.freebsd.org/~zbb/arm/other/0001-Fix-debug_monitor-code-for-older-ARMs-ARM11.patch
> 
> 
> If you don't mind I will add you to the review on Phabricator.
> 
> Best regards
> zbb
> 
> 2016-02-04 14:32 GMT+01:00 Michal Meloun  >:
> 
> Author: mmel
> Date: Thu Feb  4 13:32:29 2016
> New Revision: 295254
> URL: https://svnweb.freebsd.org/changeset/base/295254
> 
> Log:
>   ARM: RPI-B kernel was broken by r294740. Make it functional again.
> 
> Modified:
>   head/sys/arm/arm/debug_monitor.c
> 
> Modified: head/sys/arm/arm/debug_monitor.c
> 
> ==
> --- head/sys/arm/arm/debug_monitor.cThu Feb  4 12:49:28 2016   
> (r295253)
> +++ head/sys/arm/arm/debug_monitor.cThu Feb  4 13:32:29 2016   
> (r295254)
> @@ -845,8 +845,10 @@ dbg_arch_supported(void)
>  {
> 
> switch (dbg_model) {
> +#ifdef not_yet
> case ID_DFR0_CP_DEBUG_M_V6:
> case ID_DFR0_CP_DEBUG_M_V6_1:
> +#endif
> case ID_DFR0_CP_DEBUG_M_V7:
> case ID_DFR0_CP_DEBUG_M_V7_1:   /* fall through */
> return (TRUE);
> ___
> svn-src-...@freebsd.org  mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to
> "svn-src-all-unsubscr...@freebsd.org
> "
> 
> 

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295254 - head/sys/arm/arm

2016-02-04 Thread Michal Meloun
Author: mmel
Date: Thu Feb  4 13:32:29 2016
New Revision: 295254
URL: https://svnweb.freebsd.org/changeset/base/295254

Log:
  ARM: RPI-B kernel was broken by r294740. Make it functional again.

Modified:
  head/sys/arm/arm/debug_monitor.c

Modified: head/sys/arm/arm/debug_monitor.c
==
--- head/sys/arm/arm/debug_monitor.cThu Feb  4 12:49:28 2016
(r295253)
+++ head/sys/arm/arm/debug_monitor.cThu Feb  4 13:32:29 2016
(r295254)
@@ -845,8 +845,10 @@ dbg_arch_supported(void)
 {
 
switch (dbg_model) {
+#ifdef not_yet
case ID_DFR0_CP_DEBUG_M_V6:
case ID_DFR0_CP_DEBUG_M_V6_1:
+#endif
case ID_DFR0_CP_DEBUG_M_V7:
case ID_DFR0_CP_DEBUG_M_V7_1:   /* fall through */
return (TRUE);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295259 - head/sys/arm/arm

2016-02-04 Thread Michal Meloun
Author: mmel
Date: Thu Feb  4 14:32:48 2016
New Revision: 295259
URL: https://svnweb.freebsd.org/changeset/base/295259

Log:
  ARM: For ARMv6/v7, code in locore.S initializes SCTLR and ACTRL registers.
  Don't duplicate this initialization in cpu_setup().

Modified:
  head/sys/arm/arm/cpufunc.c

Modified: head/sys/arm/arm/cpufunc.c
==
--- head/sys/arm/arm/cpufunc.c  Thu Feb  4 14:30:46 2016(r295258)
+++ head/sys/arm/arm/cpufunc.c  Thu Feb  4 14:32:48 2016(r295259)
@@ -966,47 +966,12 @@ cpu_scc_setup_ccnt(void)
 void
 arm11x6_setup(void)
 {
-   int cpuctrl, cpuctrl_wax;
uint32_t auxctrl, auxctrl_wax;
uint32_t tmp, tmp2;
-   uint32_t sbz=0;
uint32_t cpuid;
 
cpuid = cpu_ident();
 
-   cpuctrl =
-   CPU_CONTROL_MMU_ENABLE  |
-   CPU_CONTROL_DC_ENABLE   |
-   CPU_CONTROL_WBUF_ENABLE |
-   CPU_CONTROL_32BP_ENABLE |
-   CPU_CONTROL_32BD_ENABLE |
-   CPU_CONTROL_LABT_ENABLE |
-   CPU_CONTROL_SYST_ENABLE |
-   CPU_CONTROL_IC_ENABLE   |
-   CPU_CONTROL_UNAL_ENABLE;
-
-   /*
-* "write as existing" bits
-* inverse of this is mask
-*/
-   cpuctrl_wax =
-   (3 << 30) | /* SBZ */
-   (1 << 29) | /* FA */
-   (1 << 28) | /* TR */
-   (3 << 26) | /* SBZ */
-   (3 << 19) | /* SBZ */
-   (1 << 17);  /* SBZ */
-
-   cpuctrl |= CPU_CONTROL_BPRD_ENABLE;
-   cpuctrl |= CPU_CONTROL_V6_EXTPAGE;
-
-#ifdef __ARMEB__
-   cpuctrl |= CPU_CONTROL_BEND_ENABLE;
-#endif
-
-   if (vector_page == ARM_VECTORS_HIGH)
-   cpuctrl |= CPU_CONTROL_VECRELOC;
-
auxctrl = 0;
auxctrl_wax = ~0;
 
@@ -1018,18 +983,6 @@ arm11x6_setup(void)
auxctrl_wax = ~ARM1176_AUXCTL_PHD;
}
 
-   /* Clear out the cache */
-   cpu_idcache_wbinv_all();
-
-   /* Now really make sure they are clean.  */
-   __asm volatile ("mcr\tp15, 0, %0, c7, c7, 0" : : "r"(sbz));
-
-   /* Allow detection code to find the VFP if it's fitted.  */
-   cp15_cpacr_set(0x0fff);
-
-   /* Set the control register */
-   cpu_control(~cpuctrl_wax, cpuctrl);
-
tmp = cp15_actlr_get();
tmp2 = tmp;
tmp &= auxctrl_wax;
@@ -1037,9 +990,6 @@ arm11x6_setup(void)
if (tmp != tmp2)
cp15_actlr_set(tmp);
 
-   /* And again. */
-   cpu_idcache_wbinv_all();
-
cpu_scc_setup_ccnt();
 }
 #endif  /* CPU_ARM1176 */
@@ -1048,32 +998,8 @@ arm11x6_setup(void)
 void
 pj4bv7_setup(void)
 {
-   int cpuctrl;
 
pj4b_config();
-
-   cpuctrl = CPU_CONTROL_MMU_ENABLE;
-#ifndef ARM32_DISABLE_ALIGNMENT_FAULTS
-   cpuctrl |= CPU_CONTROL_AFLT_ENABLE;
-#endif
-   cpuctrl |= CPU_CONTROL_DC_ENABLE;
-   cpuctrl |= (0xf << 3);
-   cpuctrl |= CPU_CONTROL_BPRD_ENABLE;
-   cpuctrl |= CPU_CONTROL_IC_ENABLE;
-   if (vector_page == ARM_VECTORS_HIGH)
-   cpuctrl |= CPU_CONTROL_VECRELOC;
-   cpuctrl |= (0x5 << 16) | (1 < 22);
-   cpuctrl |= CPU_CONTROL_V6_EXTPAGE;
-
-   /* Clear out the cache */
-   cpu_idcache_wbinv_all();
-
-   /* Set the control register */
-   cpu_control(0x, cpuctrl);
-
-   /* And again. */
-   cpu_idcache_wbinv_all();
-
cpu_scc_setup_ccnt();
 }
 #endif /* CPU_MV_PJ4B */
@@ -1083,44 +1009,6 @@ pj4bv7_setup(void)
 void
 cortexa_setup(void)
 {
-   int cpuctrl, cpuctrlmask;
-
-   cpuctrlmask = CPU_CONTROL_MMU_ENABLE | /* MMU enable [0] */
-   CPU_CONTROL_AFLT_ENABLE |/* Alignment fault[1] */
-   CPU_CONTROL_DC_ENABLE |  /* DCache enable  [2] */
-   CPU_CONTROL_BPRD_ENABLE |/* Branch prediction [11] */
-   CPU_CONTROL_IC_ENABLE |  /* ICache enable [12] */
-   CPU_CONTROL_VECRELOC;/* Vector relocation [13] */
-
-   cpuctrl = CPU_CONTROL_MMU_ENABLE |
-   CPU_CONTROL_IC_ENABLE |
-   CPU_CONTROL_DC_ENABLE |
-   CPU_CONTROL_BPRD_ENABLE;
-
-#ifndef ARM32_DISABLE_ALIGNMENT_FAULTS
-   cpuctrl |= CPU_CONTROL_AFLT_ENABLE;
-#endif
-
-   /* Switch to big endian */
-#ifdef __ARMEB__
-   cpuctrl |= CPU_CONTROL_BEND_ENABLE;
-#endif
-
-   /* Check if the vector page is at the high address (0x) */
-   if (vector_page == ARM_VECTORS_HIGH)
-   cpuctrl |= CPU_CONTROL_VECRELOC;
-
-   /* Clear out the cache */
-   cpu_idcache_wbinv_all();
-
-   /* Set the control register */
-   cpu_control(cpuctrlmask, cpuctrl);
-
-   /* And again. */
-   cpu_idcache_wbinv_all();
-#if defined(SMP) && !defined(ARM_NEW_PMAP)
-   armv7_auxctrl((1 << 6) | (1 << 0), (1 << 6) | (1 << 0)); /* Enable SMP 
+ TLB broadcasting  */
-#endif
 
cpu_scc_setup_ccnt();
 }

svn commit: r295255 - head/sys/arm/arm

2016-02-04 Thread Svatopluk Kraus
Author: skra
Date: Thu Feb  4 13:35:40 2016
New Revision: 295255
URL: https://svnweb.freebsd.org/changeset/base/295255

Log:
  Small rearrangement of abort_handler().
  
  (1) Move cnt.v_trap increment to the beginning. There is cnt.v_vm_faults
  counter in vm_fault(), so a number of hardware emulation aborts may be
  get roughly as difference.
  (2) Move kdb_reenter() up to not be ignored if pmap_fault() has failed.
  (3) Update comments.

Modified:
  head/sys/arm/arm/trap-v6.c

Modified: head/sys/arm/arm/trap-v6.c
==
--- head/sys/arm/arm/trap-v6.c  Thu Feb  4 13:32:29 2016(r295254)
+++ head/sys/arm/arm/trap-v6.c  Thu Feb  4 13:35:40 2016(r295255)
@@ -293,7 +293,10 @@ abort_handler(struct trapframe *tf, int 
 #ifdef INVARIANTS
void *onfault;
 #endif
+
+   PCPU_INC(cnt.v_trap);
td = curthread;
+
fsr = (prefetch) ? cp15_ifsr_get(): cp15_dfsr_get();
 #if __ARM_ARCH >= 7
far = (prefetch) ? cp15_ifar_get() : cp15_dfar_get();
@@ -334,24 +337,23 @@ abort_handler(struct trapframe *tf, int 
 * they are not from KVA space. Thus, no action is needed here.
 */
 
+   /*
+* (1) Handle access and R/W hardware emulation aborts.
+* (2) Check that abort is not on pmap essential address ranges.
+* There is no way how to fix it, so we don't even try.
+*/
rv = pmap_fault(PCPU_GET(curpmap), far, fsr, idx, usermode);
if (rv == KERN_SUCCESS)
return;
-   if (rv == KERN_INVALID_ADDRESS)
-   goto nogo;
-   /*
-* Now, when we handled imprecise and debug aborts, the rest of
-* aborts should be really related to mapping.
-*/
-
-   PCPU_INC(cnt.v_trap);
-
 #ifdef KDB
if (kdb_active) {
kdb_reenter();
goto out;
}
 #endif
+   if (rv == KERN_INVALID_ADDRESS)
+   goto nogo;
+
if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) {
/*
 * Due to both processor errata and lazy TLB invalidation when
@@ -418,6 +420,14 @@ abort_handler(struct trapframe *tf, int 
}
 
/*
+* At this point, we're dealing with one of the following aborts:
+*
+*  FAULT_ICACHE   - I-cache maintenance
+*  FAULT_TRAN_xx  - Translation
+*  FAULT_PERM_xx  - Permission
+*/
+
+   /*
 * Don't pass faulting cache operation to vm_fault(). We don't want
 * to handle all vm stuff at this moment.
 */
@@ -435,16 +445,6 @@ abort_handler(struct trapframe *tf, int 
goto out;
}
 
-   /*
-* At this point, we're dealing with one of the following aborts:
-*
-*  FAULT_TRAN_xx  - Translation
-*  FAULT_PERM_xx  - Permission
-*
-* These are the main virtual memory-related faults signalled by
-* the MMU.
-*/
-
/* fusubailout is used by [fs]uswintr to avoid page faulting. */
if (__predict_false(pcb->pcb_onfault == fusubailout)) {
tf->tf_r0 = EFAULT;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295303 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:31:31 2016
New Revision: 295303
URL: https://svnweb.freebsd.org/changeset/base/295303

Log:
  hyperv/hn: Recover half of the chimney sending space
  
  We lost half of the chimney sending space, because we mis-used
  ffs() on a 64 bits mask, where ffsl() should be used.
  
  While I'm here:
  - Use system atomic operation instead.
  - Stringent chimney sending index assertion.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5159

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Feb  5 05:25:11 2016
(r295302)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Feb  5 05:31:31 2016
(r295303)
@@ -136,15 +136,15 @@ hv_nv_get_next_send_section(netvsc_dev *
int i;
 
for (i = 0; i < bitsmap_words; i++) {
-   idx = ffs(~bitsmap[i]);
+   idx = ffsl(~bitsmap[i]);
if (0 == idx)
continue;
 
idx--;
-   if (i * BITS_PER_LONG + idx >= net_dev->send_section_count)
-   return (ret);
+   KASSERT(i * BITS_PER_LONG + idx < net_dev->send_section_count,
+   ("invalid i %d and idx %lu", i, idx));
 
-   if (synch_test_and_set_bit(idx, [i]))
+   if (atomic_testandset_long([i], idx))
continue;
 
ret = i * BITS_PER_LONG + idx;
@@ -789,8 +789,27 @@ hv_nv_on_send_completion(netvsc_dev *net
if (NULL != net_vsc_pkt) {
if (net_vsc_pkt->send_buf_section_idx !=
NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) {
-   
synch_change_bit(net_vsc_pkt->send_buf_section_idx,
-   net_dev->send_section_bitsmap);
+   u_long mask;
+   int idx;
+
+   idx = net_vsc_pkt->send_buf_section_idx /
+   BITS_PER_LONG;
+   KASSERT(idx < net_dev->bitsmap_words,
+   ("invalid section index %u",
+net_vsc_pkt->send_buf_section_idx));
+   mask = 1UL <<
+   (net_vsc_pkt->send_buf_section_idx %
+BITS_PER_LONG);
+
+   KASSERT(net_dev->send_section_bitsmap[idx] &
+   mask,
+   ("index bitmap 0x%lx, section index %u, "
+"bitmap idx %d, bitmask 0x%lx",
+net_dev->send_section_bitsmap[idx],
+net_vsc_pkt->send_buf_section_idx,
+idx, mask));
+   atomic_clear_long(
+   _dev->send_section_bitsmap[idx], mask);
}

/* Notify the layer above us */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295296 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 04:03:50 2016
New Revision: 295296
URL: https://svnweb.freebsd.org/changeset/base/295296

Log:
  hyperv/hn: Avoid duplicate csum features settings
  
  - Record csum features in softc, so we don't need to duplicate the
logic from attach path to ioctl path.
  - Protect if_capenable and if_hwassist changes by main lock.
  - Prefer turn on/off bits in if_hwassist explicitly instead of using
XOR.
  
  Reviewed by:  adrian, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5085

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 03:46:53 2016
(r295295)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 04:03:50 2016
(r295296)
@@ -1043,6 +1043,8 @@ typedef struct hn_softc {
u_long  hn_txdma_failed;
u_long  hn_tx_collapsed;
u_long  hn_tx_chimney;
+
+   uint64_thn_csum_assist;
 } hn_softc_t;
 
 

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 03:46:53 
2016(r295295)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 04:03:50 
2016(r295296)
@@ -176,6 +176,14 @@ struct hn_txdesc {
 CSUM_IP_ISCSI|CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP| \
 CSUM_IP6_TSO|CSUM_IP6_ISCSI)
 
+/*
+ * Only enable UDP checksum offloading when it is on 2012R2 or
+ * later.  UDP checksum offloading doesn't work on earlier
+ * Windows releases.
+ */
+#define HN_CSUM_ASSIST_WIN8(CSUM_TCP)
+#define HN_CSUM_ASSIST (CSUM_UDP | CSUM_TCP)
+
 /* XXX move to netinet/tcp_lro.h */
 #define HN_LRO_HIWAT_MAX   65535
 #define HN_LRO_HIWAT_DEF   HN_LRO_HIWAT_MAX
@@ -444,15 +452,12 @@ netvsc_attach(device_t dev)
ifp->if_capenable |=
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO |
IFCAP_LRO;
-   /*
-* Only enable UDP checksum offloading when it is on 2012R2 or
-* later. UDP checksum offloading doesn't work on earlier
-* Windows releases.
-*/
+
if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1)
-   ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO;
+   sc->hn_csum_assist = HN_CSUM_ASSIST;
else
-   ifp->if_hwassist = CSUM_TCP | CSUM_TSO;
+   sc->hn_csum_assist = HN_CSUM_ASSIST_WIN8;
+   ifp->if_hwassist = sc->hn_csum_assist | CSUM_TSO;
 
error = hv_rf_on_device_add(device_ctx, _info);
if (error)
@@ -1506,47 +1511,40 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
error = 0;
break;
case SIOCSIFCAP:
+   NV_LOCK(sc);
+
mask = ifr->ifr_reqcap ^ ifp->if_capenable;
if (mask & IFCAP_TXCSUM) {
-   if (IFCAP_TXCSUM & ifp->if_capenable) {
-   ifp->if_capenable &= ~IFCAP_TXCSUM;
-   ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP);
-   } else {
-   ifp->if_capenable |= IFCAP_TXCSUM;
-   /*
-* Only enable UDP checksum offloading on
-* Windows Server 2012R2 or later releases.
-*/
-   if (hv_vmbus_protocal_version >=
-   HV_VMBUS_VERSION_WIN8_1) {
-   ifp->if_hwassist |=
-   (CSUM_TCP | CSUM_UDP);
-   } else {
-   ifp->if_hwassist |= CSUM_TCP;
-   }
-   }
+   ifp->if_capenable ^= IFCAP_TXCSUM;
+   if (ifp->if_capenable & IFCAP_TXCSUM)
+   ifp->if_hwassist |= sc->hn_csum_assist;
+   else
+   ifp->if_hwassist &= ~sc->hn_csum_assist;
}
 
-   if (mask & IFCAP_RXCSUM) {
-   if (IFCAP_RXCSUM & ifp->if_capenable) {
-   ifp->if_capenable &= ~IFCAP_RXCSUM;
-   } else {
-   ifp->if_capenable |= IFCAP_RXCSUM;
-   }
-   }
+   if (mask & IFCAP_RXCSUM)
+   ifp->if_capenable ^= IFCAP_RXCSUM;
+
if 

svn commit: r295297 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 04:10:04 2016
New Revision: 295297
URL: https://svnweb.freebsd.org/changeset/base/295297

Log:
  hyperv/hn: Reorganize TX csum offloading
  
  - For non-TSO offloading, we don't need to access mbuf to know
which csum offloading is requested, we can just use the
CSUM_{IP,TCP,UDP} in the csum_flags.
  - For TSO offloading, we still can depend on CSUM_{TSO4,TSO6}
in the csum_flags to tell whether the TSO packet is an IPv4
TSO packet or an IPv6 TSO packet.
  
  This streamlines csum offloading handling (remove the two goto)
  and allows us the nuke the unnecessary get_transport_proto_type().
  
  Reviewed by:  adrian, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5098

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 04:03:50 2016
(r295296)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 04:10:04 2016
(r295297)
@@ -1015,6 +1015,7 @@ typedef struct hn_softc {
bus_dma_tag_t   hn_tx_rndis_dtag;
int hn_tx_chimney_size;
int hn_tx_chimney_max;
+   uint64_thn_csum_assist;
 
struct mtx  hn_txlist_spin;
struct hn_txdesc_list hn_txlist;
@@ -1043,8 +1044,6 @@ typedef struct hn_softc {
u_long  hn_txdma_failed;
u_long  hn_tx_collapsed;
u_long  hn_tx_chimney;
-
-   uint64_thn_csum_assist;
 } hn_softc_t;
 
 

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 04:03:50 
2016(r295296)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 04:10:04 
2016(r295297)
@@ -167,16 +167,6 @@ struct hn_txdesc {
 #define HN_TXD_FLAG_DMAMAP 0x2
 
 /*
- * A unified flag for all outbound check sum flags is useful,
- * and it helps avoiding unnecessary check sum calculation in
- * network forwarding scenario.
- */
-#define HV_CSUM_FOR_OUTBOUND   \
-(CSUM_IP|CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP|CSUM_IP_TSO| \
-CSUM_IP_ISCSI|CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP| \
-CSUM_IP6_TSO|CSUM_IP6_ISCSI)
-
-/*
  * Only enable UDP checksum offloading when it is on 2012R2 or
  * later.  UDP checksum offloading doesn't work on earlier
  * Windows releases.
@@ -265,62 +255,6 @@ hn_set_lro_hiwat(struct hn_softc *sc, in
 #endif
 }
 
-/*
- * NetVsc get message transport protocol type 
- */
-static uint32_t get_transport_proto_type(struct mbuf *m_head)
-{
-   uint32_t ret_val = TRANSPORT_TYPE_NOT_IP;
-   uint16_t ether_type = 0;
-   int ether_len = 0;
-   struct ether_vlan_header *eh;
-#ifdef INET
-   struct ip *iph;
-#endif
-#ifdef INET6
-   struct ip6_hdr *ip6;
-#endif
-
-   eh = mtod(m_head, struct ether_vlan_header*);
-   if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) {
-   ether_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
-   ether_type = eh->evl_proto;
-   } else {
-   ether_len = ETHER_HDR_LEN;
-   ether_type = eh->evl_encap_proto;
-   }
-
-   switch (ntohs(ether_type)) {
-#ifdef INET6
-   case ETHERTYPE_IPV6:
-   ip6 = (struct ip6_hdr *)(m_head->m_data + ether_len);
-
-   if (IPPROTO_TCP == ip6->ip6_nxt) {
-   ret_val = TRANSPORT_TYPE_IPV6_TCP;
-   } else if (IPPROTO_UDP == ip6->ip6_nxt) {
-   ret_val = TRANSPORT_TYPE_IPV6_UDP;
-   }
-   break;
-#endif
-#ifdef INET
-   case ETHERTYPE_IP:
-   iph = (struct ip *)(m_head->m_data + ether_len);
-
-   if (IPPROTO_TCP == iph->ip_p) {
-   ret_val = TRANSPORT_TYPE_IPV4_TCP;
-   } else if (IPPROTO_UDP == iph->ip_p) {
-   ret_val = TRANSPORT_TYPE_IPV4_UDP;
-   }
-   break;
-#endif
-   default:
-   ret_val = TRANSPORT_TYPE_NOT_IP;
-   break;
-   }
-
-   return (ret_val);
-}
-
 static int
 hn_ifmedia_upd(struct ifnet *ifp __unused)
 {
@@ -783,16 +717,13 @@ hn_start_locked(struct ifnet *ifp, int l
hn_softc_t *sc = ifp->if_softc;
struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev);
netvsc_dev *net_dev = sc->net_dev;
-   struct ether_vlan_header *eh;
rndis_msg *rndis_mesg;
rndis_packet *rndis_pkt;
rndis_per_packet_info *rppi;
ndis_8021q_info *rppi_vlan_info;
rndis_tcp_ip_csum_info 

Re: svn commit: r295302 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Oh, thanks, will fix it :)

On Fri, Feb 5, 2016 at 1:34 PM, Andriy Voskoboinyk  wrote:
> Fri, 05 Feb 2016 07:25:11 +0200 було написано Sepherosa Ziehau
> :
>
>> Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
>>
>> ==
>> ...
>> @@ -744,31 +745,235 @@ netvsc_channel_rollup(struct hv_device *
>>  }
>> /*
>> - * Start a transmit of one or more packets
>> + * NOTE:
>> + * This this function fails, then both txd and m_head0 will be freed
>
>
> Probably "If this function fails.." ?
>
>
>>   */
>>  static int
>> -hn_start_locked(struct ifnet *ifp, int len)
>> +hn_encap(struct hn_softc *sc, struct hn_txdesc *txd, struct mbuf
>> **m_head0)
>>  {



-- 
Tomorrow Will Never Die
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r295295 - head/sys/dev/hyperv/storvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 03:46:53 2016
New Revision: 295295
URL: https://svnweb.freebsd.org/changeset/base/295295

Log:
  hyperv/stor: Fix the NULL pointer dereference
  
  Reported by:  Netapp
  Submitted by: Hongjiang Zhang 
  Reviewed by:  adrian, sephe, Dexuan Cui 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5097

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Feb  5 
03:20:27 2016(r295294)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cFri Feb  5 
03:46:53 2016(r295295)
@@ -1524,13 +1524,12 @@ static void
 storvsc_destroy_bounce_buffer(struct sglist *sgl)
 {
struct hv_sgl_node *sgl_node = NULL;
-
-   sgl_node = LIST_FIRST(_hv_sgl_page_pool.in_use_sgl_list);
-   LIST_REMOVE(sgl_node, link);
-   if (NULL == sgl_node) {
+   if (LIST_EMPTY(_hv_sgl_page_pool.in_use_sgl_list)) {
printf("storvsc error: not enough in use sgl\n");
return;
}
+   sgl_node = LIST_FIRST(_hv_sgl_page_pool.in_use_sgl_list);
+   LIST_REMOVE(sgl_node, link);
sgl_node->sgl_data = sgl;
LIST_INSERT_HEAD(_hv_sgl_page_pool.free_sgl_list, sgl_node, link);
 }
@@ -1556,12 +1555,12 @@ storvsc_create_bounce_buffer(uint16_t se
struct hv_sgl_node *sgl_node = NULL;
 
/* get struct sglist from free_sgl_list */
-   sgl_node = LIST_FIRST(_hv_sgl_page_pool.free_sgl_list);
-   LIST_REMOVE(sgl_node, link);
-   if (NULL == sgl_node) {
+   if (LIST_EMPTY(_hv_sgl_page_pool.free_sgl_list)) {
printf("storvsc error: not enough free sgl\n");
return NULL;
}
+   sgl_node = LIST_FIRST(_hv_sgl_page_pool.free_sgl_list);
+   LIST_REMOVE(sgl_node, link);
bounce_sgl = sgl_node->sgl_data;
LIST_INSERT_HEAD(_hv_sgl_page_pool.in_use_sgl_list, sgl_node, link);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295298 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:01:02 2016
New Revision: 295298
URL: https://svnweb.freebsd.org/changeset/base/295298

Log:
  hyperv/hn: Enable IP header checksum offloading
  
  So that:
  - TCP/IP stack will not do unnecessary IP header checksum for TSO
packets.
  - Reduce guest load for non-TSO IP packets.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5099

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 04:10:04 
2016(r295297)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:01:02 
2016(r295298)
@@ -172,7 +172,7 @@ struct hn_txdesc {
  * Windows releases.
  */
 #define HN_CSUM_ASSIST_WIN8(CSUM_TCP)
-#define HN_CSUM_ASSIST (CSUM_UDP | CSUM_TCP)
+#define HN_CSUM_ASSIST (CSUM_IP | CSUM_UDP | CSUM_TCP)
 
 /* XXX move to netinet/tcp_lro.h */
 #define HN_LRO_HIWAT_MAX   65535
@@ -867,6 +867,9 @@ hn_start_locked(struct ifnet *ifp, int l
rppi->per_packet_info_offset);
 
csum_info->xmit.is_ipv4 = 1;
+   if (m_head->m_pkthdr.csum_flags & CSUM_IP)
+   csum_info->xmit.ip_header_csum = 1;
+
if (m_head->m_pkthdr.csum_flags & CSUM_TCP) {
csum_info->xmit.tcp_csum = 1;
csum_info->xmit.tcp_header_offset = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295300 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:12:30 2016
New Revision: 295300
URL: https://svnweb.freebsd.org/changeset/base/295300

Log:
  hyperv/hn: Add sysctls to trust host side UDP and IP csum verification
  
  Reviewed by:  adrian, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5103

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 05:06:14 2016
(r295299)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 05:12:30 2016
(r295300)
@@ -1031,8 +1031,8 @@ typedef struct hn_softc {
struct lro_ctrl hn_lro;
int hn_lro_hiwat;
 
-   /* Trust tcp segments verification on host side */
-   int hn_trust_hosttcp;
+   /* Trust csum verification on host side */
+   int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */
 
u_long  hn_csum_ip;
u_long  hn_csum_tcp;
@@ -1047,6 +1047,9 @@ typedef struct hn_softc {
u_long  hn_tx_chimney;
 } hn_softc_t;
 
+#define HN_TRUST_HCSUM_IP  0x0001
+#define HN_TRUST_HCSUM_TCP 0x0002
+#define HN_TRUST_HCSUM_UDP 0x0004
 
 /*
  * Externs

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:06:14 
2016(r295299)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:12:30 
2016(r295300)
@@ -210,6 +210,14 @@ int hv_promisc_mode = 0;/* normal mo
 static int hn_trust_hosttcp = 1;
 TUNABLE_INT("dev.hn.trust_hosttcp", _trust_hosttcp);
 
+/* Trust udp datagrams verification on host side. */
+static int hn_trust_hostudp = 1;
+TUNABLE_INT("dev.hn.trust_hostudp", _trust_hostudp);
+
+/* Trust ip packets verification on host side. */
+static int hn_trust_hostip = 1;
+TUNABLE_INT("dev.hn.trust_hostip", _trust_hostip);
+
 #if __FreeBSD_version >= 1100045
 /* Limit TSO burst size */
 static int hn_tso_maxlen = 0;
@@ -239,6 +247,7 @@ static void hn_ifmedia_sts(struct ifnet 
 #ifdef HN_LRO_HIWAT
 static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS);
 #endif
+static int hn_trust_hcsum_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_tx_chimney_size_sysctl(SYSCTL_HANDLER_ARGS);
 static int hn_check_iplen(const struct mbuf *, int);
 static int hn_create_tx_ring(struct hn_softc *sc);
@@ -335,8 +344,13 @@ netvsc_attach(device_t dev)
sc->hn_unit = unit;
sc->hn_dev = dev;
sc->hn_lro_hiwat = HN_LRO_HIWAT_DEF;
-   sc->hn_trust_hosttcp = hn_trust_hosttcp;
sc->hn_direct_tx_size = hn_direct_tx_size;
+   if (hn_trust_hosttcp)
+   sc->hn_trust_hcsum |= HN_TRUST_HCSUM_TCP;
+   if (hn_trust_hostudp)
+   sc->hn_trust_hcsum |= HN_TRUST_HCSUM_UDP;
+   if (hn_trust_hostip)
+   sc->hn_trust_hcsum |= HN_TRUST_HCSUM_IP;
 
sc->hn_tx_taskq = taskqueue_create_fast("hn_tx", M_WAITOK,
taskqueue_thread_enqueue, >hn_tx_taskq);
@@ -448,10 +462,21 @@ netvsc_attach(device_t dev)
CTLTYPE_INT | CTLFLAG_RW, sc, 0, hn_lro_hiwat_sysctl,
"I", "LRO high watermark");
 #endif
-   SYSCTL_ADD_INT(ctx, child, OID_AUTO, "trust_hosttcp",
-   CTLFLAG_RW, >hn_trust_hosttcp, 0,
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "trust_hosttcp",
+   CTLTYPE_INT | CTLFLAG_RW, sc, HN_TRUST_HCSUM_TCP,
+   hn_trust_hcsum_sysctl, "I",
"Trust tcp segement verification on host side, "
"when csum info is missing");
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "trust_hostudp",
+   CTLTYPE_INT | CTLFLAG_RW, sc, HN_TRUST_HCSUM_UDP,
+   hn_trust_hcsum_sysctl, "I",
+   "Trust udp datagram verification on host side, "
+   "when csum info is missing");
+   SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "trust_hostip",
+   CTLTYPE_INT | CTLFLAG_RW, sc, HN_TRUST_HCSUM_IP,
+   hn_trust_hcsum_sysctl, "I",
+   "Trust ip packet verification on host side, "
+   "when csum info is missing");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_ip",
CTLFLAG_RW, >hn_csum_ip, "RXCSUM IP");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_tcp",
@@ -460,7 +485,7 @@ netvsc_attach(device_t dev)
CTLFLAG_RW, >hn_csum_udp, "RXCSUM UDP");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_trusted",
CTLFLAG_RW, >hn_csum_trusted,
-   "# of TCP segements that we trust host's csum verification");
+   "# of packets that we trust host's csum verification");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "small_pkts",
CTLFLAG_RW, 

svn commit: r295302 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:25:11 2016
New Revision: 295302
URL: https://svnweb.freebsd.org/changeset/base/295302

Log:
  hyperv/hn: Factor out hn_encap() from hn_start_locked()
  
  It will be shared w/ upcoming ifnet.if_transmit implementaion.
  
  No functional changes.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5158

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:17:48 
2016(r295301)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:25:11 
2016(r295302)
@@ -254,6 +254,7 @@ static int hn_create_tx_ring(struct hn_s
 static void hn_destroy_tx_ring(struct hn_softc *sc);
 static void hn_start_taskfunc(void *xsc, int pending);
 static void hn_txeof_taskfunc(void *xsc, int pending);
+static int hn_encap(struct hn_softc *, struct hn_txdesc *, struct mbuf **);
 
 static __inline void
 hn_set_lro_hiwat(struct hn_softc *sc, int hiwat)
@@ -744,31 +745,235 @@ netvsc_channel_rollup(struct hv_device *
 }
 
 /*
- * Start a transmit of one or more packets
+ * NOTE:
+ * This this function fails, then both txd and m_head0 will be freed
  */
 static int
-hn_start_locked(struct ifnet *ifp, int len)
+hn_encap(struct hn_softc *sc, struct hn_txdesc *txd, struct mbuf **m_head0)
 {
-   hn_softc_t *sc = ifp->if_softc;
-   struct hv_device *device_ctx = vmbus_get_devctx(sc->hn_dev);
-   netvsc_dev *net_dev = sc->net_dev;
+   bus_dma_segment_t segs[HN_TX_DATA_SEGCNT_MAX];
+   int error, nsegs, i;
+   struct mbuf *m_head = *m_head0;
+   netvsc_packet *packet;
rndis_msg *rndis_mesg;
rndis_packet *rndis_pkt;
rndis_per_packet_info *rppi;
-   ndis_8021q_info *rppi_vlan_info;
-   rndis_tcp_ip_csum_info *csum_info;
-   rndis_tcp_tso_info *tso_info;   
-   uint32_t rndis_msg_size = 0;
+   uint32_t rndis_msg_size;
+
+   packet = >netvsc_pkt;
+   packet->is_data_pkt = TRUE;
+   packet->tot_data_buf_len = m_head->m_pkthdr.len;
+
+   /*
+* extension points to the area reserved for the
+* rndis_filter_packet, which is placed just after
+* the netvsc_packet (and rppi struct, if present;
+* length is updated later).
+*/
+   rndis_mesg = txd->rndis_msg;
+   /* XXX not necessary */
+   memset(rndis_mesg, 0, HN_RNDIS_MSG_LEN);
+   rndis_mesg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG;
+
+   rndis_pkt = _mesg->msg.packet;
+   rndis_pkt->data_offset = sizeof(rndis_packet);
+   rndis_pkt->data_length = packet->tot_data_buf_len;
+   rndis_pkt->per_pkt_info_offset = sizeof(rndis_packet);
+
+   rndis_msg_size = RNDIS_MESSAGE_SIZE(rndis_packet);
+
+   if (m_head->m_flags & M_VLANTAG) {
+   ndis_8021q_info *rppi_vlan_info;
+
+   rndis_msg_size += RNDIS_VLAN_PPI_SIZE;
+   rppi = hv_set_rppi_data(rndis_mesg, RNDIS_VLAN_PPI_SIZE,
+   ieee_8021q_info);
+
+   rppi_vlan_info = (ndis_8021q_info *)((uint8_t *)rppi +
+   rppi->per_packet_info_offset);
+   rppi_vlan_info->u1.s1.vlan_id =
+   m_head->m_pkthdr.ether_vtag & 0xfff;
+   }
+
+   if (m_head->m_pkthdr.csum_flags & CSUM_TSO) {
+   rndis_tcp_tso_info *tso_info;   
+   struct ether_vlan_header *eh;
+   int ether_len;
+
+   /*
+* XXX need m_pullup and use mtodo
+*/
+   eh = mtod(m_head, struct ether_vlan_header*);
+   if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN))
+   ether_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN;
+   else
+   ether_len = ETHER_HDR_LEN;
+
+   rndis_msg_size += RNDIS_TSO_PPI_SIZE;
+   rppi = hv_set_rppi_data(rndis_mesg, RNDIS_TSO_PPI_SIZE,
+   tcp_large_send_info);
+
+   tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi +
+   rppi->per_packet_info_offset);
+   tso_info->lso_v2_xmit.type =
+   RNDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE;
+
+#ifdef INET
+   if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) {
+   struct ip *ip =
+   (struct ip *)(m_head->m_data + ether_len);
+   unsigned long iph_len = ip->ip_hl << 2;
+   struct tcphdr *th =
+   (struct tcphdr *)((caddr_t)ip + iph_len);
+
+   tso_info->lso_v2_xmit.ip_version =
+   RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV4;
+   ip->ip_len = 0;
+  

Re: svn commit: r295302 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Andriy Voskoboinyk
Fri, 05 Feb 2016 07:25:11 +0200 було написано Sepherosa Ziehau  
:



Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
...
@@ -744,31 +745,235 @@ netvsc_channel_rollup(struct hv_device *
 }
/*
- * Start a transmit of one or more packets
+ * NOTE:
+ * This this function fails, then both txd and m_head0 will be freed


Probably "If this function fails.." ?


  */
 static int
-hn_start_locked(struct ifnet *ifp, int len)
+hn_encap(struct hn_softc *sc, struct hn_txdesc *txd, struct mbuf  
**m_head0)

 {

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

svn commit: r295304 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:38:01 2016
New Revision: 295304
URL: https://svnweb.freebsd.org/changeset/base/295304

Log:
  hyperv/hn: Increase LRO entry count to 128 by default
  
  hn(4) only has one RX ring currently, so default 8 LRO entries
  are too small.
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5166

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:31:31 
2016(r295303)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:38:01 
2016(r295304)
@@ -132,6 +132,8 @@ __FBSDID("$FreeBSD$");
 /* YYY should get it from the underlying channel */
 #define HN_TX_DESC_CNT 512
 
+#define HN_LROENT_CNT_DEF  128
+
 #define HN_RNDIS_MSG_LEN   \
 (sizeof(rndis_msg) +   \
  RNDIS_VLAN_PPI_SIZE + \
@@ -232,6 +234,13 @@ TUNABLE_INT("dev.hn.tx_chimney_size", 
 static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF;
 TUNABLE_INT("dev.hn.direct_tx_size", _direct_tx_size);
 
+#if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+static int hn_lro_entry_count = HN_LROENT_CNT_DEF;
+TUNABLE_INT("dev.hn.lro_entry_count", _lro_entry_count);
+#endif
+#endif
+
 /*
  * Forward declarations
  */
@@ -335,6 +344,11 @@ netvsc_attach(device_t dev)
 #if __FreeBSD_version >= 1100045
int tso_maxlen;
 #endif
+#if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+   int lroent_cnt;
+#endif
+#endif
 
sc = device_get_softc(dev);
if (sc == NULL) {
@@ -417,9 +431,17 @@ netvsc_attach(device_t dev)
}
 
 #if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+   lroent_cnt = hn_lro_entry_count;
+   if (lroent_cnt < TCP_LRO_ENTRIES)
+   lroent_cnt = TCP_LRO_ENTRIES;
+   tcp_lro_init_args(>hn_lro, ifp, lroent_cnt, 0);
+   device_printf(dev, "LRO: entry count %d\n", lroent_cnt);
+#else
tcp_lro_init(>hn_lro);
/* Driver private LRO settings */
sc->hn_lro.ifp = ifp;
+#endif
 #ifdef HN_LRO_HIWAT
sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
 #endif
@@ -547,6 +569,12 @@ netvsc_attach(device_t dev)
SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "direct_tx_size",
CTLFLAG_RD, _direct_tx_size, 0,
"Size of the packet for direct transmission");
+#if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+   SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "lro_entry_count",
+   CTLFLAG_RD, _lro_entry_count, 0, "LRO entry count");
+#endif
+#endif
}
 
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295299 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:06:14 2016
New Revision: 295299
URL: https://svnweb.freebsd.org/changeset/base/295299

Log:
  hyperv/hn: Enable UDP RXCSUM
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5102

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 05:01:02 2016
(r295298)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 05:06:14 2016
(r295299)
@@ -1036,6 +1036,7 @@ typedef struct hn_softc {
 
u_long  hn_csum_ip;
u_long  hn_csum_tcp;
+   u_long  hn_csum_udp;
u_long  hn_csum_trusted;
u_long  hn_lro_tried;
u_long  hn_small_pkts;

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:01:02 
2016(r295298)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:06:14 
2016(r295299)
@@ -456,6 +456,8 @@ netvsc_attach(device_t dev)
CTLFLAG_RW, >hn_csum_ip, "RXCSUM IP");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_tcp",
CTLFLAG_RW, >hn_csum_tcp, "RXCSUM TCP");
+   SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_udp",
+   CTLFLAG_RW, >hn_csum_udp, "RXCSUM UDP");
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_trusted",
CTLFLAG_RW, >hn_csum_trusted,
"# of TCP segements that we trust host's csum verification");
@@ -1156,7 +1158,7 @@ netvsc_recv(struct hv_device *device_ctx
m_new->m_pkthdr.rcvif = ifp;
 
/* receive side checksum offload */
-   if (NULL != csum_info) {
+   if (csum_info != NULL) {
/* IP csum offload */
if (csum_info->receive.ip_csum_succeeded) {
m_new->m_pkthdr.csum_flags |=
@@ -1164,12 +1166,16 @@ netvsc_recv(struct hv_device *device_ctx
sc->hn_csum_ip++;
}
 
-   /* TCP csum offload */
-   if (csum_info->receive.tcp_csum_succeeded) {
+   /* TCP/UDP csum offload */
+   if (csum_info->receive.tcp_csum_succeeded ||
+   csum_info->receive.udp_csum_succeeded) {
m_new->m_pkthdr.csum_flags |=
(CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
m_new->m_pkthdr.csum_data = 0x;
-   sc->hn_csum_tcp++;
+   if (csum_info->receive.tcp_csum_succeeded)
+   sc->hn_csum_tcp++;
+   else
+   sc->hn_csum_udp++;
}
 
if (csum_info->receive.ip_csum_succeeded &&
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295301 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:17:48 2016
New Revision: 295301
URL: https://svnweb.freebsd.org/changeset/base/295301

Log:
  hyperv/hn: Obey IFCAP_RXCSUM configure
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5104

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:12:30 
2016(r295300)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:17:48 
2016(r295301)
@@ -1142,7 +1142,7 @@ netvsc_recv(struct hv_device *device_ctx
struct mbuf *m_new;
struct ifnet *ifp;
device_t dev = device_ctx->device;
-   int size, do_lro = 0;
+   int size, do_lro = 0, do_csum = 1;
 
if (sc == NULL) {
return (0); /* TODO: KYS how can this be! */
@@ -1190,18 +1190,21 @@ netvsc_recv(struct hv_device *device_ctx
}
m_new->m_pkthdr.rcvif = ifp;
 
+   if (__predict_false((ifp->if_capenable & IFCAP_RXCSUM) == 0))
+   do_csum = 0;
+
/* receive side checksum offload */
if (csum_info != NULL) {
/* IP csum offload */
-   if (csum_info->receive.ip_csum_succeeded) {
+   if (csum_info->receive.ip_csum_succeeded && do_csum) {
m_new->m_pkthdr.csum_flags |=
(CSUM_IP_CHECKED | CSUM_IP_VALID);
sc->hn_csum_ip++;
}
 
/* TCP/UDP csum offload */
-   if (csum_info->receive.tcp_csum_succeeded ||
-   csum_info->receive.udp_csum_succeeded) {
+   if ((csum_info->receive.tcp_csum_succeeded ||
+csum_info->receive.udp_csum_succeeded) && do_csum) {
m_new->m_pkthdr.csum_flags |=
(CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
m_new->m_pkthdr.csum_data = 0x;
@@ -1239,7 +1242,8 @@ netvsc_recv(struct hv_device *device_ctx
 
pr = hn_check_iplen(m_new, hoff);
if (pr == IPPROTO_TCP) {
-   if (sc->hn_trust_hcsum & HN_TRUST_HCSUM_TCP) {
+   if (do_csum &&
+   (sc->hn_trust_hcsum & HN_TRUST_HCSUM_TCP)) {
sc->hn_csum_trusted++;
m_new->m_pkthdr.csum_flags |=
   (CSUM_IP_CHECKED | CSUM_IP_VALID |
@@ -1249,14 +1253,15 @@ netvsc_recv(struct hv_device *device_ctx
/* Rely on SW csum verification though... */
do_lro = 1;
} else if (pr == IPPROTO_UDP) {
-   if (sc->hn_trust_hcsum & HN_TRUST_HCSUM_UDP) {
+   if (do_csum &&
+   (sc->hn_trust_hcsum & HN_TRUST_HCSUM_UDP)) {
sc->hn_csum_trusted++;
m_new->m_pkthdr.csum_flags |=
   (CSUM_IP_CHECKED | CSUM_IP_VALID |
CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
m_new->m_pkthdr.csum_data = 0x;
}
-   } else if (pr != IPPROTO_DONE &&
+   } else if (pr != IPPROTO_DONE && do_csum &&
(sc->hn_trust_hcsum & HN_TRUST_HCSUM_IP)) {
sc->hn_csum_trusted++;
m_new->m_pkthdr.csum_flags |=
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295305 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:44:31 2016
New Revision: 295305
URL: https://svnweb.freebsd.org/changeset/base/295305

Log:
  hyperv/hn: Move LRO flush to the channel processing rollup
  
  This significantly increases LRO aggregation ratio when there are
  large amount of connections (improves reception performance a lot).
  
  Reviewed by:  adrian
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5167

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:38:01 
2016(r295304)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:44:31 
2016(r295305)
@@ -764,6 +764,15 @@ void
 netvsc_channel_rollup(struct hv_device *device_ctx)
 {
struct hn_softc *sc = device_get_softc(device_ctx->device);
+#if defined(INET) || defined(INET6)
+   struct lro_ctrl *lro = >hn_lro;
+   struct lro_entry *queued;
+
+   while ((queued = SLIST_FIRST(>lro_active)) != NULL) {
+   SLIST_REMOVE_HEAD(>lro_active, next);
+   tcp_lro_flush(lro, queued);
+   }
+#endif
 
if (!sc->hn_txeof)
return;
@@ -1338,18 +1347,8 @@ skip:
 }
 
 void
-netvsc_recv_rollup(struct hv_device *device_ctx)
+netvsc_recv_rollup(struct hv_device *device_ctx __unused)
 {
-#if defined(INET) || defined(INET6)
-   hn_softc_t *sc = device_get_softc(device_ctx->device);
-   struct lro_ctrl *lro = >hn_lro;
-   struct lro_entry *queued;
-
-   while ((queued = SLIST_FIRST(>lro_active)) != NULL) {
-   SLIST_REMOVE_HEAD(>lro_active, next);
-   tcp_lro_flush(lro, queued);
-   }
-#endif
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295306 - head/sys/dev/hyperv/netvsc

2016-02-04 Thread Sepherosa Ziehau
Author: sephe
Date: Fri Feb  5 05:50:53 2016
New Revision: 295306
URL: https://svnweb.freebsd.org/changeset/base/295306

Log:
  hyperv/hn: Add an option to always do transmission scheduling
  
  It is off by default. This eases more experiment on hn(4).
  
  Reviewed by:  adrian, Hongjiang Zhang 
  Approved by:  adrian (mentor)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5175

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 05:44:31 2016
(r295305)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h Fri Feb  5 05:50:53 2016
(r295306)
@@ -1023,6 +1023,7 @@ typedef struct hn_softc {
int hn_txdesc_avail;
int hn_txeof;
 
+   int hn_sched_tx;
int hn_direct_tx_size;
struct taskqueue *hn_tx_taskq;
struct task hn_start_task;

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:44:31 
2016(r295305)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Feb  5 05:50:53 
2016(r295306)
@@ -534,6 +534,10 @@ netvsc_attach(device_t dev)
SYSCTL_ADD_INT(ctx, child, OID_AUTO, "direct_tx_size",
CTLFLAG_RW, >hn_direct_tx_size, 0,
"Size of the packet for direct transmission");
+   SYSCTL_ADD_INT(ctx, child, OID_AUTO, "sched_tx",
+   CTLFLAG_RW, >hn_sched_tx, 0,
+   "Always schedule transmission "
+   "instead of doing direct transmission");
 
if (unit == 0) {
struct sysctl_ctx_list *dc_ctx;
@@ -1602,9 +1606,11 @@ hn_stop(hn_softc_t *sc)
 static void
 hn_start(struct ifnet *ifp)
 {
-   hn_softc_t *sc;
+   struct hn_softc *sc = ifp->if_softc;
+
+   if (sc->hn_sched_tx)
+   goto do_sched;
 
-   sc = ifp->if_softc;
if (NV_TRYLOCK(sc)) {
int sched;
 
@@ -1613,15 +1619,18 @@ hn_start(struct ifnet *ifp)
if (!sched)
return;
}
+do_sched:
taskqueue_enqueue_fast(sc->hn_tx_taskq, >hn_start_task);
 }
 
 static void
 hn_start_txeof(struct ifnet *ifp)
 {
-   hn_softc_t *sc;
+   struct hn_softc *sc = ifp->if_softc;
+
+   if (sc->hn_sched_tx)
+   goto do_sched;
 
-   sc = ifp->if_softc;
if (NV_TRYLOCK(sc)) {
int sched;
 
@@ -1633,6 +1642,7 @@ hn_start_txeof(struct ifnet *ifp)
>hn_start_task);
}
} else {
+do_sched:
/*
 * Release the OACTIVE earlier, with the hope, that
 * others could catch up.  The task will clear the
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r295254 - head/sys/arm/arm

2016-02-04 Thread Zbigniew Bodek
Hmm I didn't try that but I think the architecture supports using both
Monitor mode debugging (on a running system) and Halting debug mode (using
debugger).
However I will need to ensure whether any additional configuration is
required to use both at the same time.

Best regards
zbb

2016-02-04 15:45 GMT+01:00 Michal Meloun :

> Yep, I'm ready to review your patch.
> Allow me one question in forward.
> How this patch affects JTAG based debugging of kernel? Mainly if I start
> kernel under JTAG debugger, with active breakpoints (or watchpoints).
>
> Michal
>
> Dne 04.02.2016 v 14:41 Zbigniew Bodek napsal(a):
> > Hello Michal,
> >
> > I have a fix for that that I will send for review soon (I need to test
> > in on some other platforms):
> >
> https://people.freebsd.org/~zbb/arm/other/0001-Fix-debug_monitor-code-for-older-ARMs-ARM11.patch
> > <
> https://people.freebsd.org/%7Ezbb/arm/other/0001-Fix-debug_monitor-code-for-older-ARMs-ARM11.patch
> >
> >
> > If you don't mind I will add you to the review on Phabricator.
> >
> > Best regards
> > zbb
> >
> > 2016-02-04 14:32 GMT+01:00 Michal Meloun  > >:
> >
> > Author: mmel
> > Date: Thu Feb  4 13:32:29 2016
> > New Revision: 295254
> > URL: https://svnweb.freebsd.org/changeset/base/295254
> >
> > Log:
> >   ARM: RPI-B kernel was broken by r294740. Make it functional again.
> >
> > Modified:
> >   head/sys/arm/arm/debug_monitor.c
> >
> > Modified: head/sys/arm/arm/debug_monitor.c
> >
>  
> ==
> > --- head/sys/arm/arm/debug_monitor.cThu Feb  4 12:49:28 2016
> > (r295253)
> > +++ head/sys/arm/arm/debug_monitor.cThu Feb  4 13:32:29 2016
> > (r295254)
> > @@ -845,8 +845,10 @@ dbg_arch_supported(void)
> >  {
> >
> > switch (dbg_model) {
> > +#ifdef not_yet
> > case ID_DFR0_CP_DEBUG_M_V6:
> > case ID_DFR0_CP_DEBUG_M_V6_1:
> > +#endif
> > case ID_DFR0_CP_DEBUG_M_V7:
> > case ID_DFR0_CP_DEBUG_M_V7_1:   /* fall through */
> > return (TRUE);
> > ___
> > svn-src-...@freebsd.org  mailing
> list
> > https://lists.freebsd.org/mailman/listinfo/svn-src-all
> > To unsubscribe, send any mail to
> > "svn-src-all-unsubscr...@freebsd.org
> > "
> >
> >
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295267 - head/sys/arm/arm

2016-02-04 Thread Michal Meloun
Author: mmel
Date: Thu Feb  4 17:01:38 2016
New Revision: 295267
URL: https://svnweb.freebsd.org/changeset/base/295267

Log:
  Replace broken implementation of fuswintr() and suswintr() by functions
  which return -1 as well as on tier 1 archs. Remove block_userspace_access
  used only in these implementations.
  
  (1) These functions may be called in interrupt context and pcb_onfault
  can be already set in this time. Thus, prior pcb_onfault must be saved
  and restored afterwards.
  
  (2) The check that an abort came either from nested interrupt or while
  in critical section or holding not sleepable lock must be avoided for
  this case.
  
  These functions are called only for profiling reason, so there will be
  only small gain by making the code more complex.

Modified:
  head/sys/arm/arm/cpufunc_asm_xscale.S
  head/sys/arm/arm/cpufunc_asm_xscale_c3.S
  head/sys/arm/arm/elf_trampoline.c
  head/sys/arm/arm/fusu.S
  head/sys/arm/arm/trap-v6.c
  head/sys/arm/arm/trap.c

Modified: head/sys/arm/arm/cpufunc_asm_xscale.S
==
--- head/sys/arm/arm/cpufunc_asm_xscale.S   Thu Feb  4 16:38:24 2016
(r295266)
+++ head/sys/arm/arm/cpufunc_asm_xscale.S   Thu Feb  4 17:01:38 2016
(r295267)
@@ -80,9 +80,6 @@ __FBSDID("$FreeBSD$");
  */
 #defineDCACHE_SIZE 0x8000
 
-.Lblock_userspace_access:
-   .word   _C_LABEL(block_userspace_access)
-
 /*
  * CPWAIT -- Canonical method to wait for CP15 update.
  * From: Intel 80200 manual, section 2.3.3.
@@ -137,11 +134,6 @@ ENTRY(xscale_setttb)
mrs r3, cpsr
orr r1, r3, #(PSR_I | PSR_F)
msr cpsr_fsxc, r1
-#else
-   ldr r3, .Lblock_userspace_access
-   ldr r2, [r3]
-   orr r1, r2, #1
-   str r1, [r3]
 #endif
stmfd   sp!, {r0-r3, lr}
bl  _C_LABEL(xscale_cache_cleanID)
@@ -165,8 +157,6 @@ ENTRY(xscale_setttb)
 
 #ifdef CACHE_CLEAN_BLOCK_INTR
msr cpsr_fsxc, r3
-#else
-   str r2, [r3]
 #endif
RET
 END(xscale_setttb)
@@ -273,14 +263,9 @@ _C_LABEL(xscale_minidata_clean_size):
 #defineXSCALE_CACHE_CLEAN_UNBLOCK  
\
msr cpsr_fsxc, r3
 #else
-#defineXSCALE_CACHE_CLEAN_BLOCK
\
-   ldr r3, .Lblock_userspace_access;   \
-   ldr ip, [r3];   \
-   orr r0, ip, #1  ;   \
-   str r0, [r3]
+#defineXSCALE_CACHE_CLEAN_BLOCK
 
-#defineXSCALE_CACHE_CLEAN_UNBLOCK  
\
-   str ip, [r3]
+#defineXSCALE_CACHE_CLEAN_UNBLOCK
 #endif /* CACHE_CLEAN_BLOCK_INTR */
 
 #defineXSCALE_CACHE_CLEAN_PROLOGUE 
\

Modified: head/sys/arm/arm/cpufunc_asm_xscale_c3.S
==
--- head/sys/arm/arm/cpufunc_asm_xscale_c3.SThu Feb  4 16:38:24 2016
(r295266)
+++ head/sys/arm/arm/cpufunc_asm_xscale_c3.SThu Feb  4 17:01:38 2016
(r295267)
@@ -82,9 +82,6 @@ __FBSDID("$FreeBSD$");
  */
 #defineDCACHE_SIZE 0x8000
 
-.Lblock_userspace_access:
-   .word   _C_LABEL(block_userspace_access)
-
 /*
  * CPWAIT -- Canonical method to wait for CP15 update.
  * From: Intel 80200 manual, section 2.3.3.
@@ -130,16 +127,8 @@ __FBSDID("$FreeBSD$");
msr cpsr_fsxc, r4   ;   \
ldmfd   sp!, {r4}
 #else
-#defineXSCALE_CACHE_CLEAN_BLOCK
\
-   stmfd   sp!, {r4}   ;   \
-   ldr r4, .Lblock_userspace_access;   \
-   ldr ip, [r4];   \
-   orr r0, ip, #1  ;   \
-   str r0, [r4]
-
-#defineXSCALE_CACHE_CLEAN_UNBLOCK  
\
-   str ip, [r3];   \
-   ldmfd   sp!, {r4}
+#defineXSCALE_CACHE_CLEAN_BLOCK
+#defineXSCALE_CACHE_CLEAN_UNBLOCK
 #endif /* CACHE_CLEAN_BLOCK_INTR */
 
 
@@ -352,11 +341,6 @@ ENTRY(xscalec3_setttb)
mrs r3, cpsr
orr r1, r3, #(PSR_I | PSR_F)
msr cpsr_fsxc, r1
-#else
-   ldr r3, .Lblock_userspace_access
-   ldr r2, [r3]
-   orr r1, r2, #1
-   str r1, [r3]
 #endif
stmfd   sp!, {r0-r3, lr}
bl  _C_LABEL(xscalec3_cache_cleanID)

Modified: head/sys/arm/arm/elf_trampoline.c
==
--- head/sys/arm/arm/elf_trampoline.c   Thu Feb  4 16:38:24 2016
(r295266)
+++ 

Re: svn commit: r295226 - head/lib/libmemstat

2016-02-04 Thread Gleb Smirnoff
On Wed, Feb 03, 2016 at 04:41:26PM -0800, Bryan Drewery wrote:
B> On 2/3/2016 4:23 PM, Gleb Smirnoff wrote:
B> > Author: glebius
B> > Date: Thu Feb  4 00:23:21 2016
B> > New Revision: 295226
B> > URL: https://svnweb.freebsd.org/changeset/base/295226
B> > 
B> > Log:
B> >   Fix build.
B> > 
B> > Modified:
B> >   head/lib/libmemstat/memstat_uma.c
B> > 
B> > Modified: head/lib/libmemstat/memstat_uma.c
B> > 
==
B> > --- head/lib/libmemstat/memstat_uma.c  Wed Feb  3 23:41:58 2016
(r295225)
B> > +++ head/lib/libmemstat/memstat_uma.c  Thu Feb  4 00:23:21 2016
(r295226)
B> > @@ -29,6 +29,7 @@
B> >  #include 
B> >  #include 
B> >  #include 
B> > +#include 
B> >  
B> >  #include 
B> >  #include 
B> > 
B> 
B> Shouldn't uma_int.h forward declare or include _task.h for struct task?

Forward declaration won't work, since structure is included, not pointed at.
I'm reluctant with adding includes into includes.

-- 
Totus tuus, Glebius.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295269 - head/etc/rc.d

2016-02-04 Thread Devin Teske
Author: dteske
Date: Thu Feb  4 17:09:43 2016
New Revision: 295269
URL: https://svnweb.freebsd.org/changeset/base/295269

Log:
  Fix grammar in error statement
  
  s/consider to migrate to jail.conf/consider migrating to jail.conf/

Modified:
  head/etc/rc.d/jail

Modified: head/etc/rc.d/jail
==
--- head/etc/rc.d/jail  Thu Feb  4 17:03:12 2016(r295268)
+++ head/etc/rc.d/jail  Thu Feb  4 17:09:43 2016(r295269)
@@ -563,7 +563,7 @@ jail_warn()
# To relieve confusion, show a warning message.
case $_confwarn in
1)  warn "Per-jail configuration via jail_* variables " \
-   "is obsolete.  Please consider to migrate to $jail_conf."
+   "is obsolete.  Please consider migrating to $jail_conf."
;;
esac
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295258 - in head/sys/riscv: include riscv

2016-02-04 Thread Ruslan Bukin
Author: br
Date: Thu Feb  4 14:30:46 2016
New Revision: 295258
URL: https://svnweb.freebsd.org/changeset/base/295258

Log:
  Access pcpup using gp register.

Modified:
  head/sys/riscv/include/asm.h
  head/sys/riscv/riscv/exception.S
  head/sys/riscv/riscv/swtch.S

Modified: head/sys/riscv/include/asm.h
==
--- head/sys/riscv/include/asm.hThu Feb  4 14:15:24 2016
(r295257)
+++ head/sys/riscv/include/asm.hThu Feb  4 14:30:46 2016
(r295258)
@@ -59,9 +59,7 @@
.set alias,sym
 
 #defineSET_FAULT_HANDLER(handler, tmp) 
\
-   la  tmp, pcpup; \
-   ld  tmp, 0(tmp);\
-   ld  tmp, PC_CURTHREAD(tmp); \
+   ld  tmp, PC_CURTHREAD(gp);  \
ld  tmp, TD_PCB(tmp);   /* Load the pcb */  \
sd  handler, PCB_ONFAULT(tmp)   /* Set the handler */
 

Modified: head/sys/riscv/riscv/exception.S
==
--- head/sys/riscv/riscv/exception.SThu Feb  4 14:15:24 2016
(r295257)
+++ head/sys/riscv/riscv/exception.SThu Feb  4 14:30:46 2016
(r295258)
@@ -182,9 +182,7 @@ __FBSDID("$FreeBSD$");
 1:
csrci   sstatus, SSTATUS_IE
 
-   la  a1, pcpup
-   ld  a1, 0(a1)
-   ld  a1, PC_CURTHREAD(a1)
+   ld  a1, PC_CURTHREAD(gp)
lw  a2, TD_FLAGS(a1)
 
li  a3, (TDF_ASTPENDING|TDF_NEEDRESCHED)

Modified: head/sys/riscv/riscv/swtch.S
==
--- head/sys/riscv/riscv/swtch.SThu Feb  4 14:15:24 2016
(r295257)
+++ head/sys/riscv/riscv/swtch.SThu Feb  4 14:30:46 2016
(r295258)
@@ -46,14 +46,11 @@ __FBSDID("$FreeBSD$");
  * void cpu_throw(struct thread *old, struct thread *new)
  */
 ENTRY(cpu_throw)
-   /* Load pcpu */
-   la  x14, pcpup
-   ld  x14, 0(x14)
/* Store the new curthread */
-   sd  a1, PC_CURTHREAD(x14)
+   sd  a1, PC_CURTHREAD(gp)
/* And the new pcb */
ld  x13, TD_PCB(a1)
-   sd  x13, PC_CURPCB(x14)
+   sd  x13, PC_CURPCB(gp)
 
sfence.vm
 
@@ -103,14 +100,11 @@ END(cpu_throw)
  * x3 to x7, x16 and x17 are caller saved
  */
 ENTRY(cpu_switch)
-   /* Load pcpu */
-   la  x14, pcpup
-   ld  x14, 0(x14)
/* Store the new curthread */
-   sd  a1, PC_CURTHREAD(x14)
+   sd  a1, PC_CURTHREAD(gp)
/* And the new pcb */
ld  x13, TD_PCB(a1)
-   sd  x13, PC_CURPCB(x14)
+   sd  x13, PC_CURPCB(gp)
 
/* Save the old context. */
ld  x13, TD_PCB(a0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295256 - head/sys/arm/arm

2016-02-04 Thread Michal Meloun
Author: mmel
Date: Thu Feb  4 14:02:42 2016
New Revision: 295256
URL: https://svnweb.freebsd.org/changeset/base/295256

Log:
  ARM: Set UNAL_ENABLE bit in SCTLR CP15 register. This bit is RAO/SBOP
  for ARMv7. For ARMv6, it controls ARMv5 compatible alignment support.
  This bit have no effect until unaligned access is enabled.

Modified:
  head/sys/arm/arm/locore-v6.S

Modified: head/sys/arm/arm/locore-v6.S
==
--- head/sys/arm/arm/locore-v6.SThu Feb  4 13:35:40 2016
(r295255)
+++ head/sys/arm/arm/locore-v6.SThu Feb  4 14:02:42 2016
(r295256)
@@ -132,9 +132,9 @@ ASENTRY_NP(_start)
bic r7, #CPU_CONTROL_DC_ENABLE
bic r7, #CPU_CONTROL_MMU_ENABLE
bic r7, #CPU_CONTROL_IC_ENABLE
-   bic r7, #CPU_CONTROL_UNAL_ENABLE
bic r7, #CPU_CONTROL_BPRD_ENABLE
bic r7, #CPU_CONTROL_SW_ENABLE
+   orr r7, #CPU_CONTROL_UNAL_ENABLE
orr r7, #CPU_CONTROL_AFLT_ENABLE
orr r7, #CPU_CONTROL_VECRELOC
mcr CP15_SCTLR(r7)
@@ -456,9 +456,9 @@ ASENTRY_NP(mpentry)
bic r0, #CPU_CONTROL_MMU_ENABLE
bic r0, #CPU_CONTROL_DC_ENABLE
bic r0, #CPU_CONTROL_IC_ENABLE
-   bic r0, #CPU_CONTROL_UNAL_ENABLE
bic r0, #CPU_CONTROL_BPRD_ENABLE
bic r0, #CPU_CONTROL_SW_ENABLE
+   orr r0, #CPU_CONTROL_UNAL_ENABLE
orr r0, #CPU_CONTROL_AFLT_ENABLE
orr r0, #CPU_CONTROL_VECRELOC
mcr CP15_SCTLR(r0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295272 - head/lib/libc/sys

2016-02-04 Thread Jason Helfman
Author: jgh (doc,ports committer)
Date: Thu Feb  4 18:03:06 2016
New Revision: 295272
URL: https://svnweb.freebsd.org/changeset/base/295272

Log:
  - connect(2) Clarify namelen
  
  PR:   206838
  Submitted by: t...@tobik.me
  Approved by:  bcr (mentor)
  MFH:  after 1 week
  Differential Revision:https://reviews.freebsd.org/D5194

Modified:
  head/lib/libc/sys/connect.2

Modified: head/lib/libc/sys/connect.2
==
--- head/lib/libc/sys/connect.2 Thu Feb  4 17:43:56 2016(r295271)
+++ head/lib/libc/sys/connect.2 Thu Feb  4 18:03:06 2016(r295272)
@@ -28,7 +28,7 @@
 .\" @(#)connect.2  8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd September 29, 2014
+.Dd February 4, 2016
 .Dt CONNECT 2
 .Os
 .Sh NAME
@@ -58,6 +58,14 @@ another socket.
 The other socket is specified by
 .Fa name ,
 which is an address in the communications space of the socket.
+.Fa namelen
+indicates the amount of space pointed to by
+.Fa name ,
+in bytes; the
+.Fa sa_len
+member of
+.Fa name
+is ignored.
 Each communications space interprets the
 .Fa name
 argument in its own way.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295270 - head/sys/arm64/arm64

2016-02-04 Thread Andrew Turner
Author: andrew
Date: Thu Feb  4 17:22:15 2016
New Revision: 295270
URL: https://svnweb.freebsd.org/changeset/base/295270

Log:
  Enable checking of the stack alignment. The stack should be aligned to a
  16-byte value. With this the hardware will check if a memory access uses
  an incorrectly aligned stack pointer as the base address.
  
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm64/arm64/locore.S

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Thu Feb  4 17:09:43 2016
(r295269)
+++ head/sys/arm64/arm64/locore.S   Thu Feb  4 17:22:15 2016
(r295270)
@@ -628,11 +628,11 @@ tcr_early:
 sctlr_set:
/* Bits to set */
.quad (SCTLR_UCI | SCTLR_nTWE | SCTLR_nTWI | SCTLR_UCT | SCTLR_DZE | \
-   SCTLR_I | SCTLR_SED | SCTLR_C | SCTLR_M)
+   SCTLR_I | SCTLR_SED | SCTLR_SA0 | SCTLR_SA | SCTLR_C | SCTLR_M)
 sctlr_clear:
/* Bits to clear */
.quad (SCTLR_EE | SCTLR_EOE | SCTLR_WXN | SCTLR_UMA | SCTLR_ITD | \
-   SCTLR_THEE | SCTLR_CP15BEN | SCTLR_SA0 | SCTLR_SA | SCTLR_A)
+   SCTLR_THEE | SCTLR_CP15BEN | SCTLR_A)
 
.globl abort
 abort:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295271 - head/sys/powerpc/fpu

2016-02-04 Thread John Baldwin
Author: jhb
Date: Thu Feb  4 17:43:56 2016
New Revision: 295271
URL: https://svnweb.freebsd.org/changeset/base/295271

Log:
  Fix build of powerpc FPU emulator after changes in r295132 to restore the
  ABI of struct fpreg.  The FPU emulator operates on the "raw" FPU state
  stored in the pcb rather than the "cooked" fpreg state used for ptrace()
  and cores.
  
  Reported by:  bz

Modified:
  head/sys/powerpc/fpu/fpu_emu.c
  head/sys/powerpc/fpu/fpu_explode.c

Modified: head/sys/powerpc/fpu/fpu_emu.c
==
--- head/sys/powerpc/fpu/fpu_emu.c  Thu Feb  4 17:22:15 2016
(r295270)
+++ head/sys/powerpc/fpu/fpu_emu.c  Thu Feb  4 17:43:56 2016
(r295271)
@@ -275,7 +275,7 @@ fpu_execute(struct trapframe *tf, struct
vm_offset_t addr;
int ra, rb, rc, rt, type, mask, fsr, cx, bf, setcr;
unsigned int cond;
-   struct fpreg *fs;
+   struct fpu *fs;
 
/* Setup work. */
fp = NULL;
@@ -335,7 +335,7 @@ fpu_execute(struct trapframe *tf, struct
if (ra != 0)
addr += tf->fixreg[ra];
rt = instr.i_x.i_rt;
-   a = (int *)>fpreg[rt].fpr;
+   a = (int *)>fpr[rt].fpr;
DPRINTF(FPE_INSN,
("fpu_execute: Store INT %x at %p\n",
a[1], (void *)addr));
@@ -402,7 +402,7 @@ fpu_execute(struct trapframe *tf, struct
DPRINTF(FPE_INSN, 
("fpu_execute: Store DBL at %p\n",
(void *)addr));
-   if (copyout(>fpreg[rt].fpr, (void *)addr,
+   if (copyout(>fpr[rt].fpr, (void *)addr,
size))
return (FAULT);
}
@@ -411,13 +411,13 @@ fpu_execute(struct trapframe *tf, struct
FPU_EMU_EVCNT_INCR(fpload);
DPRINTF(FPE_INSN, ("fpu_execute: Load from %p\n",
(void *)addr));
-   if (copyin((const void *)addr, >fpreg[rt].fpr,
+   if (copyin((const void *)addr, >fpr[rt].fpr,
size))
return (FAULT);
if (type != FTYPE_DBL) {
fpu_explode(fe, fp = >fe_f1, type, rt);
fpu_implode(fe, fp, FTYPE_DBL, 
-   (u_int *)>fpreg[rt].fpr);
+   (u_int *)>fpr[rt].fpr);
}
}
if (update) 
@@ -470,7 +470,7 @@ fpu_execute(struct trapframe *tf, struct
DPRINTF(FPE_INSN, ("fpu_execute: FRSP\n"));
fpu_explode(fe, fp = >fe_f1, FTYPE_DBL, rb);
fpu_implode(fe, fp, FTYPE_SNG, 
-   (u_int *)>fpreg[rt].fpr);
+   (u_int *)>fpr[rt].fpr);
fpu_explode(fe, fp = >fe_f1, FTYPE_SNG, rt);
type = FTYPE_DBL;
break;
@@ -503,9 +503,9 @@ fpu_execute(struct trapframe *tf, struct
caseOPC63_FNEG:
FPU_EMU_EVCNT_INCR(fnegabs);
DPRINTF(FPE_INSN, ("fpu_execute: FNEGABS\n"));
-   memcpy(>fpreg[rt].fpr, >fpreg[rb].fpr,
+   memcpy(>fpr[rt].fpr, >fpr[rb].fpr,
sizeof(double));
-   a = (int *)>fpreg[rt].fpr;
+   a = (int *)>fpr[rt].fpr;
*a ^= (1U << 31);
break;
caseOPC63_MCRFS:
@@ -533,7 +533,7 @@ fpu_execute(struct trapframe *tf, struct
caseOPC63_FMR:
FPU_EMU_EVCNT_INCR(fmr);
DPRINTF(FPE_INSN, ("fpu_execute: FMR\n"));
-   memcpy(>fpreg[rt].fpr, >fpreg[rb].fpr,
+   memcpy(>fpr[rt].fpr, >fpr[rb].fpr,
sizeof(double));
break;
caseOPC63_MTFSFI:
@@ -550,23 +550,23 @@ fpu_execute(struct trapframe *tf, struct
caseOPC63_FNABS:
FPU_EMU_EVCNT_INCR(fnabs);
DPRINTF(FPE_INSN, ("fpu_execute: FABS\n"));
-   

svn commit: r295265 - head/sys/kern

2016-02-04 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  4 16:32:21 2016
New Revision: 295265
URL: https://svnweb.freebsd.org/changeset/base/295265

Log:
  Do not copy by field when converting struct oexport_args to struct
  export_args on mount update, bzero() is consistent with
  vfs_oexport_conv().
  Make the code structure more explicit by using switch.
  Return EINVAL if export option layout (deduced from size) is unknown.
  
  Based on the submission by:   bde
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Thu Feb  4 15:46:12 2016(r295264)
+++ head/sys/kern/vfs_mount.c   Thu Feb  4 16:32:21 2016(r295265)
@@ -880,10 +880,10 @@ vfs_domount_update(
struct vfsoptlist **optlist /* Options local to the filesystem. */
)
 {
-   struct oexport_args oexport;
struct export_args export;
+   void *bufp;
struct mount *mp;
-   int error, export_error;
+   int error, export_error, len;
uint64_t flag;
 
ASSERT_VOP_ELOCKED(vp, __func__);
@@ -951,23 +951,21 @@ vfs_domount_update(
error = VFS_MOUNT(mp);
 
export_error = 0;
-   if (error == 0) {
-   /* Process the export option. */
-   if (vfs_copyopt(mp->mnt_optnew, "export", ,
-   sizeof(export)) == 0) {
-   export_error = vfs_export(mp, );
-   } else if (vfs_copyopt(mp->mnt_optnew, "export", ,
-   sizeof(oexport)) == 0) {
-   export.ex_flags = oexport.ex_flags;
-   export.ex_root = oexport.ex_root;
-   export.ex_anon = oexport.ex_anon;
-   export.ex_addr = oexport.ex_addr;
-   export.ex_addrlen = oexport.ex_addrlen;
-   export.ex_mask = oexport.ex_mask;
-   export.ex_masklen = oexport.ex_masklen;
-   export.ex_indexfile = oexport.ex_indexfile;
-   export.ex_numsecflavors = 0;
+   /* Process the export option. */
+   if (error == 0 && vfs_getopt(mp->mnt_optnew, "export", ,
+   ) == 0) {
+   /* Assume that there is only 1 ABI for each length. */
+   switch (len) {
+   case (sizeof(struct oexport_args)):
+   bzero(, sizeof(export));
+   /* FALLTHROUGH */
+   case (sizeof(export)):
+   bcopy(bufp, , len);
export_error = vfs_export(mp, );
+   break;
+   default:
+   export_error = EINVAL;
+   break;
}
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295261 - head/bin/dd

2016-02-04 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb  4 15:21:01 2016
New Revision: 295261
URL: https://svnweb.freebsd.org/changeset/base/295261

Log:
  Add 't' and 'p' postfixes to dd(1).
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/bin/dd/args.c
  head/bin/dd/dd.1

Modified: head/bin/dd/args.c
==
--- head/bin/dd/args.c  Thu Feb  4 15:10:08 2016(r295260)
+++ head/bin/dd/args.c  Thu Feb  4 15:21:01 2016(r295261)
@@ -383,6 +383,14 @@ postfix_to_mult(const char expr)
case 'g':
mult = 1 << 30;
break;
+   case 'T':
+   case 't':
+   mult = (uintmax_t)1 << 40;
+   break;
+   case 'P':
+   case 'p':
+   mult = (uintmax_t)1 << 50;
+   break;
case 'W':
case 'w':
mult = sizeof(int);

Modified: head/bin/dd/dd.1
==
--- head/bin/dd/dd.1Thu Feb  4 15:10:08 2016(r295260)
+++ head/bin/dd/dd.1Thu Feb  4 15:21:01 2016(r295261)
@@ -32,7 +32,7 @@
 .\" @(#)dd.1   8.2 (Berkeley) 1/13/94
 .\" $FreeBSD$
 .\"
-.Dd August 28, 2014
+.Dd February 4, 2016
 .Dt DD 1
 .Os
 .Sh NAME
@@ -332,10 +332,13 @@ If the number ends with a
 .Dq Li k ,
 .Dq Li m ,
 .Dq Li g ,
+.Dq Li t ,
+.Dq Li p ,
 or
 .Dq Li w ,
 the
-number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G)
+number is multiplied by 512, 1024 (1K), 1048576 (1M), 1073741824 (1G),
+1099511627776 (1T), 1125899906842624 (1P)
 or the number of bytes in an integer, respectively.
 Two or more numbers may be separated by an
 .Dq Li x
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295273 - head/sys/dev/ixgbe

2016-02-04 Thread Michael Tuexen
Author: tuexen
Date: Thu Feb  4 18:08:50 2016
New Revision: 295273
URL: https://svnweb.freebsd.org/changeset/base/295273

Log:
  In FreeBSD 10 and higher the driver announces SCTP checksum offloading support
  also for 82598, which doesn't support it.
  The legacy code has a check for it, which was missed when the code for 
dealing with
  CSUM_IP6_* was added. Add the same check for FreeBSD 10 and higher.
  
  Differential Revision:https://reviews.freebsd.org/D5192

Modified:
  head/sys/dev/ixgbe/if_ix.c

Modified: head/sys/dev/ixgbe/if_ix.c
==
--- head/sys/dev/ixgbe/if_ix.c  Thu Feb  4 18:03:06 2016(r295272)
+++ head/sys/dev/ixgbe/if_ix.c  Thu Feb  4 18:08:50 2016(r295273)
@@ -1017,6 +1017,7 @@ static void
 ixgbe_set_if_hwassist(struct adapter *adapter)
 {
struct ifnet *ifp = adapter->ifp;
+   struct ixgbe_hw *hw = >hw;
 
ifp->if_hwassist = 0;
 #if __FreeBSD_version >= 100
@@ -1024,18 +1025,21 @@ ixgbe_set_if_hwassist(struct adapter *ad
ifp->if_hwassist |= CSUM_IP_TSO;
if (ifp->if_capenable & IFCAP_TSO6)
ifp->if_hwassist |= CSUM_IP6_TSO;
-   if (ifp->if_capenable & IFCAP_TXCSUM)
-   ifp->if_hwassist |= (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP |
-   CSUM_IP_SCTP);
-   if (ifp->if_capenable & IFCAP_TXCSUM_IPV6)
-   ifp->if_hwassist |= (CSUM_IP6_UDP | CSUM_IP6_TCP |
-   CSUM_IP6_SCTP);
+   if (ifp->if_capenable & IFCAP_TXCSUM) {
+   ifp->if_hwassist |= (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP);
+   if (hw->mac.type != ixgbe_mac_82598EB)
+   ifp->if_hwassist |= CSUM_IP_SCTP;
+   }
+   if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) {
+   ifp->if_hwassist |= (CSUM_IP6_UDP | CSUM_IP6_TCP);
+   if (hw->mac.type != ixgbe_mac_82598EB)
+   ifp->if_hwassist |= CSUM_IP6_SCTP;
+   }
 #else
if (ifp->if_capenable & IFCAP_TSO)
ifp->if_hwassist |= CSUM_TSO;
if (ifp->if_capenable & IFCAP_TXCSUM) {
ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
-   struct ixgbe_hw *hw = >hw;
if (hw->mac.type != ixgbe_mac_82598EB)
ifp->if_hwassist |= CSUM_SCTP;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295276 - in head/sys: cam/ata dev/ata sys

2016-02-04 Thread Ravi Pokala
Author: rpokala
Date: Thu Feb  4 19:53:54 2016
New Revision: 295276
URL: https://svnweb.freebsd.org/changeset/base/295276

Log:
  Add defines for WRITE_UNCORRECTABLE ATA command, and improve command logging
  
  Add #defines for ATA_WRITE_UNCORRECTABLE48 and its features. Update the
  decoding in ATACAM to recognize the new values. Also improve command
  decoding for a few other commands (SMART, NOP, SET_FEATURES). Bring the
  decoding in ata(4) up to parity with ATACAM.
  
  Reviewed by:  mav, imp
  MFC after:1 month
  Sponsored by: Panasas, Inc.
  Differential Revision:https://reviews.freebsd.org/D5181

Modified:
  head/sys/cam/ata/ata_all.c
  head/sys/dev/ata/ata-all.c
  head/sys/sys/ata.h

Modified: head/sys/cam/ata/ata_all.c
==
--- head/sys/cam/ata/ata_all.c  Thu Feb  4 19:30:24 2016(r295275)
+++ head/sys/cam/ata/ata_all.c  Thu Feb  4 19:53:54 2016(r295276)
@@ -75,13 +75,18 @@ ata_op_string(struct ata_cmd *cmd)
if (cmd->control & 0x04)
return ("SOFT_RESET");
switch (cmd->command) {
-   case 0x00: return ("NOP");
+   case 0x00:
+   switch (cmd->features) {
+   case 0x00: return ("NOP FLUSHQUEUE");
+   case 0x01: return ("NOP AUTOPOLL");
+   }
+   return ("NOP");
case 0x03: return ("CFA_REQUEST_EXTENDED_ERROR");
case 0x06:
switch (cmd->features) {
-   case 0x01: return ("DSM TRIM");
-   }
-   return "DSM";
+   case 0x01: return ("DSM TRIM");
+   }
+   return "DSM";
case 0x08: return ("DEVICE_RESET");
case 0x20: return ("READ");
case 0x24: return ("READ48");
@@ -105,6 +110,12 @@ ata_op_string(struct ata_cmd *cmd)
case 0x3f: return ("WRITE_LOG_EXT");
case 0x40: return ("READ_VERIFY");
case 0x42: return ("READ_VERIFY48");
+   case 0x45:
+   switch (cmd->features) {
+   case 0x55: return ("WRITE_UNCORRECTABLE48 PSEUDO");
+   case 0xaa: return ("WRITE_UNCORRECTABLE48 FLAGGED");
+   }
+   return "WRITE_UNCORRECTABLE48";
case 0x51: return ("CONFIGURE_STREAM");
case 0x60: return ("READ_FPDMA_QUEUED");
case 0x61: return ("WRITE_FPDMA_QUEUED");
@@ -128,7 +139,18 @@ ata_op_string(struct ata_cmd *cmd)
case 0xa0: return ("PACKET");
case 0xa1: return ("ATAPI_IDENTIFY");
case 0xa2: return ("SERVICE");
-   case 0xb0: return ("SMART");
+   case 0xb0:
+   switch(cmd->features) {
+   case 0xd0: return ("SMART READ ATTR VALUES");
+   case 0xd1: return ("SMART READ ATTR THRESHOLDS");
+   case 0xd3: return ("SMART SAVE ATTR VALUES");
+   case 0xd4: return ("SMART EXECUTE OFFLINE IMMEDIATE");
+   case 0xd5: return ("SMART READ LOG DATA");
+   case 0xd8: return ("SMART ENABLE OPERATION");
+   case 0xd9: return ("SMART DISABLE OPERATION");
+   case 0xda: return ("SMART RETURN STATUS");
+   }
+   return ("SMART");
case 0xb1: return ("DEVICE CONFIGURATION");
case 0xc0: return ("CFA_ERASE");
case 0xc4: return ("READ_MUL");
@@ -158,18 +180,22 @@ ata_op_string(struct ata_cmd *cmd)
case 0xed: return ("MEDIA_EJECT");
case 0xef:
switch (cmd->features) {
-   case 0x03: return ("SETFEATURES SET TRANSFER MODE");
-   case 0x02: return ("SETFEATURES ENABLE WCACHE");
-   case 0x82: return ("SETFEATURES DISABLE WCACHE");
-   case 0x06: return ("SETFEATURES ENABLE PUIS");
-   case 0x86: return ("SETFEATURES DISABLE PUIS");
-   case 0x07: return ("SETFEATURES SPIN-UP");
-   case 0x10: return ("SETFEATURES ENABLE SATA FEATURE");
-   case 0x90: return ("SETFEATURES DISABLE SATA FEATURE");
-   case 0xaa: return ("SETFEATURES ENABLE RCACHE");
-   case 0x55: return ("SETFEATURES DISABLE RCACHE");
-   }
-   return "SETFEATURES";
+   case 0x03: return ("SETFEATURES SET TRANSFER MODE");
+   case 0x02: return ("SETFEATURES ENABLE WCACHE");
+   case 0x82: return ("SETFEATURES DISABLE WCACHE");
+   case 0x06: return ("SETFEATURES ENABLE PUIS");
+   case 0x86: return ("SETFEATURES DISABLE PUIS");
+   case 0x07: return ("SETFEATURES SPIN-UP");
+   case 0x10: return ("SETFEATURES ENABLE SATA FEATURE");
+   case 0x90: return ("SETFEATURES DISABLE SATA FEATURE");
+   case 0xaa: return ("SETFEATURES ENABLE RCACHE");
+   case 0x55: return ("SETFEATURES DISABLE RCACHE");
+   case 0x5d: return ("SETFEATURES ENABLE RELIRQ");
+   

svn commit: r295277 - head/sys/kern

2016-02-04 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  4 20:55:49 2016
New Revision: 295277
URL: https://svnweb.freebsd.org/changeset/base/295277

Log:
  When matching brand to the ELF binary by notes, try to find a brand
  with interpreter name exactly matching one wanted by the binary.  If
  no such brand exists, return first brand which accepted the binary by
  note.
  
  The change fixes a regression after r292749, where e.g. our two ia32
  compat brands, ia32_brand_info and ia32_brand_oinfo, only differ by
  the interpeter path and binary matches to a brand by linkage order.
  Then old binaries which require /usr/libexec/ld-elf.so.1 but matched
  against ia32_brand_info with interp_path /libexec/ld-elf.so.1, were
  considered requiring non-standard interpreter name, and magic to force
  ld-elf32.so.1 did not happen.
  
  Note that it might make sense to apply the same selection of brands
  for other matching criteria, SCO EI_OSABI and 3.x string.
  
  Reported and tested by:   dwmalone
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/imgact_elf.c

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Thu Feb  4 19:53:54 2016(r295276)
+++ head/sys/kern/imgact_elf.c  Thu Feb  4 20:55:49 2016(r295277)
@@ -258,7 +258,7 @@ __elfN(get_brandinfo)(struct image_param
 int interp_name_len, int32_t *osrel)
 {
const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
-   Elf_Brandinfo *bi;
+   Elf_Brandinfo *bi, *bi_m;
boolean_t ret;
int i;
 
@@ -270,6 +270,7 @@ __elfN(get_brandinfo)(struct image_param
 */
 
/* Look for an ".note.ABI-tag" ELF section */
+   bi_m = NULL;
for (i = 0; i < MAX_BRANDS; i++) {
bi = elf_brand_list[i];
if (bi == NULL)
@@ -280,10 +281,28 @@ __elfN(get_brandinfo)(struct image_param
/* Give brand a chance to veto check_note's guess */
if (ret && bi->header_supported)
ret = bi->header_supported(imgp);
+   /*
+* If note checker claimed the binary, but the
+* interpreter path in the image does not
+* match default one for the brand, try to
+* search for other brands with the same
+* interpreter.  Either there is better brand
+* with the right interpreter, or, failing
+* this, we return first brand which accepted
+* our note and, optionally, header.
+*/
+   if (ret && bi_m == NULL && (strlen(bi->interp_path) +
+   1 != interp_name_len || strncmp(interp,
+   bi->interp_path, interp_name_len) != 0)) {
+   bi_m = bi;
+   ret = 0;
+   }
if (ret)
return (bi);
}
}
+   if (bi_m != NULL)
+   return (bi_m);
 
/* If the executable has a brand, search for it in the brand list. */
for (i = 0; i < MAX_BRANDS; i++) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"