Re: svn commit: r270850 - in head/sys: i386/i386 i386/include i386/isa x86/acpica

2014-09-09 Thread Konstantin Belousov
On Sat, Sep 06, 2014 at 04:04:49PM -0400, John Baldwin wrote:
> On Friday, September 05, 2014 10:44:05 AM John Baldwin wrote:
> > On Friday, September 05, 2014 4:43:05 am Konstantin Belousov wrote:
> > > There is one weird detail, not touched by your patch.  Amd64 resume
> > > path calls initializecpu(), while i386 does not.  I do not see any
> > > use for the call, the reload of CRX registers by trampoline/resumectx
> > > should already set everything to working state.  E.g., enabling XMM
> > > in CR4 after fpu state is restored looks strange.
> > 
> > I can test that.
> 
> I looked at this, and I actually think calling initializecpu() is correct.
> It is true that it will set bits in CR4 that are already set, but it also
> does vendor-specific initialization (e.g. init_amd() and init_via() on amd64
> set MSRs, and on i386 there is a lot more of those, though most of the
> CPUs with extra settings probably do not support SMP or run in ACPI systems).
> We could either save and restore those various vendor-specific MSRs and 
> registers in suspend/resume, or just call initializecpu() to set their 
> values.  
> The latter approach seems simpler, so I chose that route.  In immediate 
> terms, 
> it should fix enabling PG_NX in MSR_EFER on i386 + PAE resume, but it also 
> makes the AP startup case simpler and closer to the amd64 code.  I also moved 
> some code that set MSRs out of printcpuinfo() in identcpu.c and into 
> initializecpu() instead.  Finally, I split initializecpucache() out similar 
> to 
> how it is split on amd64.
Ok.

Two very minor comments below.

