svn commit: r244047 - in head/sys/dev/usb: . serial

2012-12-09 Thread Hans Petter Selasky
Author: hselasky
Date: Sun Dec  9 09:58:44 2012
New Revision: 244047
URL: http://svnweb.freebsd.org/changeset/base/244047

Log:
  Add new USB ID.
  
  MFC after:1 week
  Submitted by: Artyom Mirgorodskiy

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==
--- head/sys/dev/usb/serial/u3g.c   Sun Dec  9 04:54:22 2012
(r244046)
+++ head/sys/dev/usb/serial/u3g.c   Sun Dec  9 09:58:44 2012
(r244047)
@@ -553,6 +553,7 @@ static const STRUCT_USB_HOST_ID u3g_devs
U3G_DEV(TOSHIBA, G450, 0),
U3G_DEV(TOSHIBA, HSDPA, 0),
U3G_DEV(YISO, C893, 0),
+   U3G_DEV(WETELECOM, WM_D200, 0),
/* Autoinstallers */
U3G_DEV(NOVATEL, ZEROCD, U3GINIT_SCSIEJECT),
U3G_DEV(OPTION, GTICON322, U3GINIT_REZERO),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSun Dec  9 04:54:22 2012(r244046)
+++ head/sys/dev/usb/usbdevsSun Dec  9 09:58:44 2012(r244047)
@@ -721,6 +721,7 @@ vendor RTSYSTEMS0x2100  RTSYSTEMS
 vendor VIALABS 0x2109  VIA Labs
 vendor ERICSSON0x2282  Ericsson
 vendor MOTOROLA2   0x22b8  Motorola
+vendor WETELECOM   0x22de  WeTelecom
 vendor TRIPPLITE   0x2478  Tripp-Lite
 vendor HIROSE  0x2631  Hirose Electric
 vendor NHJ 0x2770  NHJ
@@ -4194,6 +4195,9 @@ product WESTERN HUB   0x0500  USB HUB
 product WESTERN MYBOOK 0x0901  MyBook External HDD
 product WESTERN MYPASSWORD 0x0704  MyPassword External HDD
 
+/* WeTelecom products */
+product WETELECOM WM_D200  0x6801  WM-D200
+
 /* WIENER Plein & Baus GmbH products */
 product WIENERPLEINBAUS PL512  0x0010  PL512 PSU
 product WIENERPLEINBAUS RCM0x0011  RCM Remote Control
___
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: r244048 - head/sys/boot/forth

2012-12-09 Thread Devin Teske
Author: dteske
Date: Sun Dec  9 15:25:34 2012
New Revision: 244048
URL: http://svnweb.freebsd.org/changeset/base/244048

Log:
  Use ASCII characters for box/line characters in frames.4th
  
  Committed with changes to support the following from loader.conf(5):
  + console="vidconsole comconsole" (not just console="comconsole")
  + boot_serial="anything" (not just boot_serial="YES")
  + boot_multicons="anything" (unsupported in originally-submitted patch)
  
  PR:   conf/121064
  Submitted by: koitsu
  Reviewed by:  gcooper, adrian (co-mentor)
  Approved by:  adrian (co-mentor)

Modified:
  head/sys/boot/forth/frames.4th
  head/sys/boot/forth/support.4th

Modified: head/sys/boot/forth/frames.4th
==
--- head/sys/boot/forth/frames.4th  Sun Dec  9 09:58:44 2012
(r244047)
+++ head/sys/boot/forth/frames.4th  Sun Dec  9 15:25:34 2012
(r244048)
@@ -12,6 +12,11 @@ variable rt_el
 variable rb_el
 variable fill
 
+\ ASCII frames (used when serial console is detected)
+ 45 constant ascii_dash
+124 constant ascii_pipe
+ 43 constant ascii_plus
+
 s" arch-pc98" environment? [if]
\ Single frames
149 constant sh_el
@@ -63,7 +68,17 @@ s" arch-pc98" environment? [if]
loop
 ;
 
+: f_ascii ( -- )   ( -- )  \ set frames to ascii
+   ascii_dash h_el !
+   ascii_pipe v_el !
+   ascii_plus lt_el !
+   ascii_plus lb_el !
+   ascii_plus rt_el !
+   ascii_plus rb_el !
+;
+
 : f_single ( -- )  \ set frames to single
+   boot_serial? if f_ascii exit then
sh_el h_el !
sv_el v_el !
slt_el lt_el !
@@ -73,6 +88,7 @@ s" arch-pc98" environment? [if]
 ;
 
 : f_double ( -- )  \ set frames to double
+   boot_serial? if f_ascii exit then
dh_el h_el !
dv_el v_el !
dlt_el lt_el !

Modified: head/sys/boot/forth/support.4th
==
--- head/sys/boot/forth/support.4th Sun Dec  9 09:58:44 2012
(r244047)
+++ head/sys/boot/forth/support.4th Sun Dec  9 15:25:34 2012
(r244048)
@@ -201,6 +201,46 @@ create last_module_option sizeof module.
 
 : getenv?  getenv -1 = if false else drop true then ;
 
+\ determine if a word appears in a string, case-insensitive
+: contains? ( addr1 len1 addr2 len2 -- 0 | -1 )
+   2 pick 0= if 2drop 2drop true exit then
+   dup 0= if 2drop 2drop false exit then
+   begin
+   begin
+   swap dup c@ dup 32 = over 9 = or
+   over 10 = or over 13 = or swap drop
+   while 1+ swap 1- repeat
+   swap 2 pick 1- over <
+   while
+   2over 2over drop over compare-insensitive 0= if
+   2 pick over = if 2drop 2drop true exit then
+   2 pick tuck - -rot + swap over c@ dup 32 =
+   over 9 = or over 10 = or over 13 = or
+   swap drop if 2drop 2drop true exit then
+   then begin
+   swap dup c@
+   dup 32 = over 9 = or over 10 = or over 13 = or
+   swap drop if false else true then 2 pick 0> and
+   while 1+ swap 1- repeat
+   swap
+   repeat
+   2drop 2drop false
+;
+
+: boot_serial? ( -- 0 | -1 )
+   s" console" getenv dup -1 <> if
+   s" comconsole" 2swap contains?
+   else drop false then
+   s" boot_serial" getenv dup -1 <> if
+   swap drop 0>
+   else drop false then
+   or \ console contains comconsole ( or ) boot_serial
+   s" boot_multicons" getenv dup -1 <> if
+   swap drop 0>
+   else drop false then
+   or \ previous boolean ( or ) boot_multicons
+;
+
 \ Private definitions
 
 vocabulary support-functions
___
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: r243515 - head/sys/kern

2012-12-09 Thread Attilio Rao
On Sun, Nov 25, 2012 at 2:22 PM, Andriy Gapon  wrote:
> Author: avg
> Date: Sun Nov 25 14:22:08 2012
> New Revision: 243515
> URL: http://svnweb.freebsd.org/changeset/base/243515
>
> Log:
>   remove stop_scheduler_on_panic knob
>
>   There has not been any complaints about the default behavior, so there
>   is no need to keep a knob that enables the worse alternative.
>
>   Now that the hard-stopping of other CPUs is the only behavior, the panic_cpu
>   spinlock-like logic can be dropped, because only a single CPU is
>   supposed to win stop_cpus_hard(other_cpus) race and proceed past that
>   call.

While this is true for the sane case, for the case report by Ryan this
still breaks.
Infact, immagine CPU0 (winner) and CPU1 (looser) both panic'ing. CPU0
wins and then sets stopping_cpu. When the deadlock happens in the
spinning loop, because of generic_stop_cpus() logic CPU0 won't
deadlock and will correctly continue, but the problem is that it sets
back stopping_cpu to NOCPU, letting CPU1 continuing too and then
deadlocking.

At the minimum, what I think that should happen is to have the check
in panic() as prior this change but with the add I outlined (thus we
need to generalize cpustop_handler()). However, it seems to me that
generic_stop_cpus() may still be broken by this and we eventually need
to fix it.

I would then revert this part of the patch and fix it appropriately.
Later we can better discuss the generic_stop_cpus() similar race.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r236938 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include x86/acpica

2012-12-09 Thread Attilio Rao
On Tue, Jun 12, 2012 at 1:14 AM, Mitsuru IWASAKI  wrote:
> Author: iwasaki
> Date: Tue Jun 12 00:14:54 2012
> New Revision: 236938
> URL: http://svn.freebsd.org/changeset/base/236938
>
> Log:
>   Share IPI init and startup code of mp_machdep.c with acpi_wakeup.c
>   as ipi_startup().
>
> Modified:
>   head/sys/amd64/amd64/mp_machdep.c
>   head/sys/amd64/include/smp.h

