svn commit: r207498 - head/sbin/camcontrol

2010-05-02 Thread Alexander Motin
Author: mav
Date: Sun May  2 11:36:27 2010
New Revision: 207498
URL: http://svn.freebsd.org/changeset/base/207498

Log:
  Add -d and -f arguments to `camcontrol cmd`, to execute DMA ATA commands.

Modified:
  head/sbin/camcontrol/camcontrol.8
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.8
==
--- head/sbin/camcontrol/camcontrol.8   Sun May  2 06:34:13 2010
(r207497)
+++ head/sbin/camcontrol/camcontrol.8   Sun May  2 11:36:27 2010
(r207498)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 20, 2010
+.Dd May 2, 2010
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -123,6 +123,8 @@
 .Op generic args
 .Aq Fl a Ar cmd Op args
 .Aq Fl c Ar cmd Op args
+.Op Fl d
+.Op Fl f
 .Op Fl i Ar len Ar fmt
 .Bk -words
 .Op Fl o Ar len Ar fmt Op args
@@ -530,6 +532,10 @@ lba_high_exp, features_exp, sector_count
 .It Fl c Ar cmd Op args
 This specifies the SCSI CDB.
 SCSI CDBs may be 6, 10, 12 or 16 bytes.
+.It Fl d
+Specifies DMA protocol to be used for ATA command.
+.It Fl f
+Specifies FPDMA (NCQ) protocol to be used for ATA command.
 .It Fl i Ar len Ar fmt
 This specifies the amount of data to read, and how it should be displayed.
 If the format is

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Sun May  2 06:34:13 2010
(r207497)
+++ head/sbin/camcontrol/camcontrol.c   Sun May  2 11:36:27 2010
(r207498)
@@ -123,7 +123,7 @@ struct camcontrol_opts {
 };
 
 #ifndef MINIMALISTIC
-static const char scsicmd_opts[] = "a:c:i:o:r";
+static const char scsicmd_opts[] = "a:c:dfi:o:r";
 static const char readdefect_opts[] = "f:GP";
 static const char negotiate_opts[] = "acD:M:O:qR:T:UW:";
 #endif