> 
> Ah, I see one bug I will fix in my tree, pc98's machdep.c needs the change to
> call initializecpucache().
> 
> --- //depot/vendor/freebsd/src/sys/i386/i386/initcpu.c
> +++ //depot/user/jhb/acpipci/i386/i386/initcpu.c
> @@ -59,6 +59,12 @@
>  static void init_6x86(void);
>  #endif /* I486_CPU */
>  
> +#if defined(I586_CPU) && defined(CPU_WT_ALLOC)
> +static void  enable_K5_wt_alloc(void);
> +static void  enable_K6_wt_alloc(void);
> +static void  enable_K6_2_wt_alloc(void);
> +#endif
> +
>  #ifdef I686_CPU
>  static void  init_6x86MX(void);
>  static void  init_ppro(void);
> @@ -527,6 +533,8 @@
>   intr_restore(saveintr);
>  }
>  
> +static int ppro_apic_used = -1;
> +
>  static void
>  init_ppro(void)
>  {
> @@ -535,9 +543,29 @@
>   /*
>* Local APIC should be disabled if it is not going to be used.
>*/
> - apicbase = rdmsr(MSR_APICBASE);
> - apicbase &= ~APICBASE_ENABLED;
> - wrmsr(MSR_APICBASE, apicbase);
> + if (ppro_apic_used != 1) {
> + apicbase = rdmsr(MSR_APICBASE);
> + apicbase &= ~APICBASE_ENABLED;
> + wrmsr(MSR_APICBASE, apicbase);
> + ppro_apic_used = 0;
> + }
> +}
> +
> +/*
> + * If the local APIC is going to be used after being disabled above,
> + * re-enable it and don't disable it in the future.
> + */
> +void
> +ppro_reenable_apic(void)
> +{
> + u_int64_t   apicbase;
> +
> + if (ppro_apic_used == 0) {
> + apicbase = rdmsr(MSR_APICBASE);
> + apicbase |= APICBASE_ENABLED;
> + wrmsr(MSR_APICBASE, apicbase);
> + ppro_apic_used = 1;
> + }
>  }
>  
>  /*
> @@ -646,20 +674,6 @@
>  }
>  #endif
>  
> -/*
> - * Initialize CR4 (Control register 4) to enable SSE instructions.
> - */
> -void
> -enable_sse(void)
> -{
> -#if defined(CPU_ENABLE_SSE)
> - if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) {
> - load_cr4(rcr4() | CR4_FXSR | CR4_XMM);
> - cpu_fxsr = hw_instruction_sse = 1;
> - }
> -#endif
> -}
> -
>  extern int elf32_nxstack;
>  
>  void
> @@ -692,6 +706,27 @@
>  #ifdef I586_CPU
>   case CPU_586:
>   switch (cpu_vendor_id) {
> + case CPU_VENDOR_AMD:
> +#ifdef CPU_WT_ALLOC
> + if (((cpu_id & 0x0f0) > 0) &&
> + ((cpu_id & 0x0f0) < 0x60) &&
> + ((cpu_id & 0x00f) > 3))
> + enable_K5_wt_alloc();
> + else if (((cpu_id & 0x0f0) > 0x80) ||
> + (((cpu_id & 0x0f0) == 0x80) &&
> + (cpu_id & 0x00f) > 0x07))
> + enable_K6_2_wt_alloc();
> + else if ((cpu_id & 0x0f0) > 0x50)
> + enable_K6_wt_alloc();
> +#endif
> + if ((cpu_id & 0xf0) == 0xa0)
> + /*
> +  * Make sure the TSC runs through
> +  * suspension, otherwise we can't use
> +  * it as timecounter
> +  */
> + wrmsr(0x1900, rdmsr(0x1900) | 0x20ULL);
> + break;
Move of the code to initialize CPU from identcpu() to initializecpu()
seems to be a fix on its own.  Since you are moving the fragments
around, would you mind start us

Re: svn commit: r270874 - in head/sys: dev/netmap net

2014-09-09 Thread Gleb Smirnoff
  Luigi,

On Mon, Sep 08, 2014 at 01:18:44PM +0200, Luigi Rizzo wrote:
L> I would appreciate if you and others could inform me _before_ touching
L> netmap-related stuff, and also, if you make changes make sure they are
L> visible to the preprocessor so i can use conditional compilations.
L> 
L> This is because this code is supposed to be the same on various FreeBSD
L> revisions
L> and Linux, and if each platform randomly changes its structures maintainance
L> becomes very hard

The patch was checked in to fix compilation failure, thus review was skipped.

Does the patch itself have any problems with visibility to preprocessor?

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


svn commit: r271307 - in head: sbin/ifconfig sys/netinet6 usr.bin/netstat

2014-09-09 Thread Andrey V. Elsukov
Author: ae
Date: Tue Sep  9 10:52:50 2014
New Revision: 271307
URL: http://svnweb.freebsd.org/changeset/base/271307

Log:
  Add the ability to set `prefer_source' flag to an IPv6 address.
  It affects the IPv6 source address selection algorithm (RFC 6724)
  and allows override the last rule ("longest matching prefix") for
  choosing among equivalent addresses. The address with `prefer_source'
  will be preferred source address.
  
  Obtained from:Yandex LLC
  MFC after:1 month
  Sponsored by: Yandex LLC

Modified:
  head/sbin/ifconfig/af_inet6.c
  head/sbin/ifconfig/ifconfig.8
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/in6_var.h
  head/usr.bin/netstat/inet6.c

Modified: head/sbin/ifconfig/af_inet6.c
==
--- head/sbin/ifconfig/af_inet6.c   Tue Sep  9 10:29:27 2014
(r271306)
+++ head/sbin/ifconfig/af_inet6.c   Tue Sep  9 10:52:50 2014
(r271307)
@@ -254,6 +254,8 @@ in6_status(int s __unused, const struct 
printf("autoconf ");
if ((flags6 & IN6_IFF_TEMPORARY) != 0)
printf("temporary ");
+   if ((flags6 & IN6_IFF_PREFER_SOURCE) != 0)
+   printf("prefer_source ");
 
if (((struct sockaddr_in6 *)(ifa->ifa_addr))->sin6_scope_id)
printf("scopeid 0x%x ",
@@ -465,6 +467,8 @@ static struct cmd inet6_cmds[] = {
DEF_CMD("-deprecated", -IN6_IFF_DEPRECATED, setip6flags),
DEF_CMD("autoconf", IN6_IFF_AUTOCONF,   setip6flags),
DEF_CMD("-autoconf",-IN6_IFF_AUTOCONF,  setip6flags),
+   DEF_CMD("prefer_source",IN6_IFF_PREFER_SOURCE,  setip6flags),
+   DEF_CMD("-prefer_source",-IN6_IFF_PREFER_SOURCE,setip6flags),
DEF_CMD("accept_rtadv", ND6_IFF_ACCEPT_RTADV,   setnd6flags),
DEF_CMD("-accept_rtadv",-ND6_IFF_ACCEPT_RTADV,  setnd6flags),
DEF_CMD("no_radr",  ND6_IFF_NO_RADR,setnd6flags),

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Tue Sep  9 10:29:27 2014
(r271306)
+++ head/sbin/ifconfig/ifconfig.8   Tue Sep  9 10:52:50 2014
(r271307)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd June 5, 2014
+.Dd September 9, 2014
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -689,6 +689,19 @@ Clear a flag
 .Cm no_prefer_iface .
 .El
 .Pp
+The following parameters are specific for IPv6 addresses.
+Note that the address family keyword
+.Dq Li inet6
+is needed for them:
+.Bl -tag -width indent
+.It Cm prefer_source
+Set a flag to prefer address as a candidate of the source address for
+outgoing packets.
+.It Cm -prefer_source
+Clear a flag
+.Cm prefer_source .
+.El
+.Pp
 The following parameters are specific to cloning
 IEEE 802.11 wireless interfaces with the
 .Cm create

Modified: head/sys/netinet6/in6_src.c
==
--- head/sys/netinet6/in6_src.c Tue Sep  9 10:29:27 2014(r271306)
+++ head/sys/netinet6/in6_src.c Tue Sep  9 10:52:50 2014(r271307)
@@ -452,6 +452,16 @@ in6_selectsrc(struct sockaddr_in6 *dstso
NEXT(9);
 
/*
+* Rule 10: prefer address with `prefer_source' flag.
+*/
+   if ((ia_best->ia6_flags & IN6_IFF_PREFER_SOURCE) == 0 &&
+   (ia->ia6_flags & IN6_IFF_PREFER_SOURCE) != 0)
+   REPLACE(10);
+   if ((ia_best->ia6_flags & IN6_IFF_PREFER_SOURCE) != 0 &&
+   (ia->ia6_flags & IN6_IFF_PREFER_SOURCE) == 0)
+   NEXT(10);
+
+   /*
 * Rule 14: Use longest matching prefix.
 * Note: in the address selection draft, this rule is
 * documented as "Rule 8".  However, since it is also

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Tue Sep  9 10:29:27 2014(r271306)
+++ head/sys/netinet6/in6_var.h Tue Sep  9 10:52:50 2014(r271307)
@@ -498,6 +498,7 @@ struct  in6_rrenumreq {
 */
 #define IN6_IFF_AUTOCONF   0x40/* autoconfigurable address. */
 #define IN6_IFF_TEMPORARY  0x80/* temporary (anonymous) address. */
+#defineIN6_IFF_PREFER_SOURCE   0x0100  /* preferred address for SAS */
 #define IN6_IFF_NOPFX  0x8000  /* skip kernel prefix management.
 * XXX: this should be temporary.
 */

Modified: head/usr.bin/netstat/inet6.c
==
--- head/usr.bin/netstat/inet6.cTue Sep  9 10:29:27 2014
(r271306)
+++ head/usr.bin/netstat/inet6.cTue Sep

svn commit: r271308 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-09-09 Thread Alexander Motin
Author: mav
Date: Tue Sep  9 11:29:55 2014
New Revision: 271308
URL: http://svnweb.freebsd.org/changeset/base/271308

Log:
  Make ZVOL writes in device mode support IO_SYNC flag.
  
  MFC after:1 month

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Tue Sep  9 
10:52:50 2014(r271307)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Tue Sep  9 
11:29:55 2014(r271308)
@@ -1633,7 +1633,7 @@ zvol_write(struct cdev *dev, struct uio 
 #ifdef sun
sync = !(zv->zv_flags & ZVOL_WCE) ||
 #else
-   sync =
+   sync = (ioflag & IO_SYNC) ||
 #endif
(zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271309 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Tue Sep  9 11:38:29 2014
New Revision: 271309
URL: http://svnweb.freebsd.org/changeset/base/271309

Log:
  Improve cache control support, including DPO/FUA flags and the mode page.
  
  At this moment it works only for files and ZVOLs in device mode since BIOs
  have no respective respective cache control flags (DPO/FUA).
  
  MFC after:1 month
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_backend_block.c
  head/sys/cam/ctl/ctl_io.h
  head/sys/cam/ctl/ctl_private.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Sep  9 11:29:55 2014(r271308)
+++ head/sys/cam/ctl/ctl.c  Tue Sep  9 11:38:29 2014(r271309)
@@ -263,7 +263,7 @@ static struct scsi_caching_page caching_
 static struct scsi_caching_page caching_page_changeable = {
/*page_code*/SMS_CACHING_PAGE,
/*page_length*/sizeof(struct scsi_caching_page) - 2,
-   /*flags1*/ 0,
+   /*flags1*/ SCP_WCE | SCP_RCD,
/*ret_priority*/ 0,
/*disable_pf_transfer_len*/ {0, 0},
/*min_prefetch*/ {0, 0},
@@ -6249,6 +6249,53 @@ ctl_control_page_handler(struct ctl_scsi
 }
 
 int
+ctl_caching_sp_handler(struct ctl_scsiio *ctsio,
+struct ctl_page_index *page_index, uint8_t *page_ptr)
+{
+   struct scsi_caching_page *current_cp, *saved_cp, *user_cp;
+   struct ctl_lun *lun;
+   int set_ua;
+   uint32_t initidx;
+
+   lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
+   initidx = ctl_get_initindex(&ctsio->io_hdr.nexus);
+   set_ua = 0;
+
+   user_cp = (struct scsi_caching_page *)page_ptr;
+   current_cp = (struct scsi_caching_page *)
+   (page_index->page_data + (page_index->page_len *
+   CTL_PAGE_CURRENT));
+   saved_cp = (struct scsi_caching_page *)
+   (page_index->page_data + (page_index->page_len *
+   CTL_PAGE_SAVED));
+
+   mtx_lock(&lun->lun_lock);
+   if ((current_cp->flags1 & (SCP_WCE | SCP_RCD)) !=
+   (user_cp->flags1 & (SCP_WCE | SCP_RCD)))
+   set_ua = 1;
+   current_cp->flags1 &= ~(SCP_WCE | SCP_RCD);
+   current_cp->flags1 |= user_cp->flags1 & (SCP_WCE | SCP_RCD);
+   saved_cp->flags1 &= ~(SCP_WCE | SCP_RCD);
+   saved_cp->flags1 |= user_cp->flags1 & (SCP_WCE | SCP_RCD);
+   if (set_ua != 0) {
+   int i;
+   /*
+* Let other initiators know that the mode
+* parameters for this LUN have changed.
+*/
+   for (i = 0; i < CTL_MAX_INITIATORS; i++) {
+   if (i == initidx)
+   continue;
+
+   lun->pending_ua[i] |= CTL_UA_MODE_CHANGE;
+   }
+   }
+   mtx_unlock(&lun->lun_lock);
+
+   return (0);
+}
+
+int
 ctl_power_sp_handler(struct ctl_scsiio *ctsio,
 struct ctl_page_index *page_index, uint8_t *page_ptr)
 {
@@ -8976,17 +9023,14 @@ ctl_read_write(struct ctl_scsiio *ctsio)
struct ctl_lba_len_flags *lbalen;
uint64_t lba;
uint32_t num_blocks;
-   int fua, dpo;
-   int retval;
+   int flags, retval;
int isread;
 
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
CTL_DEBUG_PRINT(("ctl_read_write: command: %#x\n", ctsio->cdb[0]));
 
-   fua = 0;
-   dpo = 0;
-
+   flags = 0;
retval = CTL_RETVAL_COMPLETE;
 
isread = ctsio->cdb[0] == READ_6  || ctsio->cdb[0] == READ_10
@@ -9032,12 +9076,10 @@ ctl_read_write(struct ctl_scsiio *ctsio)
struct scsi_rw_10 *cdb;
 
cdb = (struct scsi_rw_10 *)ctsio->cdb;
-
if (cdb->byte2 & SRW10_FUA)
-   fua = 1;
+   flags |= CTL_LLF_FUA;
if (cdb->byte2 & SRW10_DPO)
-   dpo = 1;
-
+   flags |= CTL_LLF_DPO;
lba = scsi_4btoul(cdb->addr);
num_blocks = scsi_2btoul(cdb->length);
break;
@@ -9046,17 +9088,9 @@ ctl_read_write(struct ctl_scsiio *ctsio)
struct scsi_write_verify_10 *cdb;
 
cdb = (struct scsi_write_verify_10 *)ctsio->cdb;
-
-   /*
-* XXX KDM we should do actual write verify support at some
-* point.  This is obviously fake, we're just translating
-* things to a write.  So we don't even bother checking the
-* BYTCHK field, since we don't do any verification.  If
-* the user asks for it, we'll just pretend we did it.
-*/
+   flags |= CTL_LLF_FUA;
if (cdb->byte2 & SWV_DPO)
-   dpo = 1;
-
+   flags |= CTL_LLF_DPO;
lba 

Re: svn commit: r270759 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs vm

2014-09-09 Thread Slawa Olhovchenkov
On Mon, Sep 08, 2014 at 11:17:51AM -0400, John Baldwin wrote:

> On Sunday, September 07, 2014 04:56:49 PM Slawa Olhovchenkov wrote:
> > PS: very bad that 'data limit' don't anymore reflect application
> > memory consumer. and very small application can adapt to 'no memory'
> > from system.
> 
> You can use RLIMIT_AS instead of RLIMIT_DATA.  jemalloc can also be 
> configured 
> to use sbrk(), though I think there's no way to prevent it from falling back 
> to mmap(MAP_ANON) if sbrk() fails.

Formally you are right. Realy this is scorn. And I don't know how
rightly. May be account in RLIMIT_DATA MAP_ANON? Anyway firefox don't
run GC if malloc fail and this is bad.

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


svn commit: r271310 - head/sys/arm/include

2014-09-09 Thread Ian Lepore
Author: ian
Date: Tue Sep  9 13:50:21 2014
New Revision: 271310
URL: http://svnweb.freebsd.org/changeset/base/271310

Log:
  Rename new to newval in inline asm code, to avoid clashes with C++ new.
  Also rename cmp to cmpval just to keep the asm variable names similar to
  the C variable names.

Modified:
  head/sys/arm/include/atomic.h

Modified: head/sys/arm/include/atomic.h
==
--- head/sys/arm/include/atomic.h   Tue Sep  9 11:38:29 2014
(r271309)
+++ head/sys/arm/include/atomic.h   Tue Sep  9 13:50:21 2014
(r271310)
@@ -268,12 +268,12 @@ atomic_cmpset_64(volatile uint64_t *p, u
__asm __volatile(
"1:  \n"
"   ldrexd   %[tmp], [%[ptr]]\n"
-   "   teq  %Q[tmp], %Q[cmp]\n"
+   "   teq  %Q[tmp], %Q[cmpval]\n"
"   itee eq  \n"
-   "   teqeq%R[tmp], %R[cmp]\n"
+   "   teqeq%R[tmp], %R[cmpval]\n"
"   movne%[ret], #0\n"
"   bne  2f\n"
-   "   strexd   %[ret], %[new], [%[ptr]]\n"
+   "   strexd   %[ret], %[newval], [%[ptr]]\n"
"   teq  %[ret], #0\n"
"   it ne\n"
"   bne  1b\n"
@@ -282,8 +282,8 @@ atomic_cmpset_64(volatile uint64_t *p, u
:   [ret]"=&r"  (ret), 
[tmp]"=&r"  (tmp)
:   [ptr]"r"(p), 
-   [cmp]"r"(cmpval), 
-   [new]"r"(newval)
+   [cmpval] "r"(cmpval), 
+   [newval] "r"(newval)
:   "cc", "memory");
return (ret);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271311 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Tue Sep  9 14:09:51 2014
New Revision: 271311
URL: http://svnweb.freebsd.org/changeset/base/271311

Log:
  Add support for Mode Page Policy (0x87) VPD page.

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Sep  9 13:50:21 2014(r271310)
+++ head/sys/cam/ctl/ctl.c  Tue Sep  9 14:09:51 2014(r271311)
@@ -320,10 +320,11 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verb
 
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
+ * Mode Page Policy (0x87),
  * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0),
  * Block Device Characteristics (0xB1) and Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES  8
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES  9
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
  int param);
@@ -379,6 +380,7 @@ static void ctl_hndl_per_res_out_on_othe
 static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len);
+static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio,
 int alloc_len);
 static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio,
@@ -9831,16 +9833,18 @@ ctl_inquiry_evpd_supported(struct ctl_sc
pages->page_list[1] = SVPD_UNIT_SERIAL_NUMBER;
/* Device Identification */
pages->page_list[2] = SVPD_DEVICE_ID;
+   /* Mode Page Policy */
+   pages->page_list[3] = SVPD_MODE_PAGE_POLICY;
/* SCSI Ports */
-   pages->page_list[3] = SVPD_SCSI_PORTS;
+   pages->page_list[4] = SVPD_SCSI_PORTS;
/* Third-party Copy */
-   pages->page_list[4] = SVPD_SCSI_TPC;
+   pages->page_list[5] = SVPD_SCSI_TPC;
/* Block limits */
-   pages->page_list[5] = SVPD_BLOCK_LIMITS;
+   pages->page_list[6] = SVPD_BLOCK_LIMITS;
/* Block Device Characteristics */
-   pages->page_list[6] = SVPD_BDC;
+   pages->page_list[7] = SVPD_BDC;
/* Logical Block Provisioning */
-   pages->page_list[7] = SVPD_LBP;
+   pages->page_list[8] = SVPD_LBP;
 
ctsio->scsi_status = SCSI_STATUS_OK;
 
@@ -9909,6 +9913,58 @@ ctl_inquiry_evpd_serial(struct ctl_scsii
 
 
 static int
+ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len)
+{
+   struct scsi_vpd_mode_page_policy *mpp_ptr;
+   struct ctl_lun *lun;
+   int data_len;
+
+   lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
+
+   data_len = sizeof(struct scsi_vpd_mode_page_policy) +
+   sizeof(struct scsi_vpd_mode_page_policy_descr);
+
+   ctsio->kern_data_ptr = malloc(data_len, M_CTL, M_WAITOK | M_ZERO);
+   mpp_ptr = (struct scsi_vpd_mode_page_policy *)ctsio->kern_data_ptr;
+   ctsio->kern_sg_entries = 0;
+
+   if (data_len < alloc_len) {
+   ctsio->residual = alloc_len - data_len;
+   ctsio->kern_data_len = data_len;
+   ctsio->kern_total_len = data_len;
+   } else {
+   ctsio->residual = 0;
+   ctsio->kern_data_len = alloc_len;
+   ctsio->kern_total_len = alloc_len;
+   }
+   ctsio->kern_data_resid = 0;
+   ctsio->kern_rel_offset = 0;
+   ctsio->kern_sg_entries = 0;
+
+   /*
+* The control device is always connected.  The disk device, on the
+* other hand, may not be online all the time.
+*/
+   if (lun != NULL)
+   mpp_ptr->device = (SID_QUAL_LU_CONNECTED << 5) |
+lun->be_lun->lun_type;
+   else
+   mpp_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
+   mpp_ptr->page_code = SVPD_MODE_PAGE_POLICY;
+   scsi_ulto2b(data_len - 4, mpp_ptr->page_length);
+   mpp_ptr->descr[0].page_code = 0x3f;
+   mpp_ptr->descr[0].subpage_code = 0xff;
+   mpp_ptr->descr[0].policy = SVPD_MPP_SHARED;
+
+   ctsio->scsi_status = SCSI_STATUS_OK;
+   ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
+   ctsio->be_move_done = ctl_config_move_done;
+   ctl_datamove((union ctl_io *)ctsio);
+
+   return (CTL_RETVAL_COMPLETE);
+}
+
+static int
 ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len)
 {
struct scsi_vpd_device_id *devid_ptr;
@@ -10338,6 +10394,9 @@ ctl_inquiry_evpd(struct ctl_scsiio *ctsi
case SVPD_DEVICE_ID:
retval = ctl_inquiry_evpd_devid(ctsio, alloc_len);
break;
+   case SVPD_MODE_PAGE_POLICY:
+   retval = ctl_inquiry_evpd_mpp(ctsio, alloc_len);
+   break;
case SVPD_SCSI_PORTS:
retval = ctl_inquiry_e

svn commit: r271312 - head/sys/dev/vt

2014-09-09 Thread Aleksandr Rybalko
Author: ray
Date: Tue Sep  9 14:18:56 2014
New Revision: 271312
URL: http://svnweb.freebsd.org/changeset/base/271312

Log:
  Revert r269474. Special keyboard combinations should be handled by separate
  sysctls.

Modified:
  head/sys/dev/vt/vt.h
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hTue Sep  9 14:09:51 2014(r271311)
+++ head/sys/dev/vt/vt.hTue Sep  9 14:18:56 2014(r271312)
@@ -87,12 +87,6 @@ static int vt_##_name = _default;
\
 SYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RWTUN, &vt_##_name, _default,\
_descr);
 
-/* Allow to disable some special keys by users. */
-#defineVT_DEBUG_KEY_ENABLED(1 << 0)
-#defineVT_REBOOT_KEY_ENABLED   (1 << 1)
-#defineVT_HALT_KEY_ENABLED (1 << 2)
-#defineVT_POWEROFF_KEY_ENABLED (1 << 3)
-
 struct vt_driver;
 
 void vt_allocate(struct vt_driver *, void *);

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Tue Sep  9 14:09:51 2014(r271311)
+++ head/sys/dev/vt/vt_core.c   Tue Sep  9 14:18:56 2014(r271312)
@@ -122,9 +122,6 @@ VT_SYSCTL_INT(enable_altgr, 1, "Enable A
 VT_SYSCTL_INT(debug, 0, "vt(9) debug level");
 VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode");
 VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend");
-VT_SYSCTL_INT(spclkeys, (VT_DEBUG_KEY_ENABLED|VT_REBOOT_KEY_ENABLED|
-VT_HALT_KEY_ENABLED|VT_POWEROFF_KEY_ENABLED), "Enabled special keys "
-"handled by vt(4)");
 
 static struct vt_devicevt_consdev;
 static unsigned int vt_unit = 0;
@@ -488,21 +485,17 @@ vt_machine_kbdevent(int c)
 
switch (c) {
case SPCLKEY | DBG:
-   if (vt_spclkeys & VT_DEBUG_KEY_ENABLED)
-   kdb_enter(KDB_WHY_BREAK, "manual escape to debugger");
+   kdb_enter(KDB_WHY_BREAK, "manual escape to debugger");
return (1);
case SPCLKEY | RBT:
-   if (vt_spclkeys & VT_REBOOT_KEY_ENABLED)
-   /* XXX: Make this configurable! */
-   shutdown_nice(0);
+   /* XXX: Make this configurable! */
+   shutdown_nice(0);
return (1);
case SPCLKEY | HALT:
-   if (vt_spclkeys & VT_HALT_KEY_ENABLED)
-   shutdown_nice(RB_HALT);
+   shutdown_nice(RB_HALT);
return (1);
case SPCLKEY | PDWN:
-   if (vt_spclkeys & VT_POWEROFF_KEY_ENABLED)
-   shutdown_nice(RB_HALT|RB_POWEROFF);
+   shutdown_nice(RB_HALT|RB_POWEROFF);
return (1);
};
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271313 - head/sys/cam/scsi

2014-09-09 Thread Alexander Motin
Author: mav
Date: Tue Sep  9 14:20:55 2014
New Revision: 271313
URL: http://svnweb.freebsd.org/changeset/base/271313

Log:
  Oops, missed piece of r271311.

Modified:
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hTue Sep  9 14:18:56 2014
(r271312)
+++ head/sys/cam/scsi/scsi_all.hTue Sep  9 14:20:55 2014
(r271313)
@@ -2110,6 +2110,27 @@ struct scsi_service_action_in
uint8_t control;
 };
 
+struct scsi_vpd_mode_page_policy_descr
+{
+   uint8_t page_code;
+   uint8_t subpage_code;
+   uint8_t policy;
+#defineSVPD_MPP_SHARED 0x00
+#defineSVPD_MPP_PORT   0x01
+#defineSVPD_MPP_I_T0x03
+#defineSVPD_MPP_MLUS   0x80
+   uint8_t reserved;
+};
+
+struct scsi_vpd_mode_page_policy
+{
+   uint8_t device;
+   uint8_t page_code;
+#defineSVPD_MODE_PAGE_POLICY   0x87
+   uint8_t page_length[2];
+   struct scsi_vpd_mode_page_policy_descr descr[0];
+};
+
 struct scsi_diag_page {
uint8_t page_code;
uint8_t page_specific_flags;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r269474 - in head: share/man/man4 sys/dev/vt

2014-09-09 Thread Aleksandr Rybalko
On Tue, 12 Aug 2014 13:17:55 +1000 (EST)
Bruce Evans  wrote:

> On Mon, 11 Aug 2014, John Baldwin wrote:
> 
> > On Monday, August 04, 2014 8:03:58 pm Bruce Evans wrote:
> >> On Mon, 4 Aug 2014, John Baldwin wrote:
> >>> I realize the API uses 'SPCL' as an abbreviation, but for user-facing 
> >>> things like a sysctl and tunable, I think it might be better to spell it 
> >>> out as
> > "specialkeys" instead?
> >>
> >> It is a bad name, and also gratuitously different from syscons where the
> >> names are:
> >>
> >>  hw.syscons.kbd_reboot
> >>  hw.syscons.kbd_debug
> >>  hw.syscons.sc_no_suspend_vtswitch
> >
> > I would prefer individual nodes for vt along these lines as I think it is
> > clearer to the user ("what exactly constitutes a special key?")
> 
> But rename them a bit so it is clearer that they give limited access
> control.  The sysctl -d descriptions are no better about this:
> 
> % hw.syscons.kbd_reboot: enable keyboard reboot
> % hw.syscons.kbd_debug: enable keyboard debug
> % hw.syscons.sc_no_suspend_vtswitch: Disable VT switch before suspend.
> 
> These also have some style bugs ("enable" is not capitalized; the last
> description is terminated).
> 
> The option name SC_DISABLE_KDBKEY is better.  It more clearly controls
> a key, not debugging.  The option name SC_DISABLE_REBOOT is no better.
> 
> Bruce

Hello John, Bruce and other hackers!

I did revert r269474, but not commit yet new version.
Instead, I've put new version into phabricator.
Please look it here https://reviews.freebsd.org/D747.

Thanks a lot for your hints/comments.
And sorry for long delay.

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


svn commit: r271314 - head/share/man/man9

2014-09-09 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Sep  9 14:31:56 2014
New Revision: 271314
URL: http://svnweb.freebsd.org/changeset/base/271314

Log:
  - Add missing "
  - Sort sections

Modified:
  head/share/man/man9/sysctl.9

Modified: head/share/man/man9/sysctl.9
==
--- head/share/man/man9/sysctl.9Tue Sep  9 14:20:55 2014
(r271313)
+++ head/share/man/man9/sysctl.9Tue Sep  9 14:31:56 2014
(r271314)
@@ -105,7 +105,7 @@
 .Fa "void *ptr"
 .Fa "intptr_t len"
 .Fa "const char *format"
-.Fa "const char *descr
+.Fa "const char *descr"
 .Fc
 .Ft struct sysctl_oid *
 .Fo SYSCTL_ADD_PROC
@@ -505,49 +505,6 @@ enviroment early during module load or s
 .It Dv CTLFLAG_DYN
 Dynamically created OIDs automatically get this flag set.
 .El
-.Sh SECURITY CONSIDERATIONS
-When creating new sysctls, careful attention should be paid to the security
-implications of the monitoring or management interface being created.
-Most sysctls present in the kernel are read-only or writable only by the
-superuser.
-Sysctls exporting extensive information on system data structures and
-operation, especially those implemented using procedures, will wish to
-implement access control to limit the undesired exposure of information about
-other processes, network connections, etc.
-.Pp
-The following top level sysctl name spaces are commonly used:
-.Bl -tag -width ".Va regression"
-.It Va compat
-Compatibility layer information.
-.It Va debug
-Debugging information.
-Various name spaces exist under
-.Va debug .
-.It Va hw
-Hardware and device driver information.
-.It Va kern
-Kernel behavior tuning; generally deprecated in favor of more specific
-name spaces.
-.It Va machdep
-Machine-dependent configuration parameters.
-.It Va net
-Network subsystem.
-Various protocols have name spaces under
-.Va net .
-.It Va regression
-Regression test configuration and information.
-.It Va security
-Security and security-policy configuration and information.
-.It Va sysctl
-Reserved name space for the implementation of sysctl.
-.It Va user
-Configuration settings relating to user application behavior.
-Generally, configuring applications using kernel sysctls is discouraged.
-.It Va vfs
-Virtual file system configuration and information.
-.It Va vm
-Virtual memory subsystem configuration and information.
-.El
 .Sh EXAMPLES
 Sample use of
 .Fn SYSCTL_DECL
@@ -702,3 +659,46 @@ addition of MIB nodes.
 .Pp
 This man page was written by
 .An Robert N. M. Watson .
+.Sh SECURITY CONSIDERATIONS
+When creating new sysctls, careful attention should be paid to the security
+implications of the monitoring or management interface being created.
+Most sysctls present in the kernel are read-only or writable only by the
+superuser.
+Sysctls exporting extensive information on system data structures and
+operation, especially those implemented using procedures, will wish to
+implement access control to limit the undesired exposure of information about
+other processes, network connections, etc.
+.Pp
+The following top level sysctl name spaces are commonly used:
+.Bl -tag -width ".Va regression"
+.It Va compat
+Compatibility layer information.
+.It Va debug
+Debugging information.
+Various name spaces exist under
+.Va debug .
+.It Va hw
+Hardware and device driver information.
+.It Va kern
+Kernel behavior tuning; generally deprecated in favor of more specific
+name spaces.
+.It Va machdep
+Machine-dependent configuration parameters.
+.It Va net
+Network subsystem.
+Various protocols have name spaces under
+.Va net .
+.It Va regression
+Regression test configuration and information.
+.It Va security
+Security and security-policy configuration and information.
+.It Va sysctl
+Reserved name space for the implementation of sysctl.
+.It Va user
+Configuration settings relating to user application behavior.
+Generally, configuring applications using kernel sysctls is discouraged.
+.It Va vfs
+Virtual file system configuration and information.
+.It Va vm
+Virtual memory subsystem configuration and information.
+.El
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2014-09-09 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Sep  9 14:34:54 2014
New Revision: 271315
URL: http://svnweb.freebsd.org/changeset/base/271315

Log:
  Minor mdoc nit.

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

Modified: head/lib/libc/sys/kqueue.2
==
--- head/lib/libc/sys/kqueue.2  Tue Sep  9 14:31:56 2014(r271314)
+++ head/lib/libc/sys/kqueue.2  Tue Sep  9 14:34:54 2014(r271315)
@@ -478,7 +478,6 @@ is in microseconds.
 .It Dv NOTE_NSECONDS
 .Va data
 is in nanoseconds.
-.It
 .El
 .Pp
 If
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271316 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Tue Sep  9 15:19:38 2014
New Revision: 271316
URL: http://svnweb.freebsd.org/changeset/base/271316

Log:
  Report that DPO and FUA bits are supported after r271311.

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Sep  9 14:34:54 2014(r271315)
+++ head/sys/cam/ctl/ctl.c  Tue Sep  9 15:19:38 2014(r271316)
@@ -7057,7 +7057,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
header = (struct scsi_mode_hdr_6 *)ctsio->kern_data_ptr;
 
header->datalen = ctl_min(total_len - 1, 254);
-
+   if (control_dev == 0)
+   header->dev_specific = 0x10; /* DPOFUA */
if (dbd)
header->block_descr_len = 0;
else
@@ -7074,6 +7075,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 
datalen = ctl_min(total_len - 2, 65533);
scsi_ulto2b(datalen, header->datalen);
+   if (control_dev == 0)
+   header->dev_specific = 0x10; /* DPOFUA */
if (dbd)
scsi_ulto2b(0, header->block_descr_len);
else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r270698 - in head: etc share/man/man5

2014-09-09 Thread Andriy Gapon
on 27/08/2014 12:19 Hiroki Sato said the following:
>  For jail configurations you could use the file
>  .Pa /etc/rc.conf.d/jail
>  to store jail specific configuration options.
> +If
> +.Va local_startup
> +contains
> +.Pa /usr/local/etc/rc.d
> +and
> +.Pa /opt/conf ,
> +.Pa /usr/local/rc.conf.d/jail

It seems that the above should be /usr/local/etc/rc.conf.d/jail (note "etc").

> +and
> +.Pa /opt/conf/rc.conf.d/jail
> +will be loaded.
> +If
> +.Ao Ar dir Ac Ns Pa /rc.conf.d/ Ns Ao Ar name Ac
> +is a directory,
> +all of files in the directory will be loaded.


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


svn commit: r271317 - head/sys/kern

2014-09-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep  9 16:05:33 2014
New Revision: 271317
URL: http://svnweb.freebsd.org/changeset/base/271317

Log:
  Avoid unlocking unlocked mutex in RCTL jail code.  Specific test case
  is attached to PR.
  
  PR:   193457
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Tue Sep  9 15:19:38 2014(r271316)
+++ head/sys/kern/kern_jail.c   Tue Sep  9 16:05:33 2014(r271317)
@@ -1812,9 +1812,11 @@ kern_jail_set(struct thread *td, struct 
 
 #ifdef RACCT
if (!created) {
-   sx_sunlock(&allprison_lock);
+   if (!(flags & JAIL_ATTACH))
+   sx_sunlock(&allprison_lock);
prison_racct_modify(pr);
-   sx_slock(&allprison_lock);
+   if (!(flags & JAIL_ATTACH))
+   sx_slock(&allprison_lock);
}
 #endif
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271319 - head/usr.sbin/ctld

2014-09-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep  9 16:45:36 2014
New Revision: 271319
URL: http://svnweb.freebsd.org/changeset/base/271319

Log:
  Fix ctld(8) to not forget to send TargetPortalGroupTag and TargetAlias
  when the initiator skips security negotiation.  This fixes interoperability
  with Xtend SAN initiator.
  
  PR:   193021
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/login.c

Modified: head/usr.sbin/ctld/login.c
==
--- head/usr.sbin/ctld/login.c  Tue Sep  9 16:11:04 2014(r271318)
+++ head/usr.sbin/ctld/login.c  Tue Sep  9 16:45:36 2014(r271319)
@@ -785,7 +785,8 @@ login_negotiate(struct connection *conn,
struct pdu *response;
struct iscsi_bhs_login_response *bhslr2;
struct keys *request_keys, *response_keys;
-   int i;
+   char *portal_group_tag;
+   int i, rv;
bool skipped_security;
 
if (request == NULL) {
@@ -806,6 +807,21 @@ login_negotiate(struct connection *conn,
login_set_csg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION);
login_set_nsg(response, BHSLR_STAGE_FULL_FEATURE_PHASE);
response_keys = keys_new();
+
+   if (skipped_security &&
+   conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) {
+   if (conn->conn_target->t_alias != NULL)
+   keys_add(response_keys,
+   "TargetAlias", conn->conn_target->t_alias);
+   rv = asprintf(&portal_group_tag, "%d",
+   conn->conn_portal->p_portal_group->pg_tag);
+   if (rv <= 0)
+   log_err(1, "asprintf");
+   keys_add(response_keys,
+   "TargetPortalGroupTag", portal_group_tag);
+   free(portal_group_tag);
+   }
+
for (i = 0; i < KEYS_MAX; i++) {
if (request_keys->keys_names[i] == NULL)
break;
@@ -1069,6 +1085,9 @@ login(struct connection *conn)
response_keys = keys_new();
keys_add(response_keys, "AuthMethod", "CHAP");
if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) {
+   if (conn->conn_target->t_alias != NULL)
+   keys_add(response_keys,
+   "TargetAlias", conn->conn_target->t_alias);
rv = asprintf(&portal_group_tag, "%d",
conn->conn_portal->p_portal_group->pg_tag);
if (rv <= 0)
@@ -1076,9 +1095,6 @@ login(struct connection *conn)
keys_add(response_keys,
"TargetPortalGroupTag", portal_group_tag);
free(portal_group_tag);
-   if (conn->conn_target->t_alias != NULL)
-   keys_add(response_keys,
-   "TargetAlias", conn->conn_target->t_alias);
}
keys_save(response_keys, response);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271320 - head/usr.sbin/ctld

2014-09-09 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Sep  9 16:57:02 2014
New Revision: 271320
URL: http://svnweb.freebsd.org/changeset/base/271320

Log:
  Use keys_add_int() where appropriate.  No functional changes.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/login.c

Modified: head/usr.sbin/ctld/login.c
==
--- head/usr.sbin/ctld/login.c  Tue Sep  9 16:45:36 2014(r271319)
+++ head/usr.sbin/ctld/login.c  Tue Sep  9 16:57:02 2014(r271320)
@@ -785,8 +785,7 @@ login_negotiate(struct connection *conn,
struct pdu *response;
struct iscsi_bhs_login_response *bhslr2;
struct keys *request_keys, *response_keys;
-   char *portal_group_tag;
-   int i, rv;
+   int i;
bool skipped_security;
 
if (request == NULL) {
@@ -813,13 +812,8 @@ login_negotiate(struct connection *conn,
if (conn->conn_target->t_alias != NULL)
keys_add(response_keys,
"TargetAlias", conn->conn_target->t_alias);
-   rv = asprintf(&portal_group_tag, "%d",
+   keys_add_int(response_keys, "TargetPortalGroupTag", 
conn->conn_portal->p_portal_group->pg_tag);
-   if (rv <= 0)
-   log_err(1, "asprintf");
-   keys_add(response_keys,
-   "TargetPortalGroupTag", portal_group_tag);
-   free(portal_group_tag);
}
 
for (i = 0; i < KEYS_MAX; i++) {
@@ -852,8 +846,6 @@ login(struct connection *conn)
struct auth_group *ag;
const char *initiator_name, *initiator_alias, *session_type,
*target_name, *auth_method;
-   char *portal_group_tag;
-   int rv;
 
/*
 * Handle the initial Login Request - figure out required authentication
@@ -1032,13 +1024,8 @@ login(struct connection *conn)
if (conn->conn_target->t_alias != NULL)
keys_add(response_keys,
"TargetAlias", conn->conn_target->t_alias);
-   rv = asprintf(&portal_group_tag, "%d",
+   keys_add_int(response_keys, "TargetPortalGroupTag", 
conn->conn_portal->p_portal_group->pg_tag);
-   if (rv <= 0)
-   log_err(1, "asprintf");
-   keys_add(response_keys,
-   "TargetPortalGroupTag", portal_group_tag);
-   free(portal_group_tag);
}
keys_save(response_keys, response);
pdu_send(response);
@@ -1088,13 +1075,8 @@ login(struct connection *conn)
if (conn->conn_target->t_alias != NULL)
keys_add(response_keys,
"TargetAlias", conn->conn_target->t_alias);
-   rv = asprintf(&portal_group_tag, "%d",
+   keys_add_int(response_keys, "TargetPortalGroupTag", 
conn->conn_portal->p_portal_group->pg_tag);
-   if (rv <= 0)
-   log_err(1, "asprintf");
-   keys_add(response_keys,
-   "TargetPortalGroupTag", portal_group_tag);
-   free(portal_group_tag);
}
keys_save(response_keys, response);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271321 - head/etc/periodic/daily

2014-09-09 Thread Bryan Drewery
Author: bdrewery
Date: Tue Sep  9 17:03:58 2014
New Revision: 271321
URL: http://svnweb.freebsd.org/changeset/base/271321

Log:
  Don't cross mount boundaries when cleaning tmp files.
  
  Mounting something in /tmp such as a build jail with nullfs mounts for
  some directories can result in very surprising results the next day.
  
  MFC after:2 weeks
  Relnotes: yes

Modified:
  head/etc/periodic/daily/110.clean-tmps

Modified: head/etc/periodic/daily/110.clean-tmps
==
--- head/etc/periodic/daily/110.clean-tmps  Tue Sep  9 16:57:02 2014
(r271320)
+++ head/etc/periodic/daily/110.clean-tmps  Tue Sep  9 17:03:58 2014
(r271321)
@@ -45,8 +45,8 @@ case "$daily_clean_tmps_enable" in
rc=$(for dir in $daily_clean_tmps_dirs
do
[ ."${dir#/}" != ."$dir" -a -d $dir ] && cd $dir && {
-   find -d . -type f $args -delete $print
-   find -d . ! -name . -type d $dargs -delete $print
+   find -x -d . -type f $args -delete $print
+   find -x -d . ! -name . -type d $dargs -delete $print
} | sed "s,^\\.,  $dir,"
done | tee /dev/stderr | wc -l)
[ -z "$print" ] && rc=0
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271328 - head/sys/dev/cxgbe

2014-09-09 Thread Navdeep Parhar
Author: np
Date: Tue Sep  9 18:36:00 2014
New Revision: 271328
URL: http://svnweb.freebsd.org/changeset/base/271328

Log:
  Whitespace nit.
  
  MFC after:1 week

Modified:
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/t4_netmap.c
==
--- head/sys/dev/cxgbe/t4_netmap.c  Tue Sep  9 18:17:43 2014
(r271327)
+++ head/sys/dev/cxgbe/t4_netmap.c  Tue Sep  9 18:36:00 2014
(r271328)
@@ -377,7 +377,7 @@ alloc_nm_txq_hwq(struct port_info *pi, s
 
nm_txq->pidx = nm_txq->cidx = 0;
MPASS(nm_txq->sidx == na->num_tx_desc);
-   nm_txq->equiqidx = nm_txq-> equeqidx = nm_txq->dbidx = 0;
+   nm_txq->equiqidx = nm_txq->equeqidx = nm_txq->dbidx = 0;
 
nm_txq->doorbells = sc->doorbells;
if (isset(&nm_txq->doorbells, DOORBELL_UDB) ||
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271331 - in head/release/doc: en_US.ISO8859-1/share/xml share/mk share/xml

2014-09-09 Thread Glen Barber
Author: gjb
Date: Tue Sep  9 19:51:57 2014
New Revision: 271331
URL: http://svnweb.freebsd.org/changeset/base/271331

Log:
  Change how the recommended mailing list to track is
  added to the footer of the release/doc/ pages by
  moving a hard-coded value (that is subject to human
  error to change) to release.ent where other values
  are regularly changed, and adding parsing logic to
  release.xsl.
  
  Approved by:  re (implicit)
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/doc/en_US.ISO8859-1/share/xml/release.xsl
  head/release/doc/share/mk/doc.relnotes.mk
  head/release/doc/share/xml/release.ent
  head/release/doc/share/xml/release.xsl

Modified: head/release/doc/en_US.ISO8859-1/share/xml/release.xsl
==
--- head/release/doc/en_US.ISO8859-1/share/xml/release.xsl  Tue Sep  9 
19:47:35 2014(r271330)
+++ head/release/doc/en_US.ISO8859-1/share/xml/release.xsl  Tue Sep  9 
19:51:57 2014(r271331)
@@ -8,6 +8,7 @@
 
   
   
+  
 
   
 This file, and other release-related documents,
@@ -18,7 +19,7 @@
   contacting questi...@freebsd.org>.
 
 All users of FreeBSD  should
-  subscribe to the curr...@freebsd.org>
+  subscribe to the @FreeBSD.org>
   mailing list.
   
 For questions about this documentation,

Modified: head/release/doc/share/mk/doc.relnotes.mk
==
--- head/release/doc/share/mk/doc.relnotes.mk   Tue Sep  9 19:47:35 2014
(r271330)
+++ head/release/doc/share/mk/doc.relnotes.mk   Tue Sep  9 19:51:57 2014
(r271331)
@@ -6,6 +6,7 @@ DOC_PREFIX?= ${RELN_ROOT}/../../../doc
 RELEASETYPE!= grep -o 'release.type "[a-z]*"' 
${RELN_ROOT}/share/xml/release.ent | sed 's|[a-z.]* "\([a-z]*\)"|\1|'
 RELEASEURL!= grep -o 'release.url \"[^\"]*\"' 
${RELN_ROOT}/share/xml/release.ent | sed 's|[^ ]* "\([^"]*\)"|\1|'
 RELEASEBRANCH!= grep -o 'release.branch "\([^"]*\)"' 
${RELN_ROOT}/share/xml/release.ent | sed 's|[^ ]* "\([^"]*\)"|\1|'
+RELEASEMAILLIST!= grep -o 'release.maillist "\([^"]*\)"' 
${RELN_ROOT}/share/xml/release.ent | sed 's|[^ ]* "\([^"]*\)"|\1|'
 .if ${RELEASETYPE} == "current"
 PROFILING+= --param profile.attribute "'releasetype'" --param profile.value 
"'current'"
 .elif ${RELEASETYPE} == "snapshot"
@@ -15,6 +16,7 @@ PROFILING+= --param profile.attribute "'
 .endif
 XSLTPROCFLAGS+= --param release.url "'${RELEASEURL}'"
 XSLTPROCFLAGS+= --param release.branch "'${RELEASEBRANCH}'"
+XSLTPROCFLAGS+= --param release.maillist "'${RELEASEMAILLIST}'"
 
 # Find the RELNOTESng document catalogs
 EXTRA_CATALOGS+= file://${RELN_ROOT}/${LANGCODE}/share/xml/catalog.xml \

Modified: head/release/doc/share/xml/release.ent
==
--- head/release/doc/share/xml/release.ent  Tue Sep  9 19:47:35 2014
(r271330)
+++ head/release/doc/share/xml/release.ent  Tue Sep  9 19:51:57 2014
(r271331)
@@ -27,6 +27,9 @@
 
 http://www.FreeBSD.org/snapshots/";>
 
+
+
+
 
 

svn commit: r271332 - head/release/doc/share/xml

2014-09-09 Thread Glen Barber
Author: gjb
Date: Tue Sep  9 19:58:55 2014
New Revision: 271332
URL: http://svnweb.freebsd.org/changeset/base/271332

Log:
  Add an arch.powerpc64 entity.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/doc/share/xml/release.ent

Modified: head/release/doc/share/xml/release.ent
==
--- head/release/doc/share/xml/release.ent  Tue Sep  9 19:51:57 2014
(r271331)
+++ head/release/doc/share/xml/release.ent  Tue Sep  9 19:58:55 2014
(r271332)
@@ -71,6 +71,7 @@
 
 
 
+
 
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271336 - head/tools/regression/lib/msun

2014-09-09 Thread Garrett Cooper
Author: ngie
Date: Tue Sep  9 22:14:15 2014
New Revision: 271336
URL: http://svnweb.freebsd.org/changeset/base/271336

Log:
  Expand the tests structure in test_small(..) to workaround the
  "initializer not constant" warning with gcc
  
  Approved by: jmmv (mentor)
  MFC after: 3 days
  Phabric: D744
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tools/regression/lib/msun/test-invctrig.c

Modified: head/tools/regression/lib/msun/test-invctrig.c
==
--- head/tools/regression/lib/msun/test-invctrig.c  Tue Sep  9 21:13:47 
2014(r271335)
+++ head/tools/regression/lib/msun/test-invctrig.c  Tue Sep  9 22:14:15 
2014(r271336)
@@ -315,25 +315,20 @@ test_small(void)
 * asin(z) = Pi/4 + i ln(2)/2
 * atan(z) = atan(4)/2 + i ln(17/9)/4
 */
-   static const struct {
-   complex long double z;
-   complex long double acos_z;
-   complex long double asin_z;
-   complex long double atan_z;
-   } tests[] = {
-   { CMPLXL(0.75L, 0.25L),
- CMPLXL(pi / 4, -0.34657359027997265470861606072908828L),
- CMPLXL(pi / 4, 0.34657359027997265470861606072908828L),
- CMPLXL(0.66290883183401623252961960521423782L,
-0.1589971916717436476103600701878L) },
-   };
-   int i;
-
-   for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
-   testall_tol(cacos, tests[i].z, tests[i].acos_z, 2);
-   testall_odd_tol(casin, tests[i].z, tests[i].asin_z, 2);
-   testall_odd_tol(catan, tests[i].z, tests[i].atan_z, 2);
-}
+   complex long double z;
+   complex long double acos_z;
+   complex long double asin_z;
+   complex long double atan_z;
+
+   z = CMPLXL(0.75L, 0.25L);
+   acos_z = CMPLXL(pi / 4, -0.34657359027997265470861606072908828L);
+   asin_z = CMPLXL(pi / 4, 0.34657359027997265470861606072908828L);
+   atan_z = CMPLXL(0.66290883183401623252961960521423782L,
+0.1589971916717436476103600701878L);
+
+   testall_tol(cacos, z, acos_z, 2);
+   testall_odd_tol(casin, z, asin_z, 2);
+   testall_odd_tol(catan, z, atan_z, 2);
 }
 
 /* Test inputs that might cause overflow in a sloppy implementation. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271338 - head/usr.sbin/bhyve

2014-09-09 Thread Peter Grehan
Author: grehan
Date: Tue Sep  9 22:35:02 2014
New Revision: 271338
URL: http://svnweb.freebsd.org/changeset/base/271338

Log:
  Allow vtnet operation without merged rx buffers.
  
  NetBSD's virtio-net implementation doesn't negotiate
  the merged rx-buffers feature. To support this, check
  to see if the feature was negotiated, and then adjust
  the operation of the receive path accordingly by using
  a larger iovec, and a smaller rx header.
  In addition, ignore writes to the (read-only) status byte.
  
  Tested with NetBSD/amd64 5.2.2, 6.1.4 and 7-beta.
  
  Reviewed by:  neel, tychon
  Phabric:  D745
  MFC after:3 days

Modified:
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==
--- head/usr.sbin/bhyve/pci_virtio_net.cTue Sep  9 22:24:01 2014
(r271337)
+++ head/usr.sbin/bhyve/pci_virtio_net.cTue Sep  9 22:35:02 2014
(r271338)
@@ -135,11 +135,14 @@ struct pci_vtnet_softc {
int vsc_rx_ready;
volatile intresetting;  /* set and checked outside lock */
 
-   uint32_tvsc_features;
+   uint64_tvsc_features;   /* negotiated features */
+   
struct virtio_net_config vsc_config;
 
pthread_mutex_t rx_mtx;
int rx_in_progress;
+   int rx_vhdrlen;
+   int rx_merge;   /* merged rx bufs in use */
 
pthread_t   tx_tid;
pthread_mutex_t tx_mtx;
@@ -151,6 +154,7 @@ static void pci_vtnet_reset(void *);
 /* static void pci_vtnet_notify(void *, struct vqueue_info *); */
 static int pci_vtnet_cfgread(void *, int, int, uint32_t *);
 static int pci_vtnet_cfgwrite(void *, int, int, uint32_t);
+static void pci_vtnet_neg_features(void *, uint64_t);
 
 static struct virtio_consts vtnet_vi_consts = {
"vtnet",/* our name */
@@ -160,7 +164,7 @@ static struct virtio_consts vtnet_vi_con
NULL,   /* device-wide qnotify -- not used */
pci_vtnet_cfgread,  /* read PCI config */
pci_vtnet_cfgwrite, /* write PCI config */
-   NULL,   /* apply negotiated features */
+   pci_vtnet_neg_features, /* apply negotiated features */
VTNET_S_HOSTCAPS,   /* our capabilities */
 };
 
@@ -213,6 +217,8 @@ pci_vtnet_reset(void *vsc)
pci_vtnet_rxwait(sc);
 
sc->vsc_rx_ready = 0;
+   sc->rx_merge = 1;
+   sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr);
 
/* now reset rings, MSI-X vectors, and negotiated capabilities */
vi_reset_dev(&sc->vsc_vs);
@@ -254,14 +260,34 @@ pci_vtnet_tap_tx(struct pci_vtnet_softc 
  */
 static uint8_t dummybuf[2048];
 
+static __inline struct iovec *
+rx_iov_trim(struct iovec *iov, int *niov, int tlen)
+{
+   struct iovec *riov;
+
+   /* XXX short-cut: assume first segment is >= tlen */
+   assert(iov[0].iov_len >= tlen);
+
+   iov[0].iov_len -= tlen;
+   if (iov[0].iov_len == 0) {
+   assert(*niov > 1);
+   *niov -= 1;
+   riov = &iov[1];
+   } else {
+   iov[0].iov_base = (void *)((uintptr_t)iov[0].iov_base + tlen);
+   riov = &iov[0];
+   }
+
+   return (riov);
+}
+
 static void
 pci_vtnet_tap_rx(struct pci_vtnet_softc *sc)
 {
+   struct iovec iov[VTNET_MAXSEGS], *riov;
struct vqueue_info *vq;
-   struct virtio_net_rxhdr *vrx;
-   uint8_t *buf;
-   int len;
-   struct iovec iov;
+   void *vrx;
+   int len, n;
 
/*
 * Should never be called without a valid tap fd
@@ -297,21 +323,19 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc 
 
do {
/*
-* Get descriptor chain, which should have just
-* one descriptor in it.
-* ??? allow guests to use multiple descs?
+* Get descriptor chain.
 */
-   assert(vq_getchain(vq, &iov, 1, NULL) == 1);
+   n = vq_getchain(vq, iov, VTNET_MAXSEGS, NULL);
+   assert(n >= 1 && n <= VTNET_MAXSEGS);
 
/*
 * Get a pointer to the rx header, and use the
 * data immediately following it for the packet buffer.
 */
-   vrx = iov.iov_base;
-   buf = (uint8_t *)(vrx + 1);
+   vrx = iov[0].iov_base;
+   riov = rx_iov_trim(iov, &n, sc->rx_vhdrlen);
 
-   len = read(sc->vsc_tapfd, buf,
-  iov.iov_len - sizeof(struct virtio_net_rxhdr));
+   len = readv(sc->vsc_tapfd, riov, n);
 
if (len < 0 && errno == EWOULDBLOCK) {
/*
@@ -324,16 +348,21 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc 
 
/*
 * The only valid field in the rx packet header is the
-* number o

svn commit: r271341 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys

2014-09-09 Thread Glen Barber
Author: gjb
Date: Wed Sep 10 00:19:33 2014
New Revision: 271341
URL: http://svnweb.freebsd.org/changeset/base/271341

Log:
  Bump __FreeBSD_version after SA-14:18
  
  Approved by:  re (implicit)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/sys/param.h

Changes in other areas also in this revision:
Modified:
  stable/10/sys/sys/param.h
  stable/8/sys/sys/param.h
  stable/9/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hTue Sep  9 23:39:43 2014(r271340)
+++ head/sys/sys/param.hWed Sep 10 00:19:33 2014(r271341)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1100030  /* Master, propagated to newvers */
+#define __FreeBSD_version 1100031  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271349 - head/tools/regression/lib/msun

2014-09-09 Thread Garrett Cooper
Author: ngie
Date: Wed Sep 10 03:54:57 2014
New Revision: 271349
URL: http://svnweb.freebsd.org/changeset/base/271349

Log:
  Add diagnostic printfs and disable test # 4 on i386
  
  Reviewed by: jmmv, rpaulo
  MFC after: 3 days
  Phabric: D749
  PR: 191676
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tools/regression/lib/msun/test-cexp.c

Modified: head/tools/regression/lib/msun/test-cexp.c
==
--- head/tools/regression/lib/msun/test-cexp.c  Wed Sep 10 03:13:40 2014
(r271348)
+++ head/tools/regression/lib/msun/test-cexp.c  Wed Sep 10 03:54:57 2014
(r271349)
@@ -117,6 +117,7 @@ test_nan()
/* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */
/* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */
for (i = 0; i < N(finites); i++) {
+   printf("# Run %d..\n", i);
testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN),
ALL_STD_EXCEPT & ~FE_INVALID, 0, 0);
if (finites[i] == 0.0)
@@ -148,6 +149,7 @@ test_inf(void)
 
/* cexp(x + inf i) = NaN + NaNi and raises invalid */
for (i = 0; i < N(finites); i++) {
+   printf("# Run %d..\n", i);
testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN),
ALL_STD_EXCEPT, FE_INVALID, 1);
}
@@ -189,6 +191,7 @@ test_reals(void)
 
for (i = 0; i < N(finites); i++) {
/* XXX could check exceptions more meticulously */
+   printf("# Run %d..\n", i);
test(cexp, CMPLXL(finites[i], 0.0),
 CMPLXL(exp(finites[i]), 0.0),
 FE_INVALID | FE_DIVBYZERO, 0, 1);
@@ -210,6 +213,7 @@ test_imaginaries(void)
int i;
 
for (i = 0; i < N(finites); i++) {
+   printf("# Run %d..\n", i);
test(cexp, CMPLXL(0.0, finites[i]),
 CMPLXL(cos(finites[i]), sin(finites[i])),
 ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
@@ -241,6 +245,7 @@ test_small(void)
int i;
 
for (i = 0; i < N(tests); i += 4) {
+   printf("# Run %d..\n", i);
a = tests[i];
b = tests[i + 1];
x = tests[i + 2];
@@ -297,8 +302,12 @@ main(int argc, char *argv[])
test_inf();
printf("ok 3 - cexp inf\n");
 
+#if defined(__i386__)
+   printf("not ok 4 - cexp reals # TODO: PR # 191676 fails assertion on 
i386\n");
+#else
test_reals();
printf("ok 4 - cexp reals\n");
+#endif
 
test_imaginaries();
printf("ok 5 - cexp imaginaries\n");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271350 - head/sys/dev/nmdm

2014-09-09 Thread Peter Grehan
Author: grehan
Date: Wed Sep 10 05:44:15 2014
New Revision: 271350
URL: http://svnweb.freebsd.org/changeset/base/271350

Log:
  Fix issue with nmdm and leading zeros in device name.
  
  The nmdm code enforces a number between the 'nmdm' and 'A|B' portions
  of the device name. This is then used as a unit number, and sprintf'd
  back into the tty name. If leading zeros were used in the name,
  the created device name is different than the string used for the
  clone-open (e.g. /dev/nmdm0001A will result in /dev/nmdm1A).
  
  Since unit numbers are no longer required with the updated tty
  code, there seems to be no reason to force the string to be a
  number. The fix is to allow an arbitrary string between
  'nmdm' and 'A|B', within the constraints of devfs names. This allows
  all existing user of numeric strings to continue to work, and also
  allows more meaningful names to be used, such as bhyve VM names.
  
  Tested on amd64, i386 and ppc64.
  
  Reported by:  Dave Smith
  PR:   192281
  Reviewed by:  neel, glebius
  Phabric:  D729
  MFC after:3 days

Modified:
  head/sys/dev/nmdm/nmdm.c

Modified: head/sys/dev/nmdm/nmdm.c
==
--- head/sys/dev/nmdm/nmdm.cWed Sep 10 03:54:57 2014(r271349)
+++ head/sys/dev/nmdm/nmdm.cWed Sep 10 05:44:15 2014(r271350)
@@ -157,21 +157,21 @@ nmdm_clone(void *arg, struct ucred *cred
 {
struct nmdmsoftc *ns;
struct tty *tp;
-   unsigned long unit;
char *end;
int error;
+   char endc;
 
if (*dev != NULL)
return;
if (strncmp(name, "nmdm", 4) != 0)
return;
-
-   /* Device name must be "nmdm%lu%c", where %c is 'A' or 'B'. */
-   name += 4;
-   unit = strtoul(name, &end, 10);
-   if (unit == ULONG_MAX || name == end)
+   if (strlen(name) <= strlen("nmdmX"))
return;
-   if ((end[0] != 'A' && end[0] != 'B') || end[1] != '\0')
+
+   /* Device name must be "nmdm%s%c", where %c is 'A' or 'B'. */
+   end = name + strlen(name) - 1;
+   endc = *end;
+   if (endc != 'A' && endc != 'B')
return;
 
ns = malloc(sizeof(*ns), M_NMDM, M_WAITOK | M_ZERO);
@@ -191,9 +191,11 @@ nmdm_clone(void *arg, struct ucred *cred
/* Create device nodes. */
tp = ns->ns_part1.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part1,
&ns->ns_mtx);
-   error = tty_makedevf(tp, NULL, end[0] == 'A' ? TTYMK_CLONING : 0,
-   "nmdm%luA", unit);
+   *end = 'A';
+   error = tty_makedevf(tp, NULL, endc == 'A' ? TTYMK_CLONING : 0,
+   "%s", name);
if (error) {
+   *end = endc;
mtx_destroy(&ns->ns_mtx);
free(ns, M_NMDM);
return;
@@ -201,9 +203,11 @@ nmdm_clone(void *arg, struct ucred *cred
 
tp = ns->ns_part2.np_tty = tty_alloc_mutex(&nmdm_class, &ns->ns_part2,
&ns->ns_mtx);
-   error = tty_makedevf(tp, NULL, end[0] == 'B' ? TTYMK_CLONING : 0,
-   "nmdm%luB", unit);
+   *end = 'B';
+   error = tty_makedevf(tp, NULL, endc == 'B' ? TTYMK_CLONING : 0,
+   "%s", name);
if (error) {
+   *end = endc;
mtx_lock(&ns->ns_mtx);
/* see nmdm_free() */
ns->ns_part1.np_other = NULL;
@@ -212,11 +216,12 @@ nmdm_clone(void *arg, struct ucred *cred
return;
}
 
-   if (end[0] == 'A')
+   if (endc == 'A')
*dev = ns->ns_part1.np_tty->t_dev;
else
*dev = ns->ns_part2.np_tty->t_dev;
 
+   *end = endc;
atomic_add_int(&nmdm_count, 1);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271351 - head/sys/vm

2014-09-09 Thread Alan Cox
Author: alc
Date: Wed Sep 10 05:52:30 2014
New Revision: 271351
URL: http://svnweb.freebsd.org/changeset/base/271351

Log:
  Fix a boundary case error in vm_reserv_alloc_contig(): If a reservation
  isn't being allocated for the last of the requested pages, because a
  reservation won't fit in the gap between allocated pages, then the
  reservation structure shouldn't be initialized.
  
  While I'm here, improve the nearby comments.
  
  Reported by:  jeff, pho
  MFC after:1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==
--- head/sys/vm/vm_reserv.c Wed Sep 10 05:44:15 2014(r271350)
+++ head/sys/vm/vm_reserv.c Wed Sep 10 05:52:30 2014(r271351)
@@ -364,7 +364,7 @@ vm_reserv_populate(vm_reserv_t rv, int i
 
 /*
  * Allocates a contiguous set of physical pages of the given size "npages"
- * from an existing or newly-created reservation.  All of the physical pages
+ * from existing or newly created reservations.  All of the physical pages
  * must be at or above the given physical address "low" and below the given
  * physical address "high".  The given value "alignment" determines the
  * alignment of the first physical page in the set.  If the given value
@@ -436,8 +436,8 @@ vm_reserv_alloc_contig(vm_object_t objec
 
/*
 * Could at least one reservation fit between the first index to the
-* left that can be used and the first index to the right that cannot
-* be used?
+* left that can be used ("leftcap") and the first index to the right
+* that cannot be used ("rightcap")?
 */
first = pindex - VM_RESERV_INDEX(object, pindex);
if (mpred != NULL) {
@@ -459,6 +459,13 @@ vm_reserv_alloc_contig(vm_object_t objec
if (first + maxpages > rightcap) {
if (maxpages == VM_LEVEL_0_NPAGES)
return (NULL);
+
+   /*
+* At least one reservation will fit between "leftcap"
+* and "rightcap".  However, a reservation for the
+* last of the requested pages will not fit.  Reduce
+* the size of the upcoming allocation accordingly.
+*/
allocpages = minpages;
}
}
@@ -482,16 +489,23 @@ vm_reserv_alloc_contig(vm_object_t objec
}
 
/*
-* Allocate and populate the new reservations.  The alignment and
-* boundary specified for this allocation may be different from the
-* alignment and boundary specified for the requested pages.  For
-* instance, the specified index may not be the first page within the
-* first new reservation.
+* Allocate the physical pages.  The alignment and boundary specified
+* for this allocation may be different from the alignment and
+* boundary specified for the requested pages.  For instance, the
+* specified index may not be the first page within the first new
+* reservation.
 */
m = vm_phys_alloc_contig(allocpages, low, high, ulmax(alignment,
VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0);
if (m == NULL)
return (NULL);
+
+   /*
+* The allocated physical pages always begin at a reservation
+* boundary, but they do not always end at a reservation boundary.
+* Initialize every reservation that is completely covered by the
+* allocated physical pages.
+*/
m_ret = NULL;
index = VM_RESERV_INDEX(object, pindex);
do {
@@ -525,7 +539,7 @@ vm_reserv_alloc_contig(vm_object_t objec
m += VM_LEVEL_0_NPAGES;
first += VM_LEVEL_0_NPAGES;
allocpages -= VM_LEVEL_0_NPAGES;
-   } while (allocpages > 0);
+   } while (allocpages >= VM_LEVEL_0_NPAGES);
return (m_ret);
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271352 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Wed Sep 10 06:25:18 2014
New Revision: 271352
URL: http://svnweb.freebsd.org/changeset/base/271352

Log:
  Fix minor buffer overflow reported by Coverity.
  
  CID:  1006781

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Sep 10 05:52:30 2014(r271351)
+++ head/sys/cam/ctl/ctl.c  Wed Sep 10 06:25:18 2014(r271352)
@@ -10584,24 +10584,28 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
 */
if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options,
"vendor")) == NULL) {
-   strcpy(inq_ptr->vendor, CTL_VENDOR);
+   strncpy(inq_ptr->vendor, CTL_VENDOR, sizeof(inq_ptr->vendor));
} else {
memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor));
strncpy(inq_ptr->vendor, val,
min(sizeof(inq_ptr->vendor), strlen(val)));
}
if (lun == NULL) {
-   strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
+   strncpy(inq_ptr->product, CTL_DIRECT_PRODUCT,
+   sizeof(inq_ptr->product));
} else if ((val = ctl_get_opt(&lun->be_lun->options, "product")) == 
NULL) {
switch (lun->be_lun->lun_type) {
case T_DIRECT:
-   strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT);
+   strncpy(inq_ptr->product, CTL_DIRECT_PRODUCT,
+   sizeof(inq_ptr->product));
break;
case T_PROCESSOR:
-   strcpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT);
+   strncpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT,
+   sizeof(inq_ptr->product));
break;
default:
-   strcpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT);
+   strncpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT,
+   sizeof(inq_ptr->product));
break;
}
} else {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271353 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Wed Sep 10 06:29:31 2014
New Revision: 271353
URL: http://svnweb.freebsd.org/changeset/base/271353

Log:
  Fix memory leak on error, reported by Coverity.
  
  CID:  1007773

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Sep 10 06:25:18 2014(r271352)
+++ head/sys/cam/ctl/ctl.c  Wed Sep 10 06:29:31 2014(r271353)
@@ -2899,6 +2899,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
lun = softc->ctl_luns[err_desc->lun_id];
if (lun == NULL) {
mtx_unlock(&softc->ctl_lock);
+   free(new_err_desc, M_CTL);
printf("%s: CTL_ERROR_INJECT: invalid LUN %ju\n",
   __func__, (uintmax_t)err_desc->lun_id);
retval = EINVAL;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271354 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Wed Sep 10 06:35:00 2014
New Revision: 271354
URL: http://svnweb.freebsd.org/changeset/base/271354

Log:
  Fix couple off-by-one range check errors, reported by Coverity.
  
  CID:  1007837

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Sep 10 06:29:31 2014(r271353)
+++ head/sys/cam/ctl/ctl.c  Wed Sep 10 06:35:00 2014(r271354)
@@ -2543,7 +2543,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 
mtx_lock(&softc->ctl_lock);
if (((ooa_hdr->flags & CTL_OOA_FLAG_ALL_LUNS) == 0)
-&& ((ooa_hdr->lun_num > CTL_MAX_LUNS)
+&& ((ooa_hdr->lun_num >= CTL_MAX_LUNS)
  || (softc->ctl_luns[ooa_hdr->lun_num] == NULL))) {
mtx_unlock(&softc->ctl_lock);
free(entries, M_CTL);
@@ -2738,7 +2738,7 @@ ctl_ioctl(struct cdev *dev, u_long cmd, 
 #ifdef CTL_IO_DELAY
mtx_lock(&softc->ctl_lock);
 
-   if ((delay_info->lun_id > CTL_MAX_LUNS)
+   if ((delay_info->lun_id >= CTL_MAX_LUNS)
 || (softc->ctl_luns[delay_info->lun_id] == NULL)) {
delay_info->status = CTL_DELAY_STATUS_INVALID_LUN;
} else {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r271358 - head/sys/cam/ctl

2014-09-09 Thread Alexander Motin
Author: mav
Date: Wed Sep 10 06:56:45 2014
New Revision: 271358
URL: http://svnweb.freebsd.org/changeset/base/271358

Log:
  Fix array overrun, reported by Coverity.
  
  CID:  1229970

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Wed Sep 10 06:56:09 2014(r271357)
+++ head/sys/cam/ctl/ctl.c  Wed Sep 10 06:56:45 2014(r271358)
@@ -7963,7 +7963,8 @@ retry:
scsi_ulto2b(i / CTL_MAX_INIT_PER_PORT,
res_desc->rel_trgt_port_id);
len = 0;
-   port = softc->ctl_ports[i / CTL_MAX_INIT_PER_PORT];
+   port = softc->ctl_ports[
+   ctl_port_idx(i / CTL_MAX_INIT_PER_PORT)];
if (port != NULL)
len = ctl_create_iid(port,
i % CTL_MAX_INIT_PER_PORT,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"