I think that after these changes smp.h should go in x86/ subdir.
Infact now amd64 and i386 version are so similar that they can do
safely be merged (the only difference being the lazypmap ipi counter
and the mpboot exports.

If you are interested into it, please make a patch, I'd be happy to review.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r243147 - head/usr.bin/fetch

2012-12-09 Thread Florian Smeets
On 16.11.12 13:05, Andre Oppermann wrote:
> Author: andre
> Date: Fri Nov 16 12:05:10 2012
> New Revision: 243147
> URL: http://svnweb.freebsd.org/changeset/base/243147
> 
> Log:
>   Change fetch(1) to:
>   
>   o Report the instantaneous bandwidth instead of an average since the
> beginning of the download.
>   
>   o At the finish of the download report the average bandwidth and also
> the total time it took instead of 00m00s.
>   

Andre,

it looks like this change breaks the bandwidth calculation when using -r

52% of  146 MB -25199509  Bps 03m28s

Going back to r243146 fixes it.

Florian



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r243147 - head/usr.bin/fetch

2012-12-09 Thread Mateusz Guzik
On Sun, Dec 09, 2012 at 07:06:22PM +0100, Florian Smeets wrote:
> On 16.11.12 13:05, Andre Oppermann wrote:
> > Author: andre
> > Date: Fri Nov 16 12:05:10 2012
> > New Revision: 243147
> > URL: http://svnweb.freebsd.org/changeset/base/243147
> > 
> > Log:
> >   Change fetch(1) to:
> >   
> >   o Report the instantaneous bandwidth instead of an average since the
> > beginning of the download.
> >   
> >   o At the finish of the download report the average bandwidth and also
> > the total time it took instead of 00m00s.
> >   
> 
> Andre,
> 
> it looks like this change breaks the bandwidth calculation when using -r
> 
> 52% of  146 MB -25199509  Bps 03m28s
> 
> Going back to r243146 fixes it.
> 

Try this:
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 025fcdc..e723d40 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -243,7 +243,7 @@ stat_start(struct xferstat *xs, const char *name, off_t 
size, off_t of
gettimeofday(&xs->start, NULL);
xs->last.tv_sec = xs->last.tv_usec = 0;
xs->size = size;
-   xs->offset = offset;
+   xs->offset = 0;
xs->rcvd = offset;
xs->lastrcvd = offset;
if (v_tty && v_level > 0)

-- 
Mateusz Guzik 
___
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: r243147 - head/usr.bin/fetch

2012-12-09 Thread Florian Smeets
On 09.12.12 19:27, Mateusz Guzik wrote:
> On Sun, Dec 09, 2012 at 07:06:22PM +0100, Florian Smeets wrote:
>> On 16.11.12 13:05, Andre Oppermann wrote:
>>> Author: andre
>>> Date: Fri Nov 16 12:05:10 2012
>>> New Revision: 243147
>>> URL: http://svnweb.freebsd.org/changeset/base/243147
>>>
>>> Log:
>>>   Change fetch(1) to:
>>>   
>>>   o Report the instantaneous bandwidth instead of an average since the
>>> beginning of the download.
>>>   
>>>   o At the finish of the download report the average bandwidth and also
>>> the total time it took instead of 00m00s.
>>>   
>>
>> Andre,
>>
>> it looks like this change breaks the bandwidth calculation when using -r
>>
>> 52% of  146 MB -25199509  Bps 03m28s
>>
>> Going back to r243146 fixes it.
>>
> 
> Try this:
> diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
> index 025fcdc..e723d40 100644
> --- a/usr.bin/fetch/fetch.c
> +++ b/usr.bin/fetch/fetch.c
> @@ -243,7 +243,7 @@ stat_start(struct xferstat *xs, const char *name, off_t 
> size, off_t of
> gettimeofday(&xs->start, NULL);
> xs->last.tv_sec = xs->last.tv_usec = 0;
> xs->size = size;
> -   xs->offset = offset;
> +   xs->offset = 0;
> xs->rcvd = offset;
> xs->lastrcvd = offset;
> if (v_tty && v_level > 0)
> 

That way the bandwidth calculation looks OK but now it counts the time
since starting to resume the download and not the time left :)

63% of  146 MB 7069 kBps 00m07s

Florian



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r243147 - head/usr.bin/fetch

2012-12-09 Thread Mateusz Guzik
On Sun, Dec 09, 2012 at 07:42:02PM +0100, Florian Smeets wrote:
> On 09.12.12 19:27, Mateusz Guzik wrote:
> > On Sun, Dec 09, 2012 at 07:06:22PM +0100, Florian Smeets wrote:
> >> On 16.11.12 13:05, Andre Oppermann wrote:
> >>> Author: andre
> >>> Date: Fri Nov 16 12:05:10 2012
> >>> New Revision: 243147
> >>> URL: http://svnweb.freebsd.org/changeset/base/243147
> >>>
> >>> Log:
> >>>   Change fetch(1) to:
> >>>   
> >>>   o Report the instantaneous bandwidth instead of an average since the
> >>> beginning of the download.
> >>>   
> >>>   o At the finish of the download report the average bandwidth and also
> >>> the total time it took instead of 00m00s.
> >>>   
> >>
> >> Andre,
> >>
> >> it looks like this change breaks the bandwidth calculation when using -r
> >>
> >> 52% of  146 MB -25199509  Bps 03m28s
> >>
> >> Going back to r243146 fixes it.
> >>
> > 
> > Try this:
> > diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
> > index 025fcdc..e723d40 100644
> > --- a/usr.bin/fetch/fetch.c
> > +++ b/usr.bin/fetch/fetch.c
> > @@ -243,7 +243,7 @@ stat_start(struct xferstat *xs, const char *name, off_t 
> > size, off_t of
> > gettimeofday(&xs->start, NULL);
> > xs->last.tv_sec = xs->last.tv_usec = 0;
> > xs->size = size;
> > -   xs->offset = offset;
> > +   xs->offset = 0;
> > xs->rcvd = offset;
> > xs->lastrcvd = offset;
> > if (v_tty && v_level > 0)
> > 
> 
> That way the bandwidth calculation looks OK but now it counts the time
> since starting to resume the download and not the time left :)
> 
> 63% of  146 MB 7069 kBps 00m07s
> 

Oops.. revert that and try this instead:
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 025fcdc..d3e9b21 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -183,7 +183,7 @@ stat_bps(struct xferstat *xs)
if (delta == 0.0) {
snprintf(str, sizeof str, "?? Bps");
} else {
-   bps = (xs->rcvd - xs->lastrcvd - xs->offset) / delta;
+   bps = (xs->rcvd - xs->lastrcvd) / delta;
snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps));
}
return (str);

-- 
Mateusz Guzik 
___
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: r244051 - head/sys/net80211

2012-12-09 Thread Adrian Chadd
Author: adrian
Date: Sun Dec  9 19:20:28 2012
New Revision: 244051
URL: http://svnweb.freebsd.org/changeset/base/244051

Log:
  Atheros SuperG bug fixes, as part of hunting down kern/174283.
  
  The stageqdepth (global, over all staging queues) was being kept
  incorrectly.  It was being incremented whenever things were added,
  but only decremented during a flush.  During active fast frames activity
  it wasn't being decremented, resulting in it always having a non-zero
  value during normal fast-frames operation.
  
  It was only used when checking if the aging queue should be checked;
  we may as well just defer to each of those staging queue counters (which
  look correct, thankfully.)
  
  Whilst I'm here, add locking assertions in the staging queue add/remove
  functions.  The current crash shows that the staging queue has one frame,
  but only has a tail pointer set (the head pointer being set to NULL.)
  I'd like to grab a few more crashes where these locking assertions are
  in place so I can narrow down the issue between "somehow locking is
  messed up and things are racy" and "the stage queue head/tail pointer
  manipulation logic is subtly wrong."
  
  Tested:
  
  * AR5416 STA, AR5413 AP; with FastFrames enabled in the AR5416 HAL.
  
  PR:   kern/174283

Modified:
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_superg.h