@@ -2184,6 +2184,8 @@ scsicmd(struct cam_device *device, int a
int c, data_bytes = 0;
int cdb_len = 0;
int atacmd_len = 0;
+   int dmacmd = 0;
+   int fpdmacmd = 0;
int need_res = 0;
char *datastr = NULL, *tstr, *resstr = NULL;
int error = 0;
@@ -2246,6 +2248,12 @@ scsicmd(struct cam_device *device, int a
 */
optind += hook.got;
break;
+   case 'd':
+   dmacmd = 1;
+   break;
+   case 'f':
+   fpdmacmd = 1;
+   break;
case 'i':
if (arglist & CAM_ARG_CMD_OUT) {
warnx("command must either be "
@@ -2422,6 +2430,10 @@ scsicmd(struct cam_device *device, int a
bcopy(atacmd, &ccb->ataio.cmd.command, atacmd_len);
if (need_res)
ccb->ataio.cmd.flags |= CAM_ATAIO_NEEDRESULT;
+   if (dmacmd)
+   ccb->ataio.cmd.flags |= CAM_ATAIO_DMA;
+   if (fpdmacmd)
+   ccb->ataio.cmd.flags |= CAM_ATAIO_FPDMA;
 
cam_fill_ataio(&ccb->ataio,
  /*retries*/ retry_count,
@@ -4353,7 +4365,7 @@ usage(int verbose)
 "  [-P pagectl][-e | -b][-d]\n"
 "camcontrol cmd[dev_id][generic args]\n"
 "  <-a cmd [args] | -c cmd [args]>\n"
-"  [-i len fmt|-o len fmt [args]] [-r fmt]\n"
+"  [-d] [-f] [-i len fmt|-o len fmt [args]] [-r 
fmt]\n"
 "camcontrol debug  [-I][-P][-T][-S][-X][-c]\n"
 "  \n"
 "camcontrol tags   [dev_id][generic args] [-N tags] [-q] [-v]\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: r207499 - in head: sbin/camcontrol sys/cam sys/cam/ata sys/dev/ahci sys/dev/siis

2010-05-02 Thread Alexander Motin
Author: mav
Date: Sun May  2 12:07:47 2010
New Revision: 207499
URL: http://svn.freebsd.org/changeset/base/207499

Log:
  Make SATA XPT negotiate and enable some additional SATA features, such as:
   - device initiated power management (some devices support only this way);
   - Automatic Partial to Slumber Transition (more power saving);
   - DMA auto-activation (expected to slightly improve performance).
  More features could be added later, when hardware supports.

Modified:
  head/sbin/camcontrol/camcontrol.c
  head/sys/cam/ata/ata_pmp.c
  head/sys/cam/ata/ata_xpt.c
  head/sys/cam/cam_ccb.h
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h
  head/sys/dev/siis/siis.c
  head/sys/dev/siis/siis.h

Modified: head/sbin/camcontrol/camcontrol.c
==
--- head/sbin/camcontrol/camcontrol.c   Sun May  2 11:36:27 2010
(r207498)
+++ head/sbin/camcontrol/camcontrol.c   Sun May  2 12:07:47 2010
(r207499)
@@ -2855,6 +2855,10 @@ cts_print(struct cam_device *device, str
fprintf(stdout, "%sNumber of tags: %d\n", pathstr,
sata->tags);
}
+   if ((sata->valid & CTS_SATA_VALID_CAPS) != 0) {
+   fprintf(stdout, "%sSATA capabilities: %08x\n", pathstr,
+   sata->caps);
+   }
}
if (cts->protocol == PROTO_SCSI) {
struct ccb_trans_settings_scsi *scsi=

Modified: head/sys/cam/ata/ata_pmp.c
==
--- head/sys/cam/ata/ata_pmp.c  Sun May  2 11:36:27 2010(r207498)
+++ head/sys/cam/ata/ata_pmp.c  Sun May  2 12:07:47 2010(r207499)
@@ -101,6 +101,7 @@ struct pmp_softc {
int events;
 #define PMP_EV_RESET   1
 #define PMP_EV_RESCAN  2
+   u_int   caps;
struct task sysctl_task;
struct sysctl_ctx_list  sysctl_ctx;
struct sysctl_oid   *sysctl_tree;
@@ -457,6 +458,14 @@ pmpstart(struct cam_periph *periph, unio
ata_pm_read_cmd(ataio, 2, 15);
break;
case PMP_STATE_PRECONFIG:
+   /* Get/update host SATA capabilities. */
+   bzero(&cts, sizeof(cts));
+   xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE);
+   cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
+   cts.type = CTS_TYPE_CURRENT_SETTINGS;
+   xpt_action((union ccb *)&cts);
+   if (cts.xport_specific.sata.valid & CTS_SATA_VALID_CAPS)
+   softc->caps = cts.xport_specific.sata.caps;
cam_fill_ataio(ataio,
  pmp_retry_count,
  pmpdone,
@@ -644,14 +653,16 @@ pmpdone(struct cam_periph *periph, union
(done_ccb->ataio.res.lba_mid << 16) +
(done_ccb->ataio.res.lba_low << 8) +
done_ccb->ataio.res.sector_count;
-   if ((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) {
+   if (((res & 0xf0f) == 0x103 && (res & 0x0f0) != 0) ||
+   (res & 0x600) != 0) {
if (bootverbose) {
printf("%s%d: port %d status: %08x\n",
periph->periph_name, periph->unit_number,
softc->pm_step, res);
}
-   /* Report device speed. */
-   if (xpt_create_path(&dpath, periph,
+   /* Report device speed if it is online. */
+   if ((res & 0xf0f) == 0x103 &&
+   xpt_create_path(&dpath, periph,
xpt_path_path_id(periph->path),
softc->pm_step, 0) == CAM_REQ_CMP) {
bzero(&cts, sizeof(cts));
@@ -660,6 +671,9 @@ pmpdone(struct cam_periph *periph, union
cts.type = CTS_TYPE_CURRENT_SETTINGS;
cts.xport_specific.sata.revision = (res & 
0x0f0) >> 4;
cts.xport_specific.sata.valid = 
CTS_SATA_VALID_REVISION;
+   cts.xport_specific.sata.caps = softc->caps &
+   (CTS_SATA_CAPS_H_PMREQ | 
CTS_SATA_CAPS_H_DMAAA);
+   cts.xport_specific.sata.valid |= 
CTS_SATA_VALID_CAPS;
xpt_action((union ccb *)&cts);
xpt_free_path(dpath);
}

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Sun May  2 11:36:27 2010(r207498)
+++ head/sys/cam/ata/ata_xpt.c  Sun May  2 12:07:47 2010(r207499)
@@ -88,6 +88,9 @@ typedef enum {

svn commit: r207500 - head/sys/sparc64/sparc64

2010-05-02 Thread Marius Strobl
Author: marius
Date: Sun May  2 12:08:15 2010
New Revision: 207500
URL: http://svn.freebsd.org/changeset/base/207500

Log:
  Add a hack for SPARC64 V CPUs, which set some undocumented bits in the
  first data word.

Modified:
  head/sys/sparc64/sparc64/interrupt.S

Modified: head/sys/sparc64/sparc64/interrupt.S
==
--- head/sys/sparc64/sparc64/interrupt.SSun May  2 12:07:47 2010
(r207499)
+++ head/sys/sparc64/sparc64/interrupt.SSun May  2 12:08:15 2010
(r207500)
@@ -83,8 +83,11 @@ ENTRY(intr_vector)
 * The 2nd word points to code to execute and the 3rd is an argument
 * to pass.  Jump to it.
 */
-   brnz,a,pt %g3, 1f
-nop
+   brnz,pt %g3, 1f
+   /*
+* NB: Zeus CPUs set some undocumented bits in the first data word.
+*/
+and%g3, IV_MAX - 1, %g3
jmpl%g4, %g0
 nop
/* NOTREACHED */
___
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: r207468 - head/sys/kern

2010-05-02 Thread Attilio Rao
2010/5/1 Kostik Belousov :
> On Sat, May 01, 2010 at 04:47:36PM +0200, Attilio Rao wrote:
>> 2010/5/1 Konstantin Belousov :
>> > Author: kib
>> > Date: Sat May  1 14:46:17 2010
>> > New Revision: 207468
>> > URL: http://svn.freebsd.org/changeset/base/207468
>> >
>> > Log:
>> >  Extract thread_lock()/ruxagg()/thread_unlock() fragment into utility
>> >  function ruxagg_tlock().
>> >  Convert the definition of kern_getrusage() to ANSI C.
>> >
>>
>> I would have preferred a different naming for this, as the well known
>> _locked version we have of many functions.
>
> But this is not the case there, because I did not renamed ruxagg().
> It would be ruxagg()->ruxagg_unlocked() and ruxagg_tlock()->ruxagg().

Yes, this is exactly what I wanted to happen.

> My biggest question with the patch is I am not sure whether to apply
> the same checks for tu in calctru() as it is done for tu in calcru1().
> Any suggestions ?

I think that the checks may be present (the process-scope one is just
an aggregate of the threads' one, thus the same conditions apply.

> diff --git a/lib/libc/sys/getrusage.2 b/lib/libc/sys/getrusage.2
> index bdf5d45..423503f 100644
> --- a/lib/libc/sys/getrusage.2
> +++ b/lib/libc/sys/getrusage.2
> @@ -28,7 +28,7 @@
>  .\"     @(#)getrusage.2        8.1 (Berkeley) 6/4/93
>  .\" $FreeBSD$
>  .\"
> -.Dd June 4, 1993
> +.Dd May 1, 2010
>  .Dt GETRUSAGE 2
>  .Os
>  .Sh NAME
> @@ -42,6 +42,7 @@
>  .In sys/resource.h
>  .Fd "#define   RUSAGE_SELF      0"
>  .Fd "#define   RUSAGE_CHILDREN -1"
> +.Fd "#define   RUSAGE_THREAD   1"
>  .Ft int
>  .Fn getrusage "int who" "struct rusage *rusage"
>  .Sh DESCRIPTION
> @@ -49,11 +50,12 @@ The
>  .Fn getrusage
>  system call
>  returns information describing the resources utilized by the current
> -process, or all its terminated child processes.
> +thread, the current process, or all its terminated child processes.
>  The
>  .Fa who
>  argument is either
> -.Dv RUSAGE_SELF
> +.Dv RUSAGE_THREAD ,
> +.Dv RUSAGE_SELF ,
>  or
>  .Dv RUSAGE_CHILDREN .
>  The buffer to which
> @@ -175,6 +177,10 @@ The
>  .Fn getrusage
>  system call appeared in
>  .Bx 4.2 .
> +The
> +.Dv RUSAGE_THREAD
> +facility first appeared in
> +.Fx 8.1 .
>  .Sh BUGS
>  There is no way to obtain information about a child process
>  that has not yet terminated.
> diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
> index a3ed75d..8e7fdb6 100644
> --- a/sys/kern/kern_resource.c
> +++ b/sys/kern/kern_resource.c
> @@ -921,6 +921,31 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struct 
> timeval *up,
>        sp->tv_usec = su % 100;
>  }
>
> +static void
> +calctru(struct thread *td)
> +{
> +       /* {user, system, interrupt, total} {ticks, usec}: */
> +       u_int64_t ut, uu, st, su, it, tt, tu;
> +
> +       tu = cputick2usec(td->td_incruntime);
> +       ut = td->td_uticks;
> +       it = td->td_iticks;
> +       st = td->td_sticks;
> +
> +       tt = ut + st + it;
> +       if (tt == 0) {
> +               /* Avoid divide by zero */
> +               st = 1;
> +               tt = 1;
> +       }
> +       uu = td->td_ru.ru_utime.tv_usec + (ut * tu) / tt;
> +       su = td->td_ru.ru_stime.tv_usec + (st * tu) / tt;
> +       td->td_ru.ru_utime.tv_sec += uu / 100;
> +       td->td_ru.ru_utime.tv_usec = uu % 100;
> +       td->td_ru.ru_stime.tv_sec += su / 100;
> +       td->td_ru.ru_stime.tv_usec = su % 100;
> +}
> +
>  #ifndef _SYS_SYSPROTO_H_
>  struct getrusage_args {
>        int     who;

The comment on the top of calctru() might be removed.

> @@ -961,6 +986,13 @@ kern_getrusage(struct thread *td, int who, struct rusage 
> *rup)
>                calccru(p, &rup->ru_utime, &rup->ru_stime);
>                break;
>
> +       case RUSAGE_THREAD:
> +               PROC_SLOCK(p);
> +               ruxagg_tlock(p, td);
> +               PROC_SUNLOCK(p);
> +               *rup = td->td_ru;
> +               break;
> +
>        default:
>                error = EINVAL;
>        }
> @@ -1010,6 +1042,12 @@ ruxagg(struct rusage_ext *rux, struct thread *td)
>        rux->rux_uticks += td->td_uticks;
>        rux->rux_sticks += td->td_sticks;
>        rux->rux_iticks += td->td_iticks;
> +
> +       /*
> +        * Update thread rusage before ticks counters cleaning.
> +        */
> +       calctru(td);
> +
>        td->td_incruntime = 0;
>        td->td_uticks = 0;
>        td->td_iticks = 0;

The comment might be single-line and the extra white line after
calctru() is not due.

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"


svn commit: r207511 - head/sys/dev/ahci

2010-05-02 Thread Alexander Motin
Author: mav
Date: Sun May  2 14:46:05 2010
New Revision: 207511
URL: http://svn.freebsd.org/changeset/base/207511

Log:
  Enable PCI busmastering explicitly to be sure.

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

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cSun May  2 13:53:08 2010(r207510)
+++ head/sys/dev/ahci/ahci.cSun May  2 14:46:05 2010(r207511)
@@ -340,6 +340,7 @@ ahci_attach(device_t dev)
rman_fini(&ctlr->sc_iomem);
return (error);
}
+   pci_enable_busmaster(dev);
/* Reset controller */
if ((error = ahci_ctlr_reset(dev)) != 0) {
bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, 
ctlr->r_mem);
___
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: r207468 - head/sys/kern

2010-05-02 Thread Kostik Belousov
On Sun, May 02, 2010 at 03:48:50PM +0200, Attilio Rao wrote:
> 2010/5/1 Kostik Belousov :
> > On Sat, May 01, 2010 at 04:47:36PM +0200, Attilio Rao wrote:
> >> 2010/5/1 Konstantin Belousov :
> >> > Author: kib
> >> > Date: Sat May  1 14:46:17 2010
> >> > New Revision: 207468
> >> > URL: http://svn.freebsd.org/changeset/base/207468
> >> >
> >> > Log:
> >> >  Extract thread_lock()/ruxagg()/thread_unlock() fragment into utility
> >> >  function ruxagg_tlock().
> >> >  Convert the definition of kern_getrusage() to ANSI C.
> >> >
> >>
> >> I would have preferred a different naming for this, as the well known
> >> _locked version we have of many functions.
> >
> > But this is not the case there, because I did not renamed ruxagg().
> > It would be ruxagg()->ruxagg_unlocked() and ruxagg_tlock()->ruxagg().
> 
> Yes, this is exactly what I wanted to happen.
> 
> > My biggest question with the patch is I am not sure whether to apply
> > the same checks for tu in calctru() as it is done for tu in calcru1().
> > Any suggestions ?
> 
> I think that the checks may be present (the process-scope one is just
> an aggregate of the threads' one, thus the same conditions apply.

Ok, then the easiest way is to rewrite the patch. I removed your comments
for previous version since they are no longer relevant. I have to add
rusage_ext to struct thread, that would complicate the MFC.

And, looking at the whole picture, I do not understand how do we handle
the exiting threads. It seems that only user/system runtime is getting
collected to the process rusage. The other values, like i/o counters,
signals, ctx switches etc are thrown out.

diff --git a/lib/libc/sys/getrusage.2 b/lib/libc/sys/getrusage.2
index bdf5d45..423503f 100644
--- a/lib/libc/sys/getrusage.2
+++ b/lib/libc/sys/getrusage.2
@@ -28,7 +28,7 @@
 .\" @(#)getrusage.28.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd May 1, 2010
 .Dt GETRUSAGE 2
 .Os
 .Sh NAME
@@ -42,6 +42,7 @@
 .In sys/resource.h
 .Fd "#define   RUSAGE_SELF  0"
 .Fd "#define   RUSAGE_CHILDREN -1"
+.Fd "#define   RUSAGE_THREAD   1"
 .Ft int
 .Fn getrusage "int who" "struct rusage *rusage"
 .Sh DESCRIPTION
@@ -49,11 +50,12 @@ The
 .Fn getrusage
 system call
 returns information describing the resources utilized by the current
-process, or all its terminated child processes.
+thread, the current process, or all its terminated child processes.
 The
 .Fa who
 argument is either
-.Dv RUSAGE_SELF
+.Dv RUSAGE_THREAD ,
+.Dv RUSAGE_SELF ,
 or
 .Dv RUSAGE_CHILDREN .
 The buffer to which
@@ -175,6 +177,10 @@ The
 .Fn getrusage
 system call appeared in
 .Bx 4.2 .
+The
+.Dv RUSAGE_THREAD
+facility first appeared in
+.Fx 8.1 .
 .Sh BUGS
 There is no way to obtain information about a child process
 that has not yet terminated.
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index a3ed75d..0bc78d0 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -76,7 +76,7 @@ static void   calcru1(struct proc *p, struct rusage_ext *ruxp,
struct timeval *up, struct timeval *sp);
 static int donice(struct thread *td, struct proc *chgp, int n);
 static struct uidinfo *uilookup(uid_t uid);
-static voidruxagg_tlock(struct proc *p, struct thread *td);
+static voidruxagg(struct proc *p, struct thread *td);
 
 /*
  * Resource controls and accounting.
@@ -630,7 +630,7 @@ lim_cb(void *arg)
return;
PROC_SLOCK(p);
FOREACH_THREAD_IN_PROC(p, td) {
-   ruxagg_tlock(p, td);
+   ruxagg(p, td);
}
PROC_SUNLOCK(p);
if (p->p_rux.rux_runtime > p->p_cpulimit * cpu_tickrate()) {
@@ -841,7 +841,7 @@ calcru(struct proc *p, struct timeval *up, struct timeval 
*sp)
FOREACH_THREAD_IN_PROC(p, td) {
if (td->td_incruntime == 0)
continue;
-   ruxagg_tlock(p, td);
+   ruxagg(p, td);
}
calcru1(p, &p->p_rux, up, sp);
 }
@@ -961,6 +961,16 @@ kern_getrusage(struct thread *td, int who, struct rusage 
*rup)
calccru(p, &rup->ru_utime, &rup->ru_stime);
break;
 
+   case RUSAGE_THREAD:
+   PROC_SLOCK(p);
+   ruxagg(p, td);
+   PROC_SUNLOCK(p);
+   thread_lock(td);
+   *rup = td->td_ru;
+   calcru1(p, &td->td_rux, &rup->ru_utime, &rup->ru_stime);
+   thread_unlock(td);
+   break;
+
default:
error = EINVAL;
}
@@ -1001,7 +1011,7 @@ ruadd(struct rusage *ru, struct rusage_ext *rux, struct 
rusage *ru2,
  * Aggregate tick counts into the proc's rusage_ext.
  */
 void
-ruxagg(struct rusage_ext *rux, struct thread *td)
+ruxagg_locked(struct rusage_ext *rux, struct thread *td)
 {
 
THREAD_LOCK_ASSERT(td, MA_OWNED);
@@ -1010,18 +1020,19 @@ ruxagg(struct rusage_ext *rux, struct thread *td)
rux->rux_uticks += td->td_uticks;
rux->rux_sticks +

svn commit: r207519 - head/sys/vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 16:44:06 2010
New Revision: 207519
URL: http://svn.freebsd.org/changeset/base/207519

Log:
  This change addresses the race condition that was introduced by the previous
  revision, r207450, to this file.  Specifically, between dropping the page
  queues lock in vm_contig_launder() and reacquiring it in
  vm_contig_launder_page(), the page may be removed from the active or
  inactive queue.  It could be wired, freed, cached, etc.  None of which
  vm_contig_launder_page() is prepared for.
  
  Reviewed by:  kib, kmacy

Modified:
  head/sys/vm/vm_contig.c

Modified: head/sys/vm/vm_contig.c
==
--- head/sys/vm/vm_contig.c Sun May  2 16:40:18 2010(r207518)
+++ head/sys/vm/vm_contig.c Sun May  2 16:44:06 2010(r207519)
@@ -96,33 +96,33 @@ vm_contig_launder_page(vm_page_t m, vm_p
vm_page_t m_tmp;
struct vnode *vp;
struct mount *mp;
-   int vfslocked, dirty;
+   int vfslocked;
 
-   vm_page_lock(m);
-   vm_page_lock_queues();
+   mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+   vm_page_lock_assert(m, MA_OWNED);
object = m->object;
if (!VM_OBJECT_TRYLOCK(object) &&
!vm_pageout_fallback_object_lock(m, next)) {
-   VM_OBJECT_UNLOCK(object);
-   vm_page_unlock_queues();
vm_page_unlock(m);
+   VM_OBJECT_UNLOCK(object);
return (EAGAIN);
}
if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) {
VM_OBJECT_UNLOCK(object);
+   vm_page_lock_queues();
return (EBUSY);
}
vm_page_test_dirty(m);
if (m->dirty == 0 && m->hold_count == 0)
pmap_remove_all(m);
-   if ((dirty = m->dirty) != 0) {
-   vm_page_unlock_queues();
+   if (m->dirty != 0) {
vm_page_unlock(m);
if ((object->flags & OBJ_DEAD) != 0) {
VM_OBJECT_UNLOCK(object);
return (EAGAIN);
}
if (object->type == OBJT_VNODE) {
+   vm_page_unlock_queues();
vp = object->handle;
vm_object_reference_locked(object);
VM_OBJECT_UNLOCK(object);
@@ -136,19 +136,20 @@ vm_contig_launder_page(vm_page_t m, vm_p
VFS_UNLOCK_GIANT(vfslocked);
vm_object_deallocate(object);
vn_finished_write(mp);
+   vm_page_lock_queues();
return (0);
} else if (object->type == OBJT_SWAP ||
   object->type == OBJT_DEFAULT) {
+   vm_page_unlock_queues();
m_tmp = m;
vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC);
VM_OBJECT_UNLOCK(object);
+   vm_page_lock_queues();
return (0);
}
-   } else if (m->hold_count == 0)
-   vm_page_cache(m);
-
-   if (dirty == 0) {
-   vm_page_unlock_queues();
+   } else {
+   if (m->hold_count == 0)
+   vm_page_cache(m);
vm_page_unlock(m);
}
VM_OBJECT_UNLOCK(object);
@@ -167,11 +168,12 @@ vm_contig_launder(int queue)
if ((m->flags & PG_MARKER) != 0)
continue;
 
+   if (!vm_page_trylock(m))
+   continue;
KASSERT(VM_PAGE_INQUEUE2(m, queue),
("vm_contig_launder: page %p's queue is not %d", m, queue));
-   vm_page_unlock_queues();
error = vm_contig_launder_page(m, &next);
-   vm_page_lock_queues();
+   vm_page_lock_assert(m, MA_NOTOWNED);
if (error == 0)
return (TRUE);
if (error == EBUSY)
___
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: r207530 - in head/sys: fs/tmpfs kern vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 17:33:46 2010
New Revision: 207530
URL: http://svn.freebsd.org/changeset/base/207530

Log:
  It makes no sense for vm_page_sleep_if_busy()'s helper, vm_page_sleep(),
  to unconditionally set PG_REFERENCED on a page before sleeping.  In many
  cases, it's perfectly ok for the page to disappear, i.e., be reclaimed by
  the page daemon, before the caller to vm_page_sleep() is reawakened.
  Instead, we now explicitly set PG_REFERENCED in those cases where having
  the page persist until the caller is awakened is clearly desirable.  Note,
  however, that setting PG_REFERENCED on the page is still only a hint,
  and not a guarantee that the page should persist.

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c
  head/sys/kern/vfs_bio.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_page.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Sun May  2 16:55:13 2010
(r207529)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun May  2 17:33:46 2010
(r207530)
@@ -516,8 +516,16 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob
 lookupvpg:
if (((m = vm_page_lookup(vobj, idx)) != NULL) &&
vm_page_is_valid(m, offset, tlen)) {
-   if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr"))
+   if ((m->oflags & VPO_BUSY) != 0) {
+   /*
+* Reference the page before unlocking and sleeping so
+* that the page daemon is less likely to reclaim it.  
+*/
+   vm_page_lock_queues();
+   vm_page_flag_set(m, PG_REFERENCED);
+   vm_page_sleep(m, "tmfsmr");
goto lookupvpg;
+   }
vm_page_busy(m);
VM_OBJECT_UNLOCK(vobj);
error = uiomove_fromphys(&m, offset, tlen, uio);
@@ -526,8 +534,16 @@ lookupvpg:
VM_OBJECT_UNLOCK(vobj);
return  (error);
} else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) {
-   if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr"))
+   if ((m->oflags & VPO_BUSY) != 0) {
+   /*
+* Reference the page before unlocking and sleeping so
+* that the page daemon is less likely to reclaim it.  
+*/
+   vm_page_lock_queues();
+   vm_page_flag_set(m, PG_REFERENCED);
+   vm_page_sleep(m, "tmfsmr");
goto lookupvpg;
+   }
vm_page_busy(m);
VM_OBJECT_UNLOCK(vobj);
sched_pin();
@@ -627,8 +643,16 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o
 lookupvpg:
if (((vpg = vm_page_lookup(vobj, idx)) != NULL) &&
vm_page_is_valid(vpg, offset, tlen)) {
-   if (vm_page_sleep_if_busy(vpg, FALSE, "tmfsmw"))
+   if ((vpg->oflags & VPO_BUSY) != 0) {
+   /*
+* Reference the page before unlocking and sleeping so
+* that the page daemon is less likely to reclaim it.  
+*/
+   vm_page_lock_queues();
+   vm_page_flag_set(vpg, PG_REFERENCED);
+   vm_page_sleep(vpg, "tmfsmw");
goto lookupvpg;
+   }
vm_page_busy(vpg);
vm_page_lock_queues();
vm_page_undirty(vpg);

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Sun May  2 16:55:13 2010(r207529)
+++ head/sys/kern/vfs_bio.c Sun May  2 17:33:46 2010(r207530)
@@ -3024,8 +3024,17 @@ allocbuf(struct buf *bp, int size)
 *  vm_fault->getpages->cluster_read->allocbuf
 *
 */
-   if (vm_page_sleep_if_busy(m, FALSE, "pgtblk"))
+   if ((m->oflags & VPO_BUSY) != 0) {
+   /*
+* Reference the page before unlocking
+* and sleeping so that the page daemon
+* is less likely to reclaim it.  
+*/
+   vm_page_lock_queues();
+   vm_page_flag_set(m, PG_REFERENCED);
+   vm_page_sleep(m, "pgtblk");
continue;
+   }
 
/*
 * We have a good page.

Modified: head/sys/vm/vm_fault.c
==

svn commit: r207531 - head/sys/vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 18:09:33 2010
New Revision: 207531
URL: http://svn.freebsd.org/changeset/base/207531

Log:
  Correct an error in r207410: Remove an unlock of a lock that is no longer
  held.

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Sun May  2 17:33:46 2010(r207530)
+++ head/sys/vm/vm_object.c Sun May  2 18:09:33 2010(r207531)
@@ -1454,7 +1454,6 @@ retry:
 * not be changed by this operation.
 */
if ((m->oflags & VPO_BUSY) || m->busy) {
-   vm_page_unlock_queues();
VM_OBJECT_UNLOCK(new_object);
m->oflags |= VPO_WANTED;
msleep(m, VM_OBJECT_MTX(orig_object), PVM, "spltwt", 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: r207532 - head/sys/dev/quicc

2010-05-02 Thread Marius Strobl
Author: marius
Date: Sun May  2 19:05:57 2010
New Revision: 207532
URL: http://svn.freebsd.org/changeset/base/207532

Log:
  Remove a soft member which was never used.
  
  Approved by:  marcel

Modified:
  head/sys/dev/quicc/quicc_bfe.h

Modified: head/sys/dev/quicc/quicc_bfe.h
==
--- head/sys/dev/quicc/quicc_bfe.h  Sun May  2 18:09:33 2010
(r207531)
+++ head/sys/dev/quicc/quicc_bfe.h  Sun May  2 19:05:57 2010
(r207532)
@@ -50,7 +50,6 @@ struct quicc_softc {
u_int   sc_clock;
 
int sc_fastintr:1;
-   int sc_leaving:1;
int sc_polled: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: r207533 - in head/sys: dev/uart mips/cavium

2010-05-02 Thread Marius Strobl
Author: marius
Date: Sun May  2 19:07:19 2010
New Revision: 207533
URL: http://svn.freebsd.org/changeset/base/207533

Log:
  Remove redundant checking of sc_leaving (uart_intr() already handles this).
  
  Approved by:  marcel

Modified:
  head/sys/dev/uart/uart_dev_ns8250.c
  head/sys/mips/cavium/uart_dev_oct16550.c

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==
--- head/sys/dev/uart/uart_dev_ns8250.c Sun May  2 19:05:57 2010
(r207532)
+++ head/sys/dev/uart/uart_dev_ns8250.c Sun May  2 19:07:19 2010
(r207533)
@@ -604,7 +604,7 @@ ns8250_bus_ipend(struct uart_softc *sc)
if (ipend == 0)
ns8250_clrint(bas);
uart_unlock(sc->sc_hwmtx);
-   return ((sc->sc_leaving) ? 0 : ipend);
+   return (ipend);
 }
 
 static int

Modified: head/sys/mips/cavium/uart_dev_oct16550.c
==
--- head/sys/mips/cavium/uart_dev_oct16550.cSun May  2 19:05:57 2010
(r207532)
+++ head/sys/mips/cavium/uart_dev_oct16550.cSun May  2 19:07:19 2010
(r207533)
@@ -644,12 +644,9 @@ oct16550_bus_ipend(struct uart_softc *sc
 if (ipend) octeon_led_run_wheel(&where1, 6 + 
device_get_unit(sc->sc_dev));
 #endif
 
-   return ((sc->sc_leaving) ? 0 : ipend);
+   return (ipend);
 }
 
-
-
-
 static int
 oct16550_bus_param (struct uart_softc *sc, int baudrate, int databits,
 int stopbits, int parity)
___
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: r207534 - head/sys/kern

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 19:10:27 2010
New Revision: 207534
URL: http://svn.freebsd.org/changeset/base/207534

Log:
  Properly synchronize access to the page's hold_count in vfs_vmio_release().
  
  Reviewed by:  kib

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Sun May  2 19:07:19 2010(r207533)
+++ head/sys/kern/vfs_bio.c Sun May  2 19:10:27 2010(r207534)
@@ -1563,7 +1563,6 @@ vfs_vmio_release(struct buf *bp)
vm_page_t m;
 
VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
-   vm_page_lock_queues();
for (i = 0; i < bp->b_npages; i++) {
m = bp->b_pages[i];
bp->b_pages[i] = NULL;
@@ -1571,16 +1570,16 @@ vfs_vmio_release(struct buf *bp)
 * In order to keep page LRU ordering consistent, put
 * everything on the inactive queue.
 */
+   vm_page_lock(m);
+   vm_page_lock_queues();
vm_page_unwire(m, 0);
/*
 * We don't mess with busy pages, it is
 * the responsibility of the process that
 * busied the pages to deal with them.
 */
-   if ((m->oflags & VPO_BUSY) || (m->busy != 0))
-   continue;
-   
-   if (m->wire_count == 0) {
+   if ((m->oflags & VPO_BUSY) == 0 && m->busy == 0 &&
+   m->wire_count == 0) {
/*
 * Might as well free the page if we can and it has
 * no valid data.  We also free the page if the
@@ -1595,8 +1594,9 @@ vfs_vmio_release(struct buf *bp)
vm_page_try_to_cache(m);
}
}
+   vm_page_unlock_queues();
+   vm_page_unlock(m);
}
-   vm_page_unlock_queues();
VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object);
pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages);

___
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: r207535 - head/sys/kern

2010-05-02 Thread Konstantin Belousov
Author: kib
Date: Sun May  2 19:25:22 2010
New Revision: 207535
URL: http://svn.freebsd.org/changeset/base/207535

Log:
  Lock the page around hold_count access.
  
  Reviewed by:  alc

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Sun May  2 19:10:27 2010
(r207534)
+++ head/sys/kern/uipc_syscalls.c   Sun May  2 19:25:22 2010
(r207535)
@@ -2108,6 +2108,7 @@ retry_space:
mbstat.sf_iocnt++;
}
if (error) {
+   vm_page_lock(pg);
vm_page_lock_queues();
vm_page_unwire(pg, 0);
/*
@@ -2121,6 +2122,7 @@ retry_space:
vm_page_free(pg);
}
vm_page_unlock_queues();
+   vm_page_unlock(pg);
VM_OBJECT_UNLOCK(obj);
if (error == EAGAIN)
error = 0;  /* not a real error */
___
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: r207536 - in head: share/man/man4 sys/arm/mv sys/conf sys/dev/mvs sys/modules sys/modules/mvs

2010-05-02 Thread Alexander Motin
Author: mav
Date: Sun May  2 19:28:30 2010
New Revision: 207536
URL: http://svn.freebsd.org/changeset/base/207536

Log:
  Import mvs(4) - Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA controllers
  driver for CAM ATA subsystem. This driver supports same hardware as
  atamarvell, ataadaptec and atamvsata drivers from ata(4), but provides
  many additional features, such as NCQ, PMP, etc.

Added:
  head/share/man/man4/mvs.4   (contents, props changed)
  head/sys/dev/mvs/
  head/sys/dev/mvs/mvs.c   (contents, props changed)
  head/sys/dev/mvs/mvs.h   (contents, props changed)
  head/sys/dev/mvs/mvs_if.m   (contents, props changed)
  head/sys/dev/mvs/mvs_pci.c   (contents, props changed)
  head/sys/dev/mvs/mvs_soc.c   (contents, props changed)
  head/sys/modules/mvs/
  head/sys/modules/mvs/Makefile   (contents, props changed)
Modified:
  head/share/man/man4/Makefile
  head/sys/arm/mv/files.mv
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/conf/kmod.mk
  head/sys/modules/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileSun May  2 19:25:22 2010
(r207535)
+++ head/share/man/man4/MakefileSun May  2 19:28:30 2010
(r207536)
@@ -220,6 +220,7 @@ MAN=aac.4 \
msk.4 \
mtio.4 \
multicast.4 \
+   mvs.4 \
mwl.4 \
mwlfw.4 \
mxge.4 \

Added: head/share/man/man4/mvs.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/mvs.4   Sun May  2 19:28:30 2010(r207536)
@@ -0,0 +1,176 @@
+.\" Copyright (c) 2009 Alexander Motin 
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\"derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 27, 2010
+.Dt MVS 4
+.Os
+.Sh NAME
+.Nm mvs
+.Nd Marvell Serial ATA Host Controller driver
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device pci"
+.Cd "device scbus"
+.Cd "device mvs"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+mvs_load="YES"
+.Ed
+.Pp
+The following tunables are settable from the
+.Xr loader 8 :
+.Bl -ohang
+.It Va hint.mvs. Ns Ar X Ns Va .msi
+controls Message Signaled Interrupts (MSI) usage by the specified controller.
+.It Va hint.mvs. Ns Ar X Ns Va .ccc
+controls Command Completion Coalescing (CCC) usage by the specified controller.
+Non-zero value enables CCC and defines maximum time (in us), request can wait
+for interrupt.
+CCC reduces number of context switches on systems with many parallel requests,
+but it can decrease disk performance on some workloads due to additional
+command latency.
+.It Va hint.mvs. Ns Ar X Ns Va .
+defines number of completed commands for CCC, which trigger interrupt without
+waiting for specified coalescing timeout.
+.It Va hint.mvs. Ns Ar X Ns Va .pm_level
+controls SATA interface Power Management for the specified channel,
+allowing some power to be saved at the cost of additional command
+latency.
+Possible values:
+.Bl -tag -compact
+.It 0
+interface Power Management is disabled (default);
+.It 1
+device is allowed to initiate PM state change, host is passive;
+.It 4
+driver initiates PARTIAL PM state transition 1ms after port becomes idle;
+.It 5
+driver initiates SLUMBER PM state transition 125ms after port becomes idle.
+.El
+.P

svn commit: r207537 - in head/sys: boot/sparc64/loader conf sparc64/include sparc64/sparc64

2010-05-02 Thread Marius Strobl
Author: marius
Date: Sun May  2 19:38:17 2010
New Revision: 207537
URL: http://svn.freebsd.org/changeset/base/207537

Log:
  Add support for SPARC64 V (and where it already makes sense for other
  HAL/Fujitsu) CPUs. For the most part this consists of fleshing out the
  MMU and cache handling, it doesn't add pmap optimizations possible with
  these CPU, yet, though.
  With these changes FreeBSD runs stable on Fujitsu Siemens PRIMEPOWER 250
  and likely also other models based on SPARC64 V like 450, 650 and 850.
  Thanks go to Michael Moll for providing access to a PRIMEPOWER 250.

Added:
  head/sys/sparc64/include/mcntl.h   (contents, props changed)
  head/sys/sparc64/sparc64/zeus.c   (contents, props changed)
Modified:
  head/sys/boot/sparc64/loader/main.c
  head/sys/conf/files.sparc64
  head/sys/sparc64/include/asi.h
  head/sys/sparc64/include/cache.h
  head/sys/sparc64/sparc64/cache.c
  head/sys/sparc64/sparc64/cheetah.c
  head/sys/sparc64/sparc64/identcpu.c
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sparc64/sparc64/mp_locore.S
  head/sys/sparc64/sparc64/mp_machdep.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/sparc64/sparc64/tick.c

Modified: head/sys/boot/sparc64/loader/main.c
==
--- head/sys/boot/sparc64/loader/main.c Sun May  2 19:28:30 2010
(r207536)
+++ head/sys/boot/sparc64/loader/main.c Sun May  2 19:38:17 2010
(r207537)
@@ -451,7 +451,8 @@ dtlb_va_to_pa_sun4u(vm_offset_t va)
reg = dtlb_get_data_sun4u(i);
wrpr(pstate, pstate, 0);
reg >>= TD_PA_SHIFT;
-   if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
+   if (cpu_impl == CPU_IMPL_SPARC64V ||
+   cpu_impl >= CPU_IMPL_ULTRASPARCIII)
return (reg & TD_PA_CH_MASK);
return (reg & TD_PA_SF_MASK);
}
@@ -474,7 +475,8 @@ itlb_va_to_pa_sun4u(vm_offset_t va)
reg = itlb_get_data_sun4u(i);
wrpr(pstate, pstate, 0);
reg >>= TD_PA_SHIFT;
-   if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
+   if (cpu_impl == CPU_IMPL_SPARC64V ||
+   cpu_impl >= CPU_IMPL_ULTRASPARCIII)
return (reg & TD_PA_CH_MASK);
return (reg & TD_PA_SF_MASK);
}
@@ -696,6 +698,7 @@ cpu_cpuid_prop_sun4u(void)
 
switch (cpu_impl) {
case CPU_IMPL_SPARC64:
+   case CPU_IMPL_SPARC64V:
case CPU_IMPL_ULTRASPARCI:
case CPU_IMPL_ULTRASPARCII:
case CPU_IMPL_ULTRASPARCIIi:
@@ -720,6 +723,7 @@ cpu_get_mid_sun4u(void)
 
switch (cpu_impl) {
case CPU_IMPL_SPARC64:
+   case CPU_IMPL_SPARC64V:
case CPU_IMPL_ULTRASPARCI:
case CPU_IMPL_ULTRASPARCII:
case CPU_IMPL_ULTRASPARCIIi:

Modified: head/sys/conf/files.sparc64
==
--- head/sys/conf/files.sparc64 Sun May  2 19:28:30 2010(r207536)
+++ head/sys/conf/files.sparc64 Sun May  2 19:38:17 2010(r207537)
@@ -138,3 +138,4 @@ sparc64/sparc64/tsb.c   standard
 sparc64/sparc64/uio_machdep.c  standard
 sparc64/sparc64/upa.c  optionalcreator
 sparc64/sparc64/vm_machdep.c   standard
+sparc64/sparc64/zeus.c standard

Modified: head/sys/sparc64/include/asi.h
==
--- head/sys/sparc64/include/asi.h  Sun May  2 19:28:30 2010
(r207536)
+++ head/sys/sparc64/include/asi.h  Sun May  2 19:38:17 2010
(r207537)
@@ -82,7 +82,10 @@
 #defineASI_DCACHE_SNOOP_TAG0x44/* US-III Cu */
 
 /* Named ASI_DCUCR on US-III, but is mostly identical except for added bits. */
-#defineASI_LSU_CTL_REG 0x45
+#defineASI_LSU_CTL_REG 0x45/* US only */
+
+#defineASI_MCNTL   0x45/* SPARC64 only 
*/
+#defineAA_MCNTL0x08
 
 #defineASI_DCACHE_DATA 0x46
 #defineASI_DCACHE_TAG  0x47
@@ -167,6 +170,8 @@
 #defineASI_ICACHE_PRE_DECODE   0x6e/* US-I, II */
 #defineASI_ICACHE_PRE_NEXT_FIELD   0x6f/* US-I, II */
 
+#defineASI_FLUSH_L1I   0x67/* SPARC64 only 
*/
+
 #defineASI_BLK_AUIP0x70
 #defineASI_BLK_AIUS0x71
 

Modified: head/sys/sparc64/include/cache.h
==
--- head/sys/sparc64/include/cache.hSun May  2 19:28:30 2010
(r207536)
+++ head/sys/sparc64/include/cache.hSun May  2 19:38:17 2010
(r207537)
@@ -113,6 +113,10 @@ extern cache_flush_t *cache_flush;
 extern dcache_page_i

svn commit: r207539 - head/sys/vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 20:24:25 2010
New Revision: 207539
URL: http://svn.freebsd.org/changeset/base/207539

Log:
  Simplify vm_fault().  The introduction of the new page lock renders a bit of
  cleverness by vm_fault() to avoid repeatedly releasing and reacquiring the
  page queues lock pointless.
  
  Reviewed by:  kib, kmacy

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Sun May  2 20:12:20 2010(r207538)
+++ head/sys/vm/vm_fault.c  Sun May  2 20:24:25 2010(r207539)
@@ -215,7 +215,7 @@ vm_fault(vm_map_t map, vm_offset_t vaddr
 {
vm_prot_t prot;
int is_first_object_locked, result;
-   boolean_t are_queues_locked, growstack, wired;
+   boolean_t growstack, wired;
int map_generation;
vm_object_t next_object;
vm_page_t marray[VM_FAULT_READ];
@@ -478,7 +478,6 @@ readrest:
else
firstpindex = fs.first_pindex - 2 * 
VM_FAULT_READ;
 
-   are_queues_locked = FALSE;
/*
 * note: partially valid pages cannot be 
 * included in the lookahead - NFS piecemeal
@@ -495,17 +494,11 @@ readrest:
if (mt->busy ||
(mt->oflags & VPO_BUSY))
continue;
-   if (!are_queues_locked) {
-   are_queues_locked = TRUE;
-   vm_page_lock(mt);
-   vm_page_lock_queues();
-   } else {
-   vm_page_unlock_queues();
-   vm_page_lock(mt);
-   vm_page_lock_queues();
-   }
+   vm_page_lock(mt);
+   vm_page_lock_queues();
if (mt->hold_count ||
mt->wire_count) {
+   vm_page_unlock_queues();
vm_page_unlock(mt);
continue;
}
@@ -515,10 +508,9 @@ readrest:
} else {
vm_page_cache(mt);
}
+   vm_page_unlock_queues();
vm_page_unlock(mt);
}
-   if (are_queues_locked)
-   vm_page_unlock_queues();
ahead += behind;
behind = 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: r207540 - head/sys/vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 20:46:17 2010
New Revision: 207540
URL: http://svn.freebsd.org/changeset/base/207540

Log:
  Defer the acquisition of the page and page queues locks in
  vm_pageout_object_deactivate_pages().

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSun May  2 20:24:25 2010(r207539)
+++ head/sys/vm/vm_pageout.cSun May  2 20:46:17 2010(r207540)
@@ -540,6 +540,7 @@ vm_pageout_object_deactivate_pages(pmap,
for (object = first_object;; object = backing_object) {
if (pmap_resident_count(pmap) <= desired)
goto unlock_return;
+   VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
if (object->type == OBJT_PHYS || object->paging_in_progress)
goto unlock_return;
 
@@ -551,19 +552,18 @@ vm_pageout_object_deactivate_pages(pmap,
 */
p = TAILQ_FIRST(&object->memq);
while (p != NULL) {
-   vm_page_lock(p);
-   vm_page_lock_queues();
-   if (pmap_resident_count(pmap) <= desired) {
-   vm_page_unlock_queues();
-   vm_page_unlock(p);
+   if (pmap_resident_count(pmap) <= desired)
goto unlock_return;
-   }
next = TAILQ_NEXT(p, listq);
+   if ((p->oflags & VPO_BUSY) != 0 || p->busy != 0) {
+   p = next;
+   continue;
+   }
+   vm_page_lock(p);
+   vm_page_lock_queues();
cnt.v_pdpages++;
if (p->wire_count != 0 ||
p->hold_count != 0 ||
-   p->busy != 0 ||
-   (p->oflags & VPO_BUSY) ||
!pmap_page_exists_quick(pmap, p)) {
vm_page_unlock_queues();
vm_page_unlock(p);
___
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: r207541 - head/sys/vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 21:04:59 2010
New Revision: 207541
URL: http://svn.freebsd.org/changeset/base/207541

Log:
  Eliminate an assignment that was made redundant by r207410.

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cSun May  2 20:46:17 2010(r207540)
+++ head/sys/vm/vm_pageout.cSun May  2 21:04:59 2010(r207541)
@@ -1370,8 +1370,6 @@ vm_pageout_page_stats()
("vm_pageout_page_stats: page %p isn't active", m));
 
next = TAILQ_NEXT(m, pageq);
-   object = m->object;
-
if ((m->flags & PG_MARKER) != 0) {
m = next;
continue;
___
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: r207543 - head/sys/dev/mpt

2010-05-02 Thread Matt Jacob
Author: mjacob
Date: Sun May  2 22:48:27 2010
New Revision: 207543
URL: http://svn.freebsd.org/changeset/base/207543

Log:
  Print IR_RESYNC updates informatively.
  
  Obtained from:pluknet
  MFC after:1 week

Modified:
  head/sys/dev/mpt/mpt_cam.c

Modified: head/sys/dev/mpt/mpt_cam.c
==
--- head/sys/dev/mpt/mpt_cam.c  Sun May  2 21:11:47 2010(r207542)
+++ head/sys/dev/mpt/mpt_cam.c  Sun May  2 22:48:27 2010(r207543)
@@ -2575,6 +2575,10 @@ mpt_cam_event(struct mpt_softc *mpt, req
CAMLOCK_2_MPTLOCK(mpt);
break;
}
+   case MPI_EVENT_IR_RESYNC_UPDATE:
+   mpt_prt(mpt, "IR resync update %d completed\n",
+   (data0 >> 16) & 0xff);
+   break;
case MPI_EVENT_EVENT_CHANGE:
case MPI_EVENT_INTEGRATED_RAID:
case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
___
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: r207544 - head/sys/vm

2010-05-02 Thread Alan Cox
Author: alc
Date: Sun May  2 23:33:10 2010
New Revision: 207544
URL: http://svn.freebsd.org/changeset/base/207544

Log:
  Add page lock assertions where we access the page's hold_count.

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sun May  2 22:48:27 2010(r207543)
+++ head/sys/vm/vm_page.c   Sun May  2 23:33:10 2010(r207544)
@@ -1657,6 +1657,7 @@ vm_page_try_to_cache(vm_page_t m)
 {
 
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+   vm_page_lock_assert(m, MA_OWNED);
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
if (m->dirty || m->hold_count || m->busy || m->wire_count ||
(m->oflags & VPO_BUSY) || (m->flags & PG_UNMANAGED)) {
@@ -1680,6 +1681,7 @@ vm_page_try_to_free(vm_page_t m)
 {
 
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+   vm_page_lock_assert(m, MA_OWNED);
if (m->object != NULL)
VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
if (m->dirty || m->hold_count || m->busy || m->wire_count ||
@@ -1707,6 +1709,7 @@ vm_page_cache(vm_page_t m)
vm_page_t root;
 
mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+   vm_page_lock_assert(m, MA_OWNED);
object = m->object;
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
if ((m->flags & PG_UNMANAGED) || (m->oflags & VPO_BUSY) || m->busy ||
___
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: r207545 - head/sys/dev/sge

2010-05-02 Thread Pyun YongHyeon
Author: yongari
Date: Mon May  3 00:56:26 2010
New Revision: 207545
URL: http://svn.freebsd.org/changeset/base/207545

Log:
  Fix wrong dma tag usage. Previously it used TX descriptor ring dma
  tag which should be TX mbuf dma tag.
  
  Reported by:  xclin  cs dot nctu dot edu dot tw >

Modified:
  head/sys/dev/sge/if_sge.c

Modified: head/sys/dev/sge/if_sge.c
==
--- head/sys/dev/sge/if_sge.c   Sun May  2 23:33:10 2010(r207544)
+++ head/sys/dev/sge/if_sge.c   Mon May  3 00:56:26 2010(r207545)
@@ -1421,7 +1421,7 @@ sge_encap(struct sge_softc *sc, struct m
}
*m_head = m;
}
-   error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_tx_tag, map,
+   error = bus_dmamap_load_mbuf_sg(sc->sge_cdata.sge_txmbuf_tag, map,
*m_head, txsegs, &nsegs, 0);
if (error != 0) {
m_freem(*m_head);
@@ -1430,10 +1430,11 @@ sge_encap(struct sge_softc *sc, struct m
}
/* Check descriptor overrun. */
if (sc->sge_cdata.sge_tx_cnt + nsegs >= SGE_TX_RING_CNT) {
-   bus_dmamap_unload(sc->sge_cdata.sge_tx_tag, map);
+   bus_dmamap_unload(sc->sge_cdata.sge_txmbuf_tag, map);
return (ENOBUFS);
}
-   bus_dmamap_sync(sc->sge_cdata.sge_tx_tag, map, BUS_DMASYNC_PREWRITE);
+   bus_dmamap_sync(sc->sge_cdata.sge_txmbuf_tag, map,
+   BUS_DMASYNC_PREWRITE);
 
cflags = 0;
if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP)
___
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: r207548 - in head/sys: kern net

2010-05-02 Thread Alan Cox
Author: alc
Date: Mon May  3 05:41:50 2010
New Revision: 207548
URL: http://svn.freebsd.org/changeset/base/207548

Log:
  This is the first step in transitioning responsibility for synchronizing
  access to the page's wire_count from the page queues lock to the page lock.
  
  Submitted by: kmacy

Modified:
  head/sys/kern/uipc_cow.c
  head/sys/kern/uipc_syscalls.c
  head/sys/net/bpf_zerocopy.c

Modified: head/sys/kern/uipc_cow.c
==
--- head/sys/kern/uipc_cow.cMon May  3 01:13:37 2010(r207547)
+++ head/sys/kern/uipc_cow.cMon May  3 05:41:50 2010(r207548)
@@ -80,6 +80,7 @@ socow_iodone(void *addr, void *args)
pp = sf_buf_page(sf);
sf_buf_free(sf);
/* remove COW mapping  */
+   vm_page_lock(pp);
vm_page_lock_queues();
vm_page_cowclear(pp);
vm_page_unwire(pp, 0);
@@ -91,6 +92,7 @@ socow_iodone(void *addr, void *args)
if (pp->wire_count == 0 && pp->object == NULL)
vm_page_free(pp);
vm_page_unlock_queues();
+   vm_page_unlock(pp);
socow_stats.iodone++;
 }
 
@@ -149,6 +151,7 @@ socow_setup(struct mbuf *m0, struct uio 
 */
sf = sf_buf_alloc(pp, SFB_CATCH);
if (!sf) {
+   vm_page_lock(pp);
vm_page_lock_queues();
vm_page_cowclear(pp);
vm_page_unwire(pp, 0);
@@ -160,6 +163,7 @@ socow_setup(struct mbuf *m0, struct uio 
if (pp->wire_count == 0 && pp->object == NULL)
vm_page_free(pp);
vm_page_unlock_queues();
+   vm_page_unlock(pp);
socow_stats.fail_sf_buf++;
return(0);
}

Modified: head/sys/kern/uipc_syscalls.c
==
--- head/sys/kern/uipc_syscalls.c   Mon May  3 01:13:37 2010
(r207547)
+++ head/sys/kern/uipc_syscalls.c   Mon May  3 05:41:50 2010
(r207548)
@@ -1715,6 +1715,7 @@ sf_buf_mext(void *addr, void *args)
 
m = sf_buf_page(args);
sf_buf_free(args);
+   vm_page_lock(m);
vm_page_lock_queues();
vm_page_unwire(m, 0);
/*
@@ -1725,6 +1726,7 @@ sf_buf_mext(void *addr, void *args)
if (m->wire_count == 0 && m->object == NULL)
vm_page_free(m);
vm_page_unlock_queues();
+   vm_page_unlock(m);
if (addr == NULL)
return;
sfs = addr;
@@ -2136,6 +2138,7 @@ retry_space:
if ((sf = sf_buf_alloc(pg,
(mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) {
mbstat.sf_allocfail++;
+   vm_page_lock(pg);
vm_page_lock_queues();
vm_page_unwire(pg, 0);
/*
@@ -2144,6 +2147,7 @@ retry_space:
if (pg->wire_count == 0 && pg->object == NULL)
vm_page_free(pg);
vm_page_unlock_queues();
+   vm_page_unlock(pg);
error = (mnw ? EAGAIN : EINTR);
break;
}

Modified: head/sys/net/bpf_zerocopy.c
==
--- head/sys/net/bpf_zerocopy.c Mon May  3 01:13:37 2010(r207547)
+++ head/sys/net/bpf_zerocopy.c Mon May  3 05:41:50 2010(r207548)
@@ -112,11 +112,13 @@ static void
 zbuf_page_free(vm_page_t pp)
 {
 
+   vm_page_lock(pp);
vm_page_lock_queues();
vm_page_unwire(pp, 0);
if (pp->wire_count == 0 && pp->object == NULL)
vm_page_free(pp);
vm_page_unlock_queues();
+   vm_page_unlock(pp);
 }
 
 /*
___
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"