Modified: head/sys/net80211/ieee80211_superg.c
==
--- head/sys/net80211/ieee80211_superg.cSun Dec  9 18:45:59 2012
(r244050)
+++ head/sys/net80211/ieee80211_superg.cSun Dec  9 19:20:28 2012
(r244051)
@@ -560,7 +560,6 @@ void
 ieee80211_ff_age(struct ieee80211com *ic, struct ieee80211_stageq *sq,
 int quanta)
 {
-   struct ieee80211_superg *sg = ic->ic_superg;
struct mbuf *m, *head;
struct ieee80211_node *ni;
struct ieee80211_tx_ampdu *tap;
@@ -582,7 +581,6 @@ ieee80211_ff_age(struct ieee80211com *ic
 
sq->head = m->m_nextpkt;
sq->depth--;
-   sg->ff_stageqdepth--;
}
if (m == NULL)
sq->tail = NULL;
@@ -594,9 +592,12 @@ ieee80211_ff_age(struct ieee80211com *ic
 }
 
 static void
-stageq_add(struct ieee80211_stageq *sq, struct mbuf *m)
+stageq_add(struct ieee80211com *ic, struct ieee80211_stageq *sq, struct mbuf 
*m)
 {
int age = ieee80211_ffagemax;
+
+   IEEE80211_LOCK_ASSERT(ic);
+
if (sq->tail != NULL) {
sq->tail->m_nextpkt = m;
age -= M_AGE_GET(sq->head);
@@ -610,10 +611,12 @@ stageq_add(struct ieee80211_stageq *sq, 
 }
 
 static void
-stageq_remove(struct ieee80211_stageq *sq, struct mbuf *mstaged)
+stageq_remove(struct ieee80211com *ic, struct ieee80211_stageq *sq, struct 
mbuf *mstaged)
 {
struct mbuf *m, *mprev;
 
+   IEEE80211_LOCK_ASSERT(ic);
+
mprev = NULL;
for (m = sq->head; m != NULL; m = m->m_nextpkt) {
if (m == mstaged) {
@@ -725,7 +728,7 @@ ieee80211_ff_check(struct ieee80211_node
 
tap->txa_private = NULL;
if (mstaged != NULL)
-   stageq_remove(sq, mstaged);
+   stageq_remove(ic, sq, mstaged);
IEEE80211_UNLOCK(ic);
 
if (mstaged != NULL) {
@@ -745,7 +748,7 @@ ieee80211_ff_check(struct ieee80211_node
 */
if (mstaged != NULL) {
tap->txa_private = NULL;
-   stageq_remove(sq, mstaged);
+   stageq_remove(ic, sq, mstaged);
IEEE80211_UNLOCK(ic);
 
IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni,
@@ -766,8 +769,7 @@ ieee80211_ff_check(struct ieee80211_node
("txa_private %p", tap->txa_private));
tap->txa_private = m;
 
-   stageq_add(sq, m);
-   sg->ff_stageqdepth++;
+   stageq_add(ic, sq, m);
IEEE80211_UNLOCK(ic);
 
IEEE80211_NOTE(vap, IEEE80211_MSG_SUPERG, ni,
@@ -806,7 +808,7 @@ ieee80211_ff_node_cleanup(struct ieee802
m = tap->txa_private;
if (m != NULL) {
tap->txa_private = NULL;
-   stageq_remove(&sg->ff_stageq[ac], m);
+   stageq_remove(ic, &sg->ff_stageq[ac], m);
m->m_nextpkt = head;
head = m;
}

Modified: head/sys/net80211/ieee80211_superg.h
==
--- head/sys/net80211/ieee80211_superg.hSun Dec  9 18:45:59 2012
(r244050)
+++ head/sys/net80211/ieee80211_superg.hSun Dec  9 19:20:28 2012
(r244051)
@@ -66,7 +66,6 @@ struct ieee80211_stageq {
 struct ieee80211_superg {
/* fast-frames staging q */
struct ieee80211_stageq ff_stageq[WME_NUM_AC];
-   int 

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

2012-12-09 Thread Kenneth D. Merry
Author: ken
Date: Sun Dec  9 19:53:21 2012
New Revision: 244052
URL: http://svnweb.freebsd.org/changeset/base/244052

Log:
  Fix a couple of CTL locking issues and clean up some duplicated code.
  
  ctl_frontend_cam_sim.c:   Coalesce cfcs_online() and cfcs_offline()
into a single function since these were
identical except for one line.
  
Make sure we hold the SIM lock around path
creation, and calling xpt_rescan().
  
  scsi_ctl.c:   In ctlfe_onoffline(), make sure we hold the
SIM lock around path creation and free
calls, as well as xpt_action().
  
In ctlfe_lun_enable(), hold the SIM lock
around path and peripheral operations that
require it.
  
  Sponsored by: Spectra Logic Corporation
  MFC after:1 week

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

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Dec  9 19:20:28 2012
(r244051)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Dec  9 19:53:21 2012
(r244052)
@@ -275,7 +275,7 @@ cfcs_shutdown(void)
 }
 
 static void
-cfcs_online(void *arg)
+cfcs_onoffline(void *arg, int online)
 {
struct cfcs_softc *softc;
union ccb *ccb;
@@ -283,13 +283,12 @@ cfcs_online(void *arg)
softc = (struct cfcs_softc *)arg;
 
mtx_lock(&softc->lock);
-   softc->online = 1;
-   mtx_unlock(&softc->lock);
+   softc->online = online;
 
ccb = xpt_alloc_ccb_nowait();
if (ccb == NULL) {
printf("%s: unable to allocate CCB for rescan\n", __func__);
-   return;
+   goto bailout;
}
 
if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
@@ -297,37 +296,24 @@ cfcs_online(void *arg)
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
printf("%s: can't allocate path for rescan\n", __func__);
xpt_free_ccb(ccb);
-   return;
+   goto bailout;
}
xpt_rescan(ccb);
+
+bailout:
+   mtx_unlock(&softc->lock);
 }
 
 static void
-cfcs_offline(void *arg)
+cfcs_online(void *arg)
 {
-   struct cfcs_softc *softc;
-   union ccb *ccb;
-
-   softc = (struct cfcs_softc *)arg;
-
-   mtx_lock(&softc->lock);
-   softc->online = 0;
-   mtx_unlock(&softc->lock);
-
-   ccb = xpt_alloc_ccb_nowait();
-   if (ccb == NULL) {
-   printf("%s: unable to allocate CCB for rescan\n", __func__);
-   return;
-   }
+   cfcs_onoffline(arg, /*online*/ 1);
+}
 
-   if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
-   cam_sim_path(softc->sim), CAM_TARGET_WILDCARD,
-   CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
-   printf("%s: can't allocate path for rescan\n", __func__);
-   xpt_free_ccb(ccb);
-   return;
-   }
-   xpt_rescan(ccb);
+static void
+cfcs_offline(void *arg)
+{
+   cfcs_onoffline(arg, /*online*/ 0);
 }
 
 static int

Modified: head/sys/cam/ctl/scsi_ctl.c
==
--- head/sys/cam/ctl/scsi_ctl.c Sun Dec  9 19:20:28 2012(r244051)
+++ head/sys/cam/ctl/scsi_ctl.c Sun Dec  9 19:53:21 2012(r244052)
@@ -1687,16 +1687,21 @@ ctlfe_onoffline(void *arg, int online)
 
set_wwnn = 0;
 
+   sim = bus_softc->sim;
+
+   CAM_SIM_LOCK(sim);
status = xpt_create_path(&path, /*periph*/ NULL, bus_softc->path_id,
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (status != CAM_REQ_CMP) {
printf("%s: unable to create path!\n", __func__);
+   CAM_SIM_UNLOCK(sim);
return;
}
+   CAM_SIM_UNLOCK(sim);
+
ccb = (union ccb *)malloc(sizeof(*ccb), M_TEMP, M_WAITOK | M_ZERO);
xpt_setup_ccb(&ccb->ccb_h, path, CAM_PRIORITY_NONE);
 
-   sim = xpt_path_sim(path);
 
/*
 * Copan WWN format:
@@ -1883,27 +1888,30 @@ ctlfe_lun_enable(void *arg, struct ctl_i
 

bus_softc = (struct ctlfe_softc *)arg;
+   sim = bus_softc->sim;
+
+   CAM_SIM_LOCK(sim);
 
-   status = xpt_create_path_unlocked(&path, /*periph*/ NULL,
- bus_softc->path_id,
- targ_id.id,
- lun_id);
+   status = xpt_create_path(&path, /*periph*/ NULL, bus_softc->path_id,
+targ_id.id, lun_id);
/* XXX KDM need some way to return status to CTL here? */
if (status != CAM_REQ_CMP) {
printf("%s: could not create path, status %#

Re: svn commit: r243147 - head/usr.bin/fetch

2012-12-09 Thread Florian Smeets
On 09.12.12 20:01, Mateusz Guzik wrote:
> On Sun, Dec 09, 2012 at 07:42:02PM +0100, Florian Smeets wrote:
>> On 09.12.12 19:27, Mateusz Guzik wrote:
>>> On Sun, Dec 09, 2012 at 07:06:22PM +0100, Florian Smeets wrote:
 On 16.11.12 13:05, Andre Oppermann wrote:
> Author: andre
> Date: Fri Nov 16 12:05:10 2012
> New Revision: 243147
> URL: http://svnweb.freebsd.org/changeset/base/243147
>
> Log:
>   Change fetch(1) to:
>   
>   o Report the instantaneous bandwidth instead of an average since the
> beginning of the download.
>   
>   o At the finish of the download report the average bandwidth and also
> the total time it took instead of 00m00s.
>   

 Andre,

 it looks like this change breaks the bandwidth calculation when using -r

 52% of  146 MB -25199509  Bps 03m28s

 Going back to r243146 fixes it.

>>>
>>> Try this:
>>> diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
>>> index 025fcdc..e723d40 100644
>>> --- a/usr.bin/fetch/fetch.c
>>> +++ b/usr.bin/fetch/fetch.c
>>> @@ -243,7 +243,7 @@ stat_start(struct xferstat *xs, const char *name, off_t 
>>> size, off_t of
>>> gettimeofday(&xs->start, NULL);
>>> xs->last.tv_sec = xs->last.tv_usec = 0;
>>> xs->size = size;
>>> -   xs->offset = offset;
>>> +   xs->offset = 0;
>>> xs->rcvd = offset;
>>> xs->lastrcvd = offset;
>>> if (v_tty && v_level > 0)
>>>
>>
>> That way the bandwidth calculation looks OK but now it counts the time
>> since starting to resume the download and not the time left :)
>>
>> 63% of  146 MB 7069 kBps 00m07s
>>
> 
> Oops.. revert that and try this instead:
> diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
> index 025fcdc..d3e9b21 100644
> --- a/usr.bin/fetch/fetch.c
> +++ b/usr.bin/fetch/fetch.c
> @@ -183,7 +183,7 @@ stat_bps(struct xferstat *xs)
> if (delta == 0.0) {
> snprintf(str, sizeof str, "?? Bps");
> } else {
> -   bps = (xs->rcvd - xs->lastrcvd - xs->offset) / delta;
> +   bps = (xs->rcvd - xs->lastrcvd) / delta;
> snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps));
> }
> return (str);
> 

That looks much better.

68% of  146 MB  556 kBps 01m40s

Thanks!
Florian



signature.asc
Description: OpenPGP digital signature


svn commit: r244053 - head/sys/kern

2012-12-09 Thread Konstantin Belousov
Author: kib
Date: Sun Dec  9 20:26:51 2012
New Revision: 244053
URL: http://svnweb.freebsd.org/changeset/base/244053

Log:
  Fix typo.
  
  MFC after:3 days

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Sun Dec  9 19:53:21 2012(r244052)
+++ head/sys/kern/vfs_mount.c   Sun Dec  9 20:26:51 2012(r244053)
@@ -711,7 +711,7 @@ sys_mount(td, uap)
int error;
 
/*
-* Mount flags are now 64-bits. On 32-bit archtectures only
+* Mount flags are now 64-bits. On 32-bit architectures only
 * 32-bits are passed in, but from here on everything handles
 * 64-bit flags correctly.
 */
___
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: r244054 - head/sys/kern

2012-12-09 Thread Konstantin Belousov
Author: kib
Date: Sun Dec  9 20:34:11 2012
New Revision: 244054
URL: http://svnweb.freebsd.org/changeset/base/244054

Log:
  Remove useless comment.
  
  MFC after:3 days

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Sun Dec  9 20:26:51 2012(r244053)
+++ head/sys/kern/vfs_bio.c Sun Dec  9 20:34:11 2012(r244054)
@@ -2605,8 +2605,6 @@ loop:
  * If this check ever becomes a bottleneck it may be better to
  * move it into the else, when gbincore() fails.  At the moment
  * it isn't a problem.
-*
-* XXX remove if 0 sections (clean this up after its proven)
  */
if (numfreebuffers == 0) {
if (TD_IS_IDLETHREAD(curthread))
___
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: r243668 - in head/sys: kern sys

2012-12-09 Thread Alan Cox
Andre,

I believe that this change did not actually correct the overflow
problem.  See below for an explanation.

On 11/29/2012 01:30, Andre Oppermann wrote:
> Author: andre
> Date: Thu Nov 29 07:30:42 2012
> New Revision: 243668
> URL: http://svnweb.freebsd.org/changeset/base/243668
>
> Log:
>   Using a long is the wrong type to represent the realmem and maxmbufmem
>   variable as they may overflow on i386/PAE and i386 with > 2GB RAM.
>   
>   Use 64bit quad_t instead.  It has broader kernel infrastructure support
>   with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available types.
>   
>   Pointed out by: alc, bde
>
> Modified:
>   head/sys/kern/subr_param.c
>   head/sys/sys/mbuf.h
>
> Modified: head/sys/kern/subr_param.c
> ==
> --- head/sys/kern/subr_param.cThu Nov 29 06:26:42 2012
> (r243667)
> +++ head/sys/kern/subr_param.cThu Nov 29 07:30:42 2012
> (r243668)
> @@ -93,7 +93,7 @@ int ncallout;   /* maximum # of timer ev
>  int  nbuf;
>  int  ngroups_max;/* max # groups per process */
>  int  nswbuf;
> -long maxmbufmem; /* max mbuf memory */
> +quad_t   maxmbufmem; /* max mbuf memory */
>  pid_tpid_max = PID_MAX;
>  long maxswzone;  /* max swmeta KVA storage */
>  long maxbcache;  /* max buffer cache KVA storage */
> @@ -271,7 +271,7 @@ init_param1(void)
>  void
>  init_param2(long physpages)
>  {
> - long realmem;
> + quad_t realmem;
>  
>   /* Base parameters */
>   maxusers = MAXUSERS;
> @@ -332,10 +332,10 @@ init_param2(long physpages)
>* available kernel memory (physical or kmem).
>* At most it can be 3/4 of available kernel memory.
>*/
> - realmem = lmin(physpages * PAGE_SIZE,
> + realmem = qmin(physpages * PAGE_SIZE,
>   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);


"physpages" is a signed long.  Suppose it is 1,000,000.  On i386/PAE,
the product of 1,000,000 and PAGE_SIZE will be a negative number. 
Likewise, quad_t is a signed type.  So, the negative product of
1,000,000 and PAGE_SIZE will be sign extended to a 64-bit signed value
when it is passed to qmin(), and qmin() will return a negative number.


>   maxmbufmem = realmem / 2;
> - TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem);
> + TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
>   if (maxmbufmem > (realmem / 4) * 3)
>   maxmbufmem = (realmem / 4) * 3;
>  
>
> Modified: head/sys/sys/mbuf.h
> ==
> --- head/sys/sys/mbuf.h   Thu Nov 29 06:26:42 2012(r243667)
> +++ head/sys/sys/mbuf.h   Thu Nov 29 07:30:42 2012(r243668)
> @@ -395,7 +395,7 @@ struct mbstat {
>   *
>   * The rest of it is defined in kern/kern_mbuf.c
>   */
> -extern long  maxmbufmem;
> +extern quad_tmaxmbufmem;
>  extern uma_zone_tzone_mbuf;
>  extern uma_zone_tzone_clust;
>  extern uma_zone_tzone_pack;
>

___
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: r244055 - head/sbin/mount_nfs

2012-12-09 Thread Rick Macklem
Author: rmacklem
Date: Sun Dec  9 21:26:47 2012
New Revision: 244055
URL: http://svnweb.freebsd.org/changeset/base/244055

Log:
  Document the new NFS mount options added by r244042.
  This is a content change.

Modified:
  head/sbin/mount_nfs/mount_nfs.8

Modified: head/sbin/mount_nfs/mount_nfs.8
==
--- head/sbin/mount_nfs/mount_nfs.8 Sun Dec  9 20:34:11 2012
(r244054)
+++ head/sbin/mount_nfs/mount_nfs.8 Sun Dec  9 21:26:47 2012
(r244055)
@@ -28,7 +28,7 @@
 .\"@(#)mount_nfs.8 8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd May 3, 2011
+.Dd December 9, 2012
 .Dt MOUNT_NFS 8
 .Os
 .Sh NAME
@@ -175,6 +175,18 @@ Use the NFS Version 3 protocol.
 Use the NFS Version 4 protocol.
 This option will force the mount to use
 TCP transport.
+.It Cm minorversion Ns = Ns Aq Ar value
+Override the default of 0 for the minor version of the NFS Version 4 protocol.
+The only minor version currently supported is 1.
+This option is only meaningful when used with the
+.Cm nfsv4
+option.
+.It Cm pnfs
+Enable support for parallel NFS (pNFS) for minor version 1 of the
+NFS Version 4 protocol.
+This option is only meaningful when used with the
+.Cm minorversion
+option.
 .It Cm noconn
 For UDP mount points, do not do a
 .Xr connect 2 .
___
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: r244056 - head/sys/fs/nfsclient

2012-12-09 Thread Rick Macklem
Author: rmacklem
Date: Sun Dec  9 22:23:50 2012
New Revision: 244056
URL: http://svnweb.freebsd.org/changeset/base/244056

Log:
  Add "nfsstat -m" support for the two new NFS mount options
  added by r244042.

Modified:
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cSun Dec  9 21:26:47 2012
(r244055)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cSun Dec  9 22:23:50 2012
(r244056)
@@ -1743,6 +1743,12 @@ void nfscl_retopts(struct nfsmount *nmp,
blen = buflen;
nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV4) != 0, "nfsv4", &buf,
&blen);
+   if ((nmp->nm_flag & NFSMNT_NFSV4) != 0) {
+   nfscl_printoptval(nmp, nmp->nm_minorvers, ",minorversion", &buf,
+   &blen);
+   nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_PNFS) != 0, ",pnfs",
+   &buf, &blen);
+   }
nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV3) != 0, "nfsv3", &buf,
&blen);
nfscl_printopt(nmp, (nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 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"


Re: svn commit: r243668 - in head/sys: kern sys

2012-12-09 Thread Andre Oppermann

On 09.12.2012 21:35, Alan Cox wrote:

Andre,

I believe that this change did not actually correct the overflow
problem.  See below for an explanation.

On 11/29/2012 01:30, Andre Oppermann wrote:

Author: andre
Date: Thu Nov 29 07:30:42 2012
New Revision: 243668
URL: http://svnweb.freebsd.org/changeset/base/243668

Log:
   Using a long is the wrong type to represent the realmem and maxmbufmem
   variable as they may overflow on i386/PAE and i386 with > 2GB RAM.

   Use 64bit quad_t instead.  It has broader kernel infrastructure support
   with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available types.

   Pointed out by:  alc, bde

Modified:
   head/sys/kern/subr_param.c
   head/sys/sys/mbuf.h

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Thu Nov 29 06:26:42 2012(r243667)
+++ head/sys/kern/subr_param.c  Thu Nov 29 07:30:42 2012(r243668)
@@ -93,7 +93,7 @@ int   ncallout;   /* maximum # of timer ev
  int   nbuf;
  int   ngroups_max;/* max # groups per process */
  int   nswbuf;
-long   maxmbufmem; /* max mbuf memory */
+quad_t maxmbufmem; /* max mbuf memory */
  pid_t pid_max = PID_MAX;
  long  maxswzone;  /* max swmeta KVA storage */
  long  maxbcache;  /* max buffer cache KVA storage */
@@ -271,7 +271,7 @@ init_param1(void)
  void
  init_param2(long physpages)
  {
-   long realmem;
+   quad_t realmem;

/* Base parameters */
maxusers = MAXUSERS;
@@ -332,10 +332,10 @@ init_param2(long physpages)
 * available kernel memory (physical or kmem).
 * At most it can be 3/4 of available kernel memory.
 */
-   realmem = lmin(physpages * PAGE_SIZE,
+   realmem = qmin(physpages * PAGE_SIZE,
VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);



"physpages" is a signed long.  Suppose it is 1,000,000.  On i386/PAE,
the product of 1,000,000 and PAGE_SIZE will be a negative number.
Likewise, quad_t is a signed type.  So, the negative product of
1,000,000 and PAGE_SIZE will be sign extended to a 64-bit signed value
when it is passed to qmin(), and qmin() will return a negative number.


Thank you taking a second look it.

To be honest I got a bit confused on which automatic type expansion
applies here.

qmax() is defined as this in libkern.h:
static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); }

Wouldn't physpages be expanded to quad_t?  Hmm, no, only the result of the
computation, which happens in long space, is passed on.  This is a function,
not a macro.  Dang...

This change will force the computation to be in quad_t space:

-   realmem = qmin(physpages * PAGE_SIZE,
+   realmem = qmin((quad_t)physpages * PAGE_SIZE,
VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);

VM_[MAX|MIN]_KERNEL_ADDRESS is safe as it is of the unsigned vm_offset_t
type.

--
Andre


maxmbufmem = realmem / 2;
-   TUNABLE_LONG_FETCH("kern.maxmbufmem", &maxmbufmem);
+   TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
if (maxmbufmem > (realmem / 4) * 3)
maxmbufmem = (realmem / 4) * 3;


Modified: head/sys/sys/mbuf.h
==
--- head/sys/sys/mbuf.h Thu Nov 29 06:26:42 2012(r243667)
+++ head/sys/sys/mbuf.h Thu Nov 29 07:30:42 2012(r243668)
@@ -395,7 +395,7 @@ struct mbstat {
   *
   * The rest of it is defined in kern/kern_mbuf.c
   */
-extern longmaxmbufmem;
+extern quad_t  maxmbufmem;
  extern uma_zone_t zone_mbuf;
  extern uma_zone_t zone_clust;
  extern uma_zone_t zone_pack;


D




___
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: r244057 - head/usr.sbin/bsdinstall/scripts

2012-12-09 Thread Glen Barber
Author: gjb (doc,ports committer)
Date: Sun Dec  9 22:53:53 2012
New Revision: 244057
URL: http://svnweb.freebsd.org/changeset/base/244057

Log:
  Get 'uname -r' earlier, so it can be used to determine what branch is
  being run to set BSDINSTALL_DISTSITE accordingly.  This change allows
  non-RELEASE branches to use the FTP snapshots directory for bootonly.iso
  installations.
  
  Approved by:  simon

Modified:
  head/usr.sbin/bsdinstall/scripts/mirrorselect

Modified: head/usr.sbin/bsdinstall/scripts/mirrorselect
==
--- head/usr.sbin/bsdinstall/scripts/mirrorselect   Sun Dec  9 22:23:50 
2012(r244056)
+++ head/usr.sbin/bsdinstall/scripts/mirrorselect   Sun Dec  9 22:53:53 
2012(r244057)
@@ -191,7 +191,18 @@ MIRROR=`dialog --backtitle "FreeBSD Inst
 MIRROR_BUTTON=$?
 exec 3>&-
 
-BSDINSTALL_DISTSITE="$MIRROR/pub/FreeBSD/releases/`uname -m`/`uname -p`/`uname 
-r`"
+_UNAME_R=`uname -r`
+
+case ${_UNAME_R} in
+   *-CURRENT|*-STABLE|*-PRERELEASE|*-RC*)
+   RELDIR="snapshots"
+   ;;
+   *)
+   RELDIR="releases"
+   ;;
+esac
+
+BSDINSTALL_DISTSITE="$MIRROR/pub/FreeBSD/${RELDIR}/`uname -m`/`uname 
-p`/${_UNAME_R}"
 
 case $MIRROR_BUTTON in
 $DIALOG_CANCEL)
___
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: r244058 - head/usr.bin/fetch

2012-12-09 Thread Andre Oppermann
Author: andre
Date: Sun Dec  9 22:54:03 2012
New Revision: 244058
URL: http://svnweb.freebsd.org/changeset/base/244058

Log:
  Fix bandwidth reporting when doing a restarted download with "-r".
  The offset is already accounted for in xs->lastrcvd and doesn't
  have to be subtracted again.
  
  Reported by:  Florian Smeets 
  Submitted by: Mateusz Guzik 
  Tested by:Florian Smeets 
  MFC after:1 week

Modified:
  head/usr.bin/fetch/fetch.c

Modified: head/usr.bin/fetch/fetch.c
==
--- head/usr.bin/fetch/fetch.c  Sun Dec  9 22:53:53 2012(r244057)
+++ head/usr.bin/fetch/fetch.c  Sun Dec  9 22:54:03 2012(r244058)
@@ -183,7 +183,7 @@ stat_bps(struct xferstat *xs)
if (delta == 0.0) {
snprintf(str, sizeof str, "?? Bps");
} else {
-   bps = (xs->rcvd - xs->lastrcvd - xs->offset) / delta;
+   bps = (xs->rcvd - xs->lastrcvd) / delta;
snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps));
}
return (str);
___
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: r244059 - head/usr.sbin/bsdinstall/scripts

2012-12-09 Thread Glen Barber
Author: gjb (doc,ports committer)
Date: Sun Dec  9 22:55:51 2012
New Revision: 244059
URL: http://svnweb.freebsd.org/changeset/base/244059

Log:
  Add missed BETA* to list.
  
  Approved by:  simon (implicit)
  MFC after:3 days
  X-MFC-With:   r244058

Modified:
  head/usr.sbin/bsdinstall/scripts/mirrorselect

Modified: head/usr.sbin/bsdinstall/scripts/mirrorselect
==
--- head/usr.sbin/bsdinstall/scripts/mirrorselect   Sun Dec  9 22:54:03 
2012(r244058)
+++ head/usr.sbin/bsdinstall/scripts/mirrorselect   Sun Dec  9 22:55:51 
2012(r244059)
@@ -194,7 +194,7 @@ exec 3>&-
 _UNAME_R=`uname -r`
 
 case ${_UNAME_R} in
-   *-CURRENT|*-STABLE|*-PRERELEASE|*-RC*)
+   *-CURRENT|*-STABLE|*-BETA*|*-PRERELEASE|*-RC*)
RELDIR="snapshots"
;;
*)
___
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: r244060 - head/sys/net80211

2012-12-09 Thread Adrian Chadd
Author: adrian
Date: Sun Dec  9 22:56:29 2012
New Revision: 244060
URL: http://svnweb.freebsd.org/changeset/base/244060

Log:
  Handle ath-specific and WME IE's in adhoc mode.
  
  The Adhoc support wasn't parsing and handling the ath specific and WME
  IEs, thus the atheros vendor support and WME TXOP parameters aren't being
  copied from the peer.
  
  It copies the WME parameters from whichever adhoc node it decides to
  associate to, rather than just having them be statically configured
  per adhoc node.  This may or may not be exactly "right", but it's certainly
  going to be more convienent for people - they just have to ensure their
  adhoc nodes are setup with correct WME parameters.
  
  Since WME parameters aren't per-node but are configured on hardware TX
  queues, if some nodes support WME and some don't - or perhaps, have
  different WME parameters - things will get quite quirky.
  
  So ensure that you configure your adhoc nodes with the same WME
  parameters.
  
  Secondly - the Atheros Vendor IE is parsed and operated on per-node, so
  this should work out ok between nodes that do and don't do Atheros
  extensions.  Once you see a becaon from that node and you setup the
  association state, it _should_ parse things correctly.
  
  TODO:
  
  * I do need to ensure that both adhoc setup paths are correctly updating
the IE stuff.  Ie, if the adhoc node is created by a data frame instead
of a beacon frame, it'll come up with no WME/ath IE config.  The next
beacon frame that it receives from that node will update the state.
I just need to sit down and better understand how that's suppose to
work in IBSS mode.
  
  Tested:
  
  * AR5416 <-> AR9280 - fast frames and the WME configuration both popped
up. (This is with a local HAL patch that enables the fast frames
capability on the AR5416 chipsets.)
  
  PR:   kern/165969

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_sta.h

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Sun Dec  9 22:55:51 2012
(r244059)
+++ head/sys/net80211/ieee80211_adhoc.c Sun Dec  9 22:56:29 2012
(r244060)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #ifdef IEEE80211_SUPPORT_TDMA
 #include 
 #endif
+#include 
 
 #defineIEEE80211_RATE2MBS(r)   (((r) & IEEE80211_RATE_VAL) / 2)
 
@@ -745,6 +746,16 @@ adhoc_recv_mgmt(struct ieee80211_node *n
memcpy(ni->ni_tstamp.data, scan.tstamp,
sizeof(ni->ni_tstamp));
}
+   if (scan.wme != NULL &&
+   (ni->ni_flags & IEEE80211_NODE_QOS) &&
+   ieee80211_parse_wmeparams(vap, scan.wme, wh) > 0) {
+   ieee80211_wme_updateparams(vap);
+   }
+#ifdef IEEE80211_SUPPORT_SUPERG
+   if (scan.ath != NULL) {
+   ieee80211_parse_athparams(ni, scan.ath, wh);
+   }
+#endif
if (ni != NULL) {
IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
ni->ni_noise = nf;

Modified: head/sys/net80211/ieee80211_sta.c
==
--- head/sys/net80211/ieee80211_sta.c   Sun Dec  9 22:55:51 2012
(r244059)
+++ head/sys/net80211/ieee80211_sta.c   Sun Dec  9 22:56:29 2012
(r244060)
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 #include 
+#include 
 
 #defineIEEE80211_RATE2MBS(r)   (((r) & IEEE80211_RATE_VAL) / 2)
 
@@ -1086,7 +1087,7 @@ bad:
IEEE80211_SCAN_FAIL_STATUS);
 }
 
-static int
+int
 ieee80211_parse_wmeparams(struct ieee80211vap *vap, uint8_t *frm,
const struct ieee80211_frame *wh)
 {

Modified: head/sys/net80211/ieee80211_sta.h
==
--- head/sys/net80211/ieee80211_sta.h   Sun Dec  9 22:55:51 2012
(r244059)
+++ head/sys/net80211/ieee80211_sta.h   Sun Dec  9 22:56:29 2012
(r244060)
@@ -33,4 +33,10 @@
 void   ieee80211_sta_attach(struct ieee80211com *);
 void   ieee80211_sta_detach(struct ieee80211com *);
 void   ieee80211_sta_vattach(struct ieee80211vap *);
+
+/*
+ * Used by the adhoc/mesh/tdma paths.
+ */
+extern int ieee80211_parse_wmeparams(struct ieee80211vap *vap, uint8_t *frm,
+   const struct ieee80211_frame *wh);
 #endif /* !_NET80211_IEEE80211_STA_H_ */
___
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: r243147 - head/usr.bin/fetch

2012-12-09 Thread Andre Oppermann

On 09.12.2012 20:01, Mateusz Guzik wrote:

On Sun, Dec 09, 2012 at 07:42:02PM +0100, Florian Smeets wrote:

On 09.12.12 19:27, Mateusz Guzik wrote:

On Sun, Dec 09, 2012 at 07:06:22PM +0100, Florian Smeets wrote:

On 16.11.12 13:05, Andre Oppermann wrote:

Author: andre
Date: Fri Nov 16 12:05:10 2012
New Revision: 243147
URL: http://svnweb.freebsd.org/changeset/base/243147

Log:
   Change fetch(1) to:

   o Report the instantaneous bandwidth instead of an average since the
 beginning of the download.

   o At the finish of the download report the average bandwidth and also
 the total time it took instead of 00m00s.



Andre,

it looks like this change breaks the bandwidth calculation when using -r

52% of  146 MB -25199509  Bps 03m28s

Going back to r243146 fixes it.



Try this:
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 025fcdc..e723d40 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -243,7 +243,7 @@ stat_start(struct xferstat *xs, const char *name, off_t 
size, off_t of
 gettimeofday(&xs->start, NULL);
 xs->last.tv_sec = xs->last.tv_usec = 0;
 xs->size = size;
-   xs->offset = offset;
+   xs->offset = 0;
 xs->rcvd = offset;
 xs->lastrcvd = offset;
 if (v_tty && v_level > 0)



That way the bandwidth calculation looks OK but now it counts the time
since starting to resume the download and not the time left :)

63% of  146 MB 7069 kBps 00m07s



Oops.. revert that and try this instead:
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index 025fcdc..d3e9b21 100644
--- a/usr.bin/fetch/fetch.c
+++ b/usr.bin/fetch/fetch.c
@@ -183,7 +183,7 @@ stat_bps(struct xferstat *xs)
 if (delta == 0.0) {
 snprintf(str, sizeof str, "?? Bps");
 } else {
-   bps = (xs->rcvd - xs->lastrcvd - xs->offset) / delta;
+   bps = (xs->rcvd - xs->lastrcvd) / delta;
 snprintf(str, sizeof str, "%sps", stat_bytes((off_t)bps));
 }
 return (str);


Thank you for this patch.  Committed as r244058.

--
Andre

___
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: r244061 - head/sys/net80211

2012-12-09 Thread Adrian Chadd
Author: adrian
Date: Sun Dec  9 23:56:29 2012
New Revision: 244061
URL: http://svnweb.freebsd.org/changeset/base/244061

Log:
  Undo the previous adhoc commit - doing the WME IE handling here
  is totally wrong.
  
  If we parse the WME IE here, we'll be constantly updating the WME
  configuration from each WME enabled IBSS node we see.
  
  There's a separate issue where the WME configuration is blanked out
  when the interface is brought up; the WME parameters aren't "sticky."
  
  Also, ieee80211_init_neighbor() parses the ath IE, so doing it here
  isn't required.
  
  Sorry about the noise.
  
  PR:   kern/165969

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Sun Dec  9 22:56:29 2012
(r244060)
+++ head/sys/net80211/ieee80211_adhoc.c Sun Dec  9 23:56:29 2012
(r244061)
@@ -746,16 +746,6 @@ adhoc_recv_mgmt(struct ieee80211_node *n
memcpy(ni->ni_tstamp.data, scan.tstamp,
sizeof(ni->ni_tstamp));
}
-   if (scan.wme != NULL &&
-   (ni->ni_flags & IEEE80211_NODE_QOS) &&
-   ieee80211_parse_wmeparams(vap, scan.wme, wh) > 0) {
-   ieee80211_wme_updateparams(vap);
-   }
-#ifdef IEEE80211_SUPPORT_SUPERG
-   if (scan.ath != NULL) {
-   ieee80211_parse_athparams(ni, scan.ath, wh);
-   }
-#endif
if (ni != NULL) {
IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi);
ni->ni_noise = nf;
___
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: r244062 - head/sys/net80211

2012-12-09 Thread Adrian Chadd
Author: adrian
Date: Mon Dec 10 00:16:38 2012
New Revision: 244062
URL: http://svnweb.freebsd.org/changeset/base/244062

Log:
  Update the aggressive mode logic to also enable aggressive mode
  parameters in IBSSes.
  
  IBSS was just being plainly ignored here even though aggressive mode
  was 'on'.
  
  This still doesn't fix the "why are the WME parameters reset upon
  interface down/up" issue.
  
  PR:   kern/165969

Modified:
  head/sys/net80211/ieee80211_proto.c

Modified: head/sys/net80211/ieee80211_proto.c
==
--- head/sys/net80211/ieee80211_proto.c Sun Dec  9 23:56:29 2012
(r244061)
+++ head/sys/net80211/ieee80211_proto.c Mon Dec 10 00:16:38 2012
(r244062)
@@ -996,6 +996,7 @@ ieee80211_wme_updateparams_locked(struct
struct wmeParams *chanp, *bssp;
enum ieee80211_phymode mode;
int i;
+   int do_aggrmode = 0;
 
/*
 * Set up the channel access parameters for the physical
@@ -1036,11 +1037,38 @@ ieee80211_wme_updateparams_locked(struct
 * BE uses agressive params to optimize performance of
 * legacy/non-QoS traffic.
 */
-if ((vap->iv_opmode == IEEE80211_M_HOSTAP &&
-(wme->wme_flags & WME_F_AGGRMODE) != 0) ||
-   (vap->iv_opmode == IEEE80211_M_STA &&
-(vap->iv_bss->ni_flags & IEEE80211_NODE_QOS) == 0) ||
-   (vap->iv_flags & IEEE80211_F_WME) == 0) {
+
+   /* Hostap? Only if aggressive mode is enabled */
+if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
+(wme->wme_flags & WME_F_AGGRMODE) != 0)
+   do_aggrmode = 1;
+
+   /*
+* Station? Only if we're in a non-QoS BSS.
+*/
+   else if ((vap->iv_opmode == IEEE80211_M_STA &&
+(vap->iv_bss->ni_flags & IEEE80211_NODE_QOS) == 0))
+   do_aggrmode = 1;
+
+   /*
+* IBSS? Only if we we have WME enabled.
+*/
+   else if ((vap->iv_opmode == IEEE80211_M_IBSS) &&
+   (vap->iv_flags & IEEE80211_F_WME))
+   do_aggrmode = 1;
+
+   /*
+* If WME is disabled on this VAP, default to aggressive mode
+* regardless of the configuration.
+*/
+   if ((vap->iv_flags & IEEE80211_F_WME) == 0)
+   do_aggrmode = 1;
+
+   /* XXX WDS? */
+
+   /* XXX MBSS? */
+   
+   if (do_aggrmode) {
chanp = &wme->wme_chanParams.cap_wmeParams[WME_AC_BE];
bssp = &wme->wme_bssChanParams.cap_wmeParams[WME_AC_BE];
 
@@ -1058,7 +1086,14 @@ ieee80211_wme_updateparams_locked(struct
chanp->wmep_acm, chanp->wmep_aifsn, chanp->wmep_logcwmin,
chanp->wmep_logcwmax, chanp->wmep_txopLimit);
}
-   
+
+
+   /*
+* Change the contention window based on the number of associated
+* stations.  If the number of associated stations is 1 and
+* aggressive mode is enabled, lower the contention window even
+* further.
+*/
if (vap->iv_opmode == IEEE80211_M_HOSTAP &&
ic->ic_sta_assoc < 2 && (wme->wme_flags & WME_F_AGGRMODE) != 0) {
static const uint8_t logCwMin[IEEE80211_MODE_MAX] = {
@@ -1082,8 +1117,15 @@ ieee80211_wme_updateparams_locked(struct
IEEE80211_DPRINTF(vap, IEEE80211_MSG_WME,
"update %s (chan+bss) logcwmin %u\n",
ieee80211_wme_acnames[WME_AC_BE], chanp->wmep_logcwmin);
-   }   
-   if (vap->iv_opmode == IEEE80211_M_HOSTAP) { /* XXX ibss? */
+   }
+
+   /*
+* Arrange for the beacon update.
+*
+* XXX what about MBSS, WDS?
+*/
+   if (vap->iv_opmode == IEEE80211_M_HOSTAP
+   || vap->iv_opmode == IEEE80211_M_IBSS) {
/*
 * Arrange for a beacon update and bump the parameter
 * set number so associated stations load the new values.
___
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: r243668 - in head/sys: kern sys

2012-12-09 Thread Bruce Evans

On Sun, 9 Dec 2012, Andre Oppermann wrote:


On 09.12.2012 21:35, Alan Cox wrote:

...

I believe that this change did not actually correct the overflow
problem.  See below for an explanation.

On 11/29/2012 01:30, Andre Oppermann wrote:

...


Please trim quotes.



Log:
   Using a long is the wrong type to represent the realmem and maxmbufmem
   variable as they may overflow on i386/PAE and i386 with > 2GB RAM.

   Use 64bit quad_t instead.  It has broader kernel infrastructure support
   with TUNABLE_QUAD_FETCH() and qmin/qmax() than other available types.

   Pointed out by:  alc, bde
...
Modified: head/sys/kern/subr_param.c
...
@@ -332,10 +332,10 @@ init_param2(long physpages)
 * available kernel memory (physical or kmem).
 * At most it can be 3/4 of available kernel memory.
 */
-   realmem = lmin(physpages * PAGE_SIZE,
+   realmem = qmin(physpages * PAGE_SIZE,
VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);



"physpages" is a signed long.  Suppose it is 1,000,000.  On i386/PAE,
the product of 1,000,000 and PAGE_SIZE will be a negative number.
Likewise, quad_t is a signed type.  So, the negative product of
1,000,000 and PAGE_SIZE will be sign extended to a 64-bit signed value
when it is passed to qmin(), and qmin() will return a negative number.


Thank you taking a second look it.

To be honest I got a bit confused on which automatic type expansion
applies here.


This is a vanilla overflow bug.  It has nothing to do with type extension,
except that type extension beyond long doesn't occur for multiplication
of longs.  It has little to do with signedness, except that with signed
longs the overflow occurs at LONG_MAX (2G-1 on i386) instead of at
ULONG_MAX (4G-1 on i386).

The above part of the patch also shows one of the many style bugs in this
and previous commits (random indentation of the continued line -- 2 tabs
instead of 4 spaces).


qmax() is defined as this in libkern.h:
static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); }

Wouldn't physpages be expanded to quad_t?  Hmm, no, only the result of the
computation, which happens in long space, is passed on.  This is a function,
not a macro.  Dang...


No, that is backwards.  With a macro, the result of the multiplicaton is
passed on (unless the macro is very broken and has type casts which to
break its type-genericness).  With the qmin() function, the result of
the multiplication is converted to quad_t.  But the mmultiplication has
already overflowed, giving an undefined result of type long.  (This
assumes that PAGE_SIZE has type long or smaller.  It is normally a
literal int constant like 4096.  Any type for this constant would
increase bugs in this area.  physpages has type long.  As with all
binary operations, the operands are first converted to a minimal
common type that is at least as large as both and also at least as
large as int.  This type is long.  Multiplication of longs then overflows
mainly in the PAE case.)


This change will force the computation to be in quad_t space:

-   realmem = qmin(physpages * PAGE_SIZE,
+   realmem = qmin((quad_t)physpages * PAGE_SIZE,
   VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS);


Indeed.


VM_[MAX|MIN]_KERNEL_ADDRESS is safe as it is of the unsigned vm_offset_t
type.


This has little to do with its type, except that the type is not larger than
quad_t.  Actually, it is larger on most 64-bit arches including amd6d, so
the above code only works accidentally.  It depends on kva not
covering more than half of the address space.  Now the type errors are:

- there is no such type as 'unsigned vm_offset_t' (unsigned foo_t is a
  syntax error for any typedefed type foo_t).  I think you mean that
  vm_offset_t is an unsigned type.  It is not the plain unsigned type
  on 64-bit arches, so you shouldn't mean that.

- the type of constants like VM_MAX_KERNEL_ADDRESS is unclear.  Most
  constants are defined as literals.  But VM_{MAX,MIN}_KERNEL_ADDRESS
  happen to be defined using macros.  The macros are quite MD.  On
  i386, the macro is VADDR() which casts parameters to vm_offset_t.
  I think most parameters in the macro are literals with type int.
  Also, vm_offset_t is larger than int, so no further promotion occurs
  and the result has type vm_offset_t.  On amd64, the macro is KVADDR()
  which casts parameters to unsigned long.  Again (but more obviously)
  there is no further promotion, and the result has type unsigned long.
  vm_offset_t is unsigned long too, so the result has type unsigned long
  too.

  I discussed casts of parameters in macros with jake@ in connection with
  PAE.  I had added casts to some macros to reduce some popular overflow
  bugs and type errors.  jake preferred not to cast.  It can be difficult
  to find the right cast to use, since the right cast is often different
  for PAE (but many cases could be handled by using a typedef that varies
  with PAE), and the correct ca

svn commit: r244063 - head/usr.bin/locate/locate

2012-12-09 Thread Eitan Adler
Author: eadler
Date: Mon Dec 10 02:26:01 2012
New Revision: 244063
URL: http://svnweb.freebsd.org/changeset/base/244063

Log:
  Give users a hint when their locate database is too small.
  
  Reviewed by:  wblock, gcooper
  Reviewed by:  "Lowell Gilbert" 
  Approved by:  cperciva (implicit)
  MFC after:3 weeks

Modified:
  head/usr.bin/locate/locate/locate.c

Modified: head/usr.bin/locate/locate/locate.c
==
--- head/usr.bin/locate/locate/locate.c Mon Dec 10 00:16:38 2012
(r244062)
+++ head/usr.bin/locate/locate/locate.c Mon Dec 10 02:26:01 2012
(r244063)
@@ -292,7 +292,9 @@ search_mmap(db, s)
err(1, "`%s'", db);
len = sb.st_size;
if (len < (2*NBG))
-   errx(1, "database too small: %s", db);
+   errx(1,
+   "database too small: %s\nRun /usr/libexec/locate.updatedb",
+   db);
 
if ((p = mmap((caddr_t)0, (size_t)len,
  PROT_READ, MAP_SHARED,
___
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: r244076 - head/sys/kern

2012-12-09 Thread Konstantin Belousov
Author: kib
Date: Mon Dec 10 05:14:04 2012
New Revision: 244076
URL: http://svnweb.freebsd.org/changeset/base/244076

Log:
  Do not ignore zero address, possibly returned by the vm_map_find()
  call.  The function indicates a failure by the TRUE return value.  To
  be extra safe, assert that the return value from the following
  vm_map_insert() indicates success.
  
  Fix style issues in the nearby lines, reformulate the comment.
  
  Reviewed by:  alc (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Mon Dec 10 03:11:19 2012(r244075)
+++ head/sys/kern/vfs_bio.c Mon Dec 10 05:14:04 2012(r244076)
@@ -2107,15 +2107,16 @@ restart:
 
if (maxsize != bp->b_kvasize) {
vm_offset_t addr = 0;
+   int rv;
 
bfreekva(bp);
 
vm_map_lock(buffer_map);
if (vm_map_findspace(buffer_map,
-   vm_map_min(buffer_map), maxsize, &addr)) {
+   vm_map_min(buffer_map), maxsize, &addr)) {
/*
-* Uh oh.  Buffer map is to fragmented.  We
-* must defragment the map.
+* Buffer map is too fragmented.
+* We must defragment the map.
 */
atomic_add_int(&bufdefragcnt, 1);
vm_map_unlock(buffer_map);
@@ -2124,22 +2125,21 @@ restart:
brelse(bp);
goto restart;
}
-   if (addr) {
-   vm_map_insert(buffer_map, NULL, 0,
-   addr, addr + maxsize,
-   VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
-
-   bp->b_kvabase = (caddr_t) addr;
-   bp->b_kvasize = maxsize;
-   atomic_add_long(&bufspace, bp->b_kvasize);
-   atomic_add_int(&bufreusecnt, 1);
-   }
+   rv = vm_map_insert(buffer_map, NULL, 0, addr,
+   addr + maxsize, VM_PROT_ALL, VM_PROT_ALL,
+   MAP_NOFAULT);
+   KASSERT(rv == KERN_SUCCESS,
+   ("vm_map_insert(buffer_map) rv %d", rv));
vm_map_unlock(buffer_map);
+   bp->b_kvabase = (caddr_t)addr;
+   bp->b_kvasize = maxsize;
+   atomic_add_long(&bufspace, bp->b_kvasize);
+   atomic_add_int(&bufreusecnt, 1);
}
bp->b_saveaddr = bp->b_kvabase;
bp->b_data = bp->b_saveaddr;
}
-   return(bp);
+   return (bp);
 }
 
 /*
___
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: r244077 - head/sys/amd64/amd64

2012-12-09 Thread Konstantin Belousov
Author: kib
Date: Mon Dec 10 05:14:34 2012
New Revision: 244077
URL: http://svnweb.freebsd.org/changeset/base/244077

Log:
  Add amd64-specific ddb command "show pte".  The command displays the
  hierarchy of the page table entries which map the specified address.
  
  Reviewed by:  alc (previous version)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Dec 10 05:14:04 2012(r244076)
+++ head/sys/amd64/amd64/pmap.c Mon Dec 10 05:14:34 2012(r244077)
@@ -5446,3 +5446,46 @@ pmap_align_superpage(vm_object_t object,
else
*addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset;
 }
+
+#include "opt_ddb.h"
+#ifdef DDB
+#include 
+
+DB_SHOW_COMMAND(pte, pmap_print_pte)
+{
+   pmap_t pmap;
+   pml4_entry_t *pml4;
+   pdp_entry_t *pdp;
+   pd_entry_t *pde;
+   pt_entry_t *pte;
+   vm_offset_t va;
+
+   if (have_addr) {
+   va = (vm_offset_t)addr;
+   pmap = PCPU_GET(curpmap); /* XXX */
+   } else {
+   db_printf("show pte addr\n");
+   return;
+   }
+   pml4 = pmap_pml4e(pmap, va);
+   db_printf("VA %#016lx pml4e %#016lx", va, *pml4);
+   if ((*pml4 & PG_V) == 0) {
+   db_printf("\n");
+   return;
+   }
+   pdp = pmap_pml4e_to_pdpe(pml4, va);
+   db_printf(" pdpe %#016lx", *pdp);
+   if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) {
+   db_printf("\n");
+   return;
+   }
+   pde = pmap_pdpe_to_pde(pdp, va);
+   db_printf(" pde %#016lx", *pde);
+   if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) {
+   db_printf("\n");
+   return;
+   }
+   pte = pmap_pde_to_pte(pde, va);
+   db_printf(" pte %#016lx\n", *pte);
+}
+#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: r244078 - head/sys/net80211

2012-12-09 Thread Adrian Chadd
Author: adrian
Date: Mon Dec 10 07:00:46 2012
New Revision: 244078
URL: http://svnweb.freebsd.org/changeset/base/244078

Log:
  Adjust the channel to correctly setup the HT flags when transitioning
  an IBSS VAP to RUN.
  
  An 11n IBSS was beaconing HTINFO/HTCAP IE's that didn't have any HT
  information setup (like the HT TX/RX MCS bitmask.)
  
  Tested:
  
  * AR9280, IBSS - both a statically setup channel and a scanned channel
  
  PR:   kern/172955

Modified:
  head/sys/net80211/ieee80211_adhoc.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Mon Dec 10 05:14:34 2012
(r244077)
+++ head/sys/net80211/ieee80211_adhoc.c Mon Dec 10 07:00:46 2012
(r244078)
@@ -171,7 +171,9 @@ adhoc_newstate(struct ieee80211vap *vap,
 * Already have a channel; bypass the
 * scan and startup immediately.
 */
-   ieee80211_create_ibss(vap, vap->iv_des_chan);
+   ieee80211_create_ibss(vap,
+   ieee80211_ht_adjust_channel(ic,
+   vap->iv_des_chan, vap->iv_flags_ht));
break;
}
/*
___
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"