svn commit: r215449 - head/sys/dev/ata/chipsets

2010-11-18 Thread Alexander Motin
Author: mav
Date: Thu Nov 18 08:03:40 2010
New Revision: 215449
URL: http://svn.freebsd.org/changeset/base/215449

Log:
  Some VIA SATA controllers provide access to non-standard SATA registers via
  PCI config space. Use them to implement hot-plug and link speed reporting.
  Tested on ASRock PV530 board with VX900 chipset.

Modified:
  head/sys/dev/ata/chipsets/ata-via.c

Modified: head/sys/dev/ata/chipsets/ata-via.c
==
--- head/sys/dev/ata/chipsets/ata-via.c Thu Nov 18 02:16:06 2010
(r215448)
+++ head/sys/dev/ata/chipsets/ata-via.c Thu Nov 18 08:03:40 2010
(r215449)
@@ -63,6 +63,12 @@ static int ata_via_new_setmode(device_t 
 static int ata_via_sata_ch_attach(device_t dev);
 static int ata_via_sata_getrev(device_t dev, int target);
 static int ata_via_sata_setmode(device_t dev, int target, int mode);
+static void ata_via_sata_reset(device_t dev);
+static int ata_via_sata_scr_read(device_t dev, int port, int reg,
+u_int32_t *result);
+static int ata_via_sata_scr_write(device_t dev, int port, int reg,
+u_int32_t value);
+static int ata_via_sata_status(device_t dev);
 
 /* misc defines */
 #define VIA33   0
@@ -153,11 +159,12 @@ ata_via_chipinit(device_t dev)
if (ata_ahci_chipinit(dev) != ENXIO)
return (0);
 }
-/* 2 SATA without SATA registers on first channel + 1 PATA on second */
+/* 2 SATA with SATA registers at PCI config space + PATA on secondary */
 if (ctlr-chip-cfg2  VIASATA) {
ctlr-ch_attach = ata_via_sata_ch_attach;
ctlr-setmode = ata_via_sata_setmode;
ctlr-getrev = ata_via_sata_getrev;
+   ctlr-reset = ata_via_sata_reset;
return 0;
 }
 /* Legacy SATA/SATA+PATA with SATA registers in BAR(5). */
@@ -405,18 +412,30 @@ ata_via_sata_ch_attach(device_t dev)
 
if (ata_pci_ch_attach(dev))
return ENXIO;
-   if (ch-unit == 0)
+   if (ch-unit == 0) {
+   ch-hw.status = ata_via_sata_status;
+   ch-hw.pm_read = ata_via_sata_scr_read;
+   ch-hw.pm_write = ata_via_sata_scr_write;
+   ch-flags |= ATA_PERIODIC_POLL;
ch-flags |= ATA_SATA;
+   ata_sata_scr_write(ch, 0, ATA_SERROR, 0x);
+   ata_sata_scr_write(ch, 1, ATA_SERROR, 0x);
+   }
return (0);
 }
 
 static int
 ata_via_sata_getrev(device_t dev, int target)
 {
+   device_t parent = device_get_parent(dev);
struct ata_channel *ch = device_get_softc(dev);
 
-   if (ch-unit == 0)
-   return (1);
+   if (ch-unit == 0) {
+   if (pci_read_config(parent, 0xa0 + target, 1)  0x10)
+   return (2);
+   else
+   return (1);
+   }
return (0);
 }
 
@@ -430,5 +449,110 @@ ata_via_sata_setmode(device_t dev, int t
return (ata_via_old_setmode(dev, target, mode));
 }
 
+static void
+ata_via_sata_reset(device_t dev)
+{
+   struct ata_channel *ch = device_get_softc(dev);
+   int devs;
+
+   if (ch-unit == 0) {
+   devs = ata_sata_phy_reset(dev, 0, 0);
+   DELAY(1);
+   devs += ata_sata_phy_reset(dev, 1, 0);
+   } else
+   devs = 1;
+   if (devs)
+   ata_generic_reset(dev);
+}
+
+static int
+ata_via_sata_scr_read(device_t dev, int port, int reg, u_int32_t *result)
+{
+   struct ata_channel *ch;
+   device_t parent;
+   uint32_t val;
+
+   parent = device_get_parent(dev);
+   ch = device_get_softc(dev);
+   port = (port == 1) ? 1 : 0;
+   switch (reg) {
+   case ATA_SSTATUS:
+   val = pci_read_config(parent, 0xa0 + port, 1);
+   *result = val  0x03;
+   if (*result != ATA_SS_DET_NO_DEVICE) {
+   if (val  0x04)
+   *result |= ATA_SS_IPM_PARTIAL;
+   else if (val  0x08)
+   *result |= ATA_SS_IPM_SLUMBER;
+   else
+   *result |= ATA_SS_IPM_ACTIVE;
+   if (val  0x10)
+   *result |= ATA_SS_SPD_GEN2;
+   else
+   *result |= ATA_SS_SPD_GEN1;
+   }
+   break;
+   case ATA_SERROR:
+   *result = pci_read_config(parent, 0xa8 + port * 4, 4);
+   break;
+   case ATA_SCONTROL:
+   val = pci_read_config(parent, 0xa4 + port, 1);
+   *result = 0;
+   if (val  0x01)
+   *result |= ATA_SC_DET_RESET;
+   if (val  0x02)
+   *result |= ATA_SC_DET_DISABLE;
+   if (val  0x04)
+   *result |= ATA_SC_IPM_DIS_PARTIAL;
+   if (val  0x08)
+   *result |= ATA_SC_IPM_DIS_SLUMBER;
+

svn commit: r215453 - head/sys/dev/ata

2010-11-18 Thread Alexander Motin
Author: mav
Date: Thu Nov 18 11:58:17 2010
New Revision: 215453
URL: http://svn.freebsd.org/changeset/base/215453

Log:
  Even if we are skipping SATA hard reset - set power management bits in
  SControl register. This should make things consistent and help to avoid
  unexpected PHY events that I've noticed in some cases on VIA controllers.

Modified:
  head/sys/dev/ata/ata-sata.c

Modified: head/sys/dev/ata/ata-sata.c
==
--- head/sys/dev/ata/ata-sata.c Thu Nov 18 11:19:23 2010(r215452)
+++ head/sys/dev/ata/ata-sata.c Thu Nov 18 11:58:17 2010(r215453)
@@ -153,8 +153,12 @@ ata_sata_phy_reset(device_t dev, int por
 if (quick) {
if (ata_sata_scr_read(ch, port, ATA_SCONTROL, val))
return (0);
-   if ((val  ATA_SC_DET_MASK) == ATA_SC_DET_IDLE)
+   if ((val  ATA_SC_DET_MASK) == ATA_SC_DET_IDLE) {
+   ata_sata_scr_write(ch, port, ATA_SCONTROL,
+   ATA_SC_DET_IDLE | ((ch-pm_level  0) ? 0 :
+   ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER));
return ata_sata_connect(ch, port, quick);
+   }
 }
 
 if (bootverbose) {
___
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: r215427 - head/sys/crypto/aesni

2010-11-18 Thread Pawel Jakub Dawidek
On Wed, Nov 17, 2010 at 04:17:15PM +, Konstantin Belousov wrote:
 Author: kib
 Date: Wed Nov 17 16:17:15 2010
 New Revision: 215427
 URL: http://svn.freebsd.org/changeset/base/215427
 
 Log:
   Only save FPU context when not executing in the context of the crypto
   thread.

Is this just performance improvement or some kind of a bug fix?

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
p...@freebsd.org   http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!


pgpd6mcGUd9nT.pgp
Description: PGP signature


svn commit: r215454 - head/sys/cam/ata

2010-11-18 Thread Alexander Motin
Author: mav
Date: Thu Nov 18 13:38:33 2010
New Revision: 215454
URL: http://svn.freebsd.org/changeset/base/215454

Log:
  If HBA doesn't report user-enabled SATA capabilies (like ATA_CAM wrapper) -
  handle all of them as disabled. This was original cause of the problem,
  workarounded by r215453.
  
  MFC after:1 week

Modified:
  head/sys/cam/ata/ata_xpt.c

Modified: head/sys/cam/ata/ata_xpt.c
==
--- head/sys/cam/ata/ata_xpt.c  Thu Nov 18 11:58:17 2010(r215453)
+++ head/sys/cam/ata/ata_xpt.c  Thu Nov 18 13:38:33 2010(r215454)
@@ -963,6 +963,8 @@ noerror:
xpt_action((union ccb *)cts);
if (cts.xport_specific.sata.valid  CTS_SATA_VALID_CAPS)
caps = cts.xport_specific.sata.caps;
+   else
+   caps = 0;
/* Store result to SIM. */
bzero(cts, sizeof(cts));
xpt_setup_ccb(cts.ccb_h, path, CAM_PRIORITY_NONE);
@@ -1103,6 +1105,8 @@ notsata:
xpt_action((union ccb *)cts);
if (cts.xport_specific.sata.valid  CTS_SATA_VALID_CAPS)
caps = cts.xport_specific.sata.caps;
+   else
+   caps = 0;
/* Store result to SIM. */
bzero(cts, sizeof(cts));
xpt_setup_ccb(cts.ccb_h, path, CAM_PRIORITY_NONE);
___
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: r215427 - head/sys/crypto/aesni

2010-11-18 Thread Kostik Belousov
On Thu, Nov 18, 2010 at 02:24:17PM +0100, Pawel Jakub Dawidek wrote:
 On Wed, Nov 17, 2010 at 04:17:15PM +, Konstantin Belousov wrote:
  Author: kib
  Date: Wed Nov 17 16:17:15 2010
  New Revision: 215427
  URL: http://svn.freebsd.org/changeset/base/215427
  
  Log:
Only save FPU context when not executing in the context of the crypto
thread.
 
 Is this just performance improvement or some kind of a bug fix?

Only performance improvement.


pgpbZ13R7BSew.pgp
Description: PGP signature


svn commit: r215455 - in head: . cddl

2010-11-18 Thread Mark Murray
Author: markm
Date: Thu Nov 18 16:32:52 2010
New Revision: 215455
URL: http://svn.freebsd.org/changeset/base/215455

Log:
  Do not lint code beyond necessity (with apologies to Wiliam of Ockham).
  
  Don't lint externally maintained CDDL code, or relint the 32-bit libraries
  in amd64 mode.

Modified:
  head/Makefile.inc1
  head/cddl/Makefile.inc

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Nov 18 13:38:33 2010(r215454)
+++ head/Makefile.inc1  Thu Nov 18 16:32:52 2010(r215455)
@@ -322,7 +322,7 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTR
 
 LIB32WMAKE=${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
-   -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP}
+   -DWITHOUT_HTML -DNO_CTF -DNO_LINT DESTDIR=${LIB32TMP}
 LIB32IMAKE=${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
 .endif
 

Modified: head/cddl/Makefile.inc
==
--- head/cddl/Makefile.inc  Thu Nov 18 13:38:33 2010(r215454)
+++ head/cddl/Makefile.inc  Thu Nov 18 16:32:52 2010(r215455)
@@ -9,3 +9,8 @@ CFLAGS+=-DNEED_SOLARIS_BOOLEAN
 
 WARNS?=6
 CSTD?= gnu89
+
+# Do not lint the CDDL stuff. It is all externally maintained and
+# lint output is wasteful noise here.
+
+NO_LINT=
___
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: r215459 - head/sys/dev/mii

2010-11-18 Thread Marius Strobl
Author: marius
Date: Thu Nov 18 17:58:59 2010
New Revision: 215459
URL: http://svn.freebsd.org/changeset/base/215459

Log:
  Fix a bug introduced with r215298; when atphy_reset() is called from
  atphy_attach() the current media has not been set, yet, leading to a
  NULL-dereference in atphy_setmedia().
  
  Submitted by: jkim (initial version)

Modified:
  head/sys/dev/mii/atphy.c

Modified: head/sys/dev/mii/atphy.c
==
--- head/sys/dev/mii/atphy.cThu Nov 18 17:50:23 2010(r215458)
+++ head/sys/dev/mii/atphy.cThu Nov 18 17:58:59 2010(r215459)
@@ -317,6 +317,7 @@ atphy_status(struct mii_softc *sc)
 static void
 atphy_reset(struct mii_softc *sc)
 {
+   struct ifmedia_entry *ife = sc-mii_pdata-mii_media.ifm_cur;
struct atphy_softc *asc;
uint32_t reg;
int i;
@@ -339,7 +340,7 @@ atphy_reset(struct mii_softc *sc)
PHY_WRITE(sc, ATPHY_SCR, reg);
 
/* Workaround F1 bug to reset phy. */
-   atphy_setmedia(sc, sc-mii_pdata-mii_media.ifm_cur-ifm_media);
+   atphy_setmedia(sc, ife == NULL ? IFM_AUTO : ife-ifm_media);
 
for (i = 0; i  1000; i++) {
DELAY(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: r215462 - head/share/man/man4

2010-11-18 Thread Alexander Motin
Author: mav
Date: Thu Nov 18 18:09:25 2010
New Revision: 215462
URL: http://svn.freebsd.org/changeset/base/215462

Log:
  Add VIA VX900 to the list of supported chipsets.

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

Modified: head/share/man/man4/ata.4
==
--- head/share/man/man4/ata.4   Thu Nov 18 18:05:59 2010(r215461)
+++ head/share/man/man4/ata.4   Thu Nov 18 18:09:25 2010(r215462)
@@ -183,7 +183,7 @@ SIS963, SIS964, SIS965.
 .It VIA:
 VT6410, VT6420, VT6421, VT82C586, VT82C586B, VT82C596, VT82C596B, VT82C686,
 VT82C686A, VT82C686B, VT8231, VT8233, VT8233A, VT8233C, VT8235, VT8237,
-VT8237A, VT8237S, VT8251, CX700, VX800, VX855.
+VT8237A, VT8237S, VT8251, CX700, VX800, VX855, VX900.
 .El
 .Pp
 Unknown ATA chipsets are supported in PIO modes, and if the standard
___
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: r215463 - head/contrib/ipfilter/man

2010-11-18 Thread Mark Murray
Author: markm
Date: Thu Nov 18 18:22:58 2010
New Revision: 215463
URL: http://svn.freebsd.org/changeset/base/215463

Log:
  Fix paths for example files.

Modified:
  head/contrib/ipfilter/man/ipnat.8
  head/contrib/ipfilter/man/mkfilters.1

Modified: head/contrib/ipfilter/man/ipnat.8
==
--- head/contrib/ipfilter/man/ipnat.8   Thu Nov 18 18:09:25 2010
(r215462)
+++ head/contrib/ipfilter/man/ipnat.8   Thu Nov 18 18:22:58 2010
(r215463)
@@ -66,6 +66,6 @@ and active rules/table entries.
 .SH FILES
 /dev/ipnat
 .br
-/usr/share/examples/ipf  Directory with examples.
+/usr/share/examples/ipfilter  Directory with examples.
 .SH SEE ALSO
 ipnat(5), ipf(8), ipfstat(8)

Modified: head/contrib/ipfilter/man/mkfilters.1
==
--- head/contrib/ipfilter/man/mkfilters.1   Thu Nov 18 18:09:25 2010
(r215462)
+++ head/contrib/ipfilter/man/mkfilters.1   Thu Nov 18 18:22:58 2010
(r215463)
@@ -6,7 +6,7 @@ mkfilters \- generate a minimal firewall
 .SH SYNOPSIS
 .B mkfilters
 .SH FILES
-/usr/share/examples/ipf/mkfilters
+/usr/share/examples/ipfilter/mkfilters
 .SH DESCRIPTION
 .PP
 \fBmkfilters\fP is a perl script that generates a minimal filter rule set for
___
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: r215468 - head/sys/dev/ata

2010-11-18 Thread Alexander Motin
Author: mav
Date: Thu Nov 18 19:28:45 2010
New Revision: 215468
URL: http://svn.freebsd.org/changeset/base/215468

Log:
  Make ATA_CAM wrapper to report SATA power management capabilities to CAM to
  make it configure device to initiate transitions if controller configured
  to accept them. This makes hint.ata.X.pm_level=1 mode working.

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

Modified: head/sys/dev/ata/ata-all.c
==
--- head/sys/dev/ata/ata-all.c  Thu Nov 18 19:08:56 2010(r215467)
+++ head/sys/dev/ata/ata-all.c  Thu Nov 18 19:28:45 2010(r215468)
@@ -171,7 +171,12 @@ ata_attach(device_t dev)
ch-user[i].bytecount = 8192;
else
ch-user[i].bytecount = MAXPHYS;
+   ch-user[i].caps = 0;
ch-curr[i] = ch-user[i];
+   if (ch-pm_level  0)
+   ch-user[i].caps |= CTS_SATA_CAPS_H_PMREQ;
+   if (ch-pm_level  1)
+   ch-user[i].caps |= CTS_SATA_CAPS_D_PMREQ;
}
 #endif
callout_init(ch-poll_callout, 1);
@@ -1627,6 +1632,8 @@ ataaction(struct cam_sim *sim, union ccb
d-bytecount = min(8192, 
cts-xport_specific.sata.bytecount);
if (cts-xport_specific.sata.valid  
CTS_SATA_VALID_ATAPI)
d-atapi = cts-xport_specific.sata.atapi;
+   if (cts-xport_specific.sata.valid  
CTS_SATA_VALID_CAPS)
+   d-caps = cts-xport_specific.sata.caps;
} else {
if (cts-xport_specific.ata.valid  CTS_ATA_VALID_MODE) 
{
if (cts-type == CTS_TYPE_CURRENT_SETTINGS) {
@@ -1672,9 +1679,21 @@ ataaction(struct cam_sim *sim, union ccb
cts-xport_specific.sata.valid |=
CTS_SATA_VALID_REVISION;
}
+   cts-xport_specific.sata.caps =
+   d-caps  CTS_SATA_CAPS_D;
+   if (ch-pm_level) {
+   cts-xport_specific.sata.caps |=
+   CTS_SATA_CAPS_H_PMREQ;
+   }
+   cts-xport_specific.sata.caps =
+   ch-user[ccb-ccb_h.target_id].caps;
+   cts-xport_specific.sata.valid |=
+   CTS_SATA_VALID_CAPS;
} else {
cts-xport_specific.sata.revision = d-revision;
cts-xport_specific.sata.valid |= 
CTS_SATA_VALID_REVISION;
+   cts-xport_specific.sata.caps = d-caps;
+   cts-xport_specific.sata.valid |= 
CTS_SATA_VALID_CAPS;
}
cts-xport_specific.sata.atapi = d-atapi;
cts-xport_specific.sata.valid |= CTS_SATA_VALID_ATAPI;

Modified: head/sys/dev/ata/ata-all.h
==
--- head/sys/dev/ata/ata-all.h  Thu Nov 18 19:08:56 2010(r215467)
+++ head/sys/dev/ata/ata-all.h  Thu Nov 18 19:28:45 2010(r215468)
@@ -535,6 +535,7 @@ struct ata_cam_device {
int mode;
u_int   bytecount;
u_int   atapi;
+   u_int   caps;
 };
 #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: r215469 - head/sys/vm

2010-11-18 Thread Konstantin Belousov
Author: kib
Date: Thu Nov 18 20:46:28 2010
New Revision: 215469
URL: http://svn.freebsd.org/changeset/base/215469

Log:
  Only increment object generation count when inserting the page into
  object page list.  The only use of object generation count now is a
  restart of the scan in vm_object_page_clean(), which makes sense to do
  on the page addition. Page removals do not affect the dirtiness of the
  object, as well as manipulations with the shadow chain.
  
  Suggested and reviewed by:alc
  MFC after:1 week

Modified:
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Thu Nov 18 19:28:45 2010(r215468)
+++ head/sys/vm/vm_object.c Thu Nov 18 20:46:28 2010(r215469)
@@ -600,7 +600,6 @@ doterm:
VM_OBJECT_LOCK(temp);
LIST_REMOVE(object, shadow_list);
temp-shadow_count--;
-   temp-generation++;
VM_OBJECT_UNLOCK(temp);
object-backing_object = NULL;
}
@@ -1192,7 +1191,6 @@ vm_object_shadow(
VM_OBJECT_LOCK(source);
LIST_INSERT_HEAD(source-shadow_head, result, shadow_list);
source-shadow_count++;
-   source-generation++;
 #if VM_NRESERVLEVEL  0
result-flags |= source-flags  OBJ_COLORED;
result-pg_color = (source-pg_color + OFF_TO_IDX(*offset)) 
@@ -1260,7 +1258,6 @@ vm_object_split(vm_map_entry_t entry)
LIST_INSERT_HEAD(source-shadow_head,
  new_object, shadow_list);
source-shadow_count++;
-   source-generation++;
vm_object_reference_locked(source); /* for new_object */
vm_object_clear_flag(source, OBJ_ONEMAPPING);
VM_OBJECT_UNLOCK(source);
@@ -1651,7 +1648,6 @@ vm_object_collapse(vm_object_t object)
 */
LIST_REMOVE(object, shadow_list);
backing_object-shadow_count--;
-   backing_object-generation++;
if (backing_object-backing_object) {
VM_OBJECT_LOCK(backing_object-backing_object);
LIST_REMOVE(backing_object, shadow_list);
@@ -1661,7 +1657,6 @@ vm_object_collapse(vm_object_t object)
/*
 * The shadow_count has not changed.
 */
-   backing_object-backing_object-generation++;

VM_OBJECT_UNLOCK(backing_object-backing_object);
}
object-backing_object = backing_object-backing_object;
@@ -1703,7 +1698,6 @@ vm_object_collapse(vm_object_t object)
 */
LIST_REMOVE(object, shadow_list);
backing_object-shadow_count--;
-   backing_object-generation++;
 
new_backing_object = backing_object-backing_object;
if ((object-backing_object = new_backing_object) != 
NULL) {
@@ -1714,7 +1708,6 @@ vm_object_collapse(vm_object_t object)
shadow_list
);
new_backing_object-shadow_count++;
-   new_backing_object-generation++;
vm_object_reference_locked(new_backing_object);
VM_OBJECT_UNLOCK(new_backing_object);
object-backing_object_offset +=

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Nov 18 19:28:45 2010(r215468)
+++ head/sys/vm/vm_page.c   Thu Nov 18 20:46:28 2010(r215469)
@@ -846,7 +846,6 @@ vm_page_remove(vm_page_t m)
 * And show that the object has one fewer resident page.
 */
object-resident_page_count--;
-   object-generation++;
/*
 * The vnode may now be recycled.
 */
@@ -1983,7 +1982,6 @@ vm_page_cache(vm_page_t m)
object-root = root;
TAILQ_REMOVE(object-memq, m, listq);
object-resident_page_count--;
-   object-generation++;
 
/*
 * Restore the default memory attribute to the page.
@@ -2395,7 +2393,6 @@ vm_page_set_invalid(vm_page_t m, int bas
(vm_page_set_invalid: page %p is mapped, m));
m-valid = ~bits;
m-dirty = ~bits;
-   m-object-generation++;
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, 

svn commit: r215470 - head/sys/i386/xen

2010-11-18 Thread Colin Percival
Author: cperciva
Date: Thu Nov 18 21:02:40 2010
New Revision: 215470
URL: http://svn.freebsd.org/changeset/base/215470

Log:
  Don't KASSERT in pmap_release that
xpmap_ptom(VM_PAGE_TO_PHYS(m)) == (pmap-pm_pdpt[i]  PG_FRAME)
  for i = NPGPTD, since pmap-pm_pdpt[i] is only initialized for
  0 = i  NPGPTD.
  
  This fixes an inevitable panic with XEN  PAE  INVARIANTS when
  pmap_release is called (e.g., when /sbin/init is launched).

Modified:
  head/sys/i386/xen/pmap.c

Modified: head/sys/i386/xen/pmap.c
==
--- head/sys/i386/xen/pmap.cThu Nov 18 20:46:28 2010(r215469)
+++ head/sys/i386/xen/pmap.cThu Nov 18 21:02:40 2010(r215470)
@@ -1877,8 +1877,9 @@ pmap_release(pmap_t pmap)
/* unpinning L1 and L2 treated the same */
 xen_pgd_unpin(ma);
 #ifdef PAE
-   KASSERT(xpmap_ptom(VM_PAGE_TO_PHYS(m)) == (pmap-pm_pdpt[i]  
PG_FRAME),
-   (pmap_release: got wrong ptd page));
+   if (i  NPGPTD)
+   KASSERT(xpmap_ptom(VM_PAGE_TO_PHYS(m)) == 
(pmap-pm_pdpt[i]  PG_FRAME),
+   (pmap_release: got wrong ptd page));
 #endif
m-wire_count--;
atomic_subtract_int(cnt.v_wire_count, 1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r215471 - head/sys/vm

2010-11-18 Thread Konstantin Belousov
Author: kib
Date: Thu Nov 18 21:09:02 2010
New Revision: 215471
URL: http://svn.freebsd.org/changeset/base/215471

Log:
  vm_pageout_flush() might cache the pages that finished write to the
  backing storage. Such pages might be then reused, racing with the
  assert in vm_object_page_collect_flush() that verified that dirty
  pages from the run (most likely, pages with VM_PAGER_AGAIN status) are
  write-protected still. In fact, the page indexes for the pages that
  were removed from the object page list should be ignored by
  vm_object_page_clean().
  
  Return the length of successfully written run from vm_pageout_flush(),
  that is, the count of pages between requested page and first page
  after requested with status VM_PAGER_AGAIN. Supply the requested page
  index in the array to vm_pageout_flush(). Use the returned run length
  to forward the index of next page to clean in vm_object_page_clean().
  
  Reported by:  avg
  Reviewed by:  alc
  MFC after:1 week

Modified:
  head/sys/vm/vm_contig.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_pageout.h

Modified: head/sys/vm/vm_contig.c
==
--- head/sys/vm/vm_contig.c Thu Nov 18 21:02:40 2010(r215470)
+++ head/sys/vm/vm_contig.c Thu Nov 18 21:09:02 2010(r215471)
@@ -140,7 +140,7 @@ vm_contig_launder_page(vm_page_t m, vm_p
   object-type == OBJT_DEFAULT) {
vm_page_unlock_queues();
m_tmp = m;
-   vm_pageout_flush(m_tmp, 1, VM_PAGER_PUT_SYNC);
+   vm_pageout_flush(m_tmp, 1, VM_PAGER_PUT_SYNC, 0, NULL);
VM_OBJECT_UNLOCK(object);
vm_page_lock_queues();
return (0);

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Thu Nov 18 21:02:40 2010(r215470)
+++ head/sys/vm/vm_object.c Thu Nov 18 21:09:02 2010(r215471)
@@ -884,30 +884,9 @@ vm_object_page_collect_flush(vm_object_t
index = (maxb + i) + 1;
ma[index] = maf[i];
}
-   runlen = maxb + maxf + 1;
 
-   vm_pageout_flush(ma, runlen, pagerflags);
-   for (i = 0; i  runlen; i++) {
-   if (ma[i]-dirty != 0) {
-   KASSERT((ma[i]-flags  PG_WRITEABLE) == 0,
-   (vm_object_page_collect_flush: page %p is not write protected,
-   ma[i]));
-   }
-   }
-   for (i = 0; i  maxf; i++) {
-   if (ma[i + maxb + 1]-dirty != 0) {
-   /*
-* maxf will end up being the actual number of pages
-* we wrote out contiguously, non-inclusive of the
-* first page.  We do not count look-behind pages.
-*/
-   if (maxf  i) {
-   maxf = i;
-   break;
-   }
-   }
-   }
-   return (maxf + 1);
+   vm_pageout_flush(ma, maxb + maxf + 1, pagerflags, maxb + 1, runlen);
+   return (runlen);
 }
 
 /*

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cThu Nov 18 21:02:40 2010(r215470)
+++ head/sys/vm/vm_pageout.cThu Nov 18 21:09:02 2010(r215471)
@@ -438,7 +438,7 @@ more:
/*
 * we allow reads during pageouts...
 */
-   return (vm_pageout_flush(mc[page_base], pageout_count, 0));
+   return (vm_pageout_flush(mc[page_base], pageout_count, 0, 0, NULL));
 }
 
 /*
@@ -449,14 +449,17 @@ more:
  * reference count all in here rather then in the parent.  If we want
  * the parent to do more sophisticated things we may have to change
  * the ordering.
+ *
+ * Returned runlen is the count of pages between mreq and first
+ * page after mreq with status VM_PAGER_AGAIN.
  */
 int
-vm_pageout_flush(vm_page_t *mc, int count, int flags)
+vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen)
 {
vm_object_t object = mc[0]-object;
int pageout_status[count];
int numpagedout = 0;
-   int i;
+   int i, runlen;
 
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
mtx_assert(vm_page_queue_mtx, MA_NOTOWNED);
@@ -482,6 +485,7 @@ vm_pageout_flush(vm_page_t *mc, int coun
 
vm_pager_put_pages(object, mc, count, flags, pageout_status);
 
+   runlen = count - mreq;
for (i = 0; i  count; i++) {
vm_page_t mt = mc[i];
 
@@ -513,6 +517,8 @@ vm_pageout_flush(vm_page_t *mc, int coun
vm_page_unlock(mt);
break;
case VM_PAGER_AGAIN:
+   if (i = mreq  i - mreq  

svn commit: r215472 - head/sys/i386/xen

2010-11-18 Thread Colin Percival
Author: cperciva
Date: Thu Nov 18 21:29:43 2010
New Revision: 215472
URL: http://svn.freebsd.org/changeset/base/215472

Log:
  Make pmap_release match pmap_pinit by invoking pmap_qremove(pmap-pm_pdpt)
  to match pmap_pinit's pmap_qenter(pmap-pm_pdpt) call in the case of PAE.

Modified:
  head/sys/i386/xen/pmap.c

Modified: head/sys/i386/xen/pmap.c
==
--- head/sys/i386/xen/pmap.cThu Nov 18 21:09:02 2010(r215471)
+++ head/sys/i386/xen/pmap.cThu Nov 18 21:29:43 2010(r215472)
@@ -1885,6 +1885,9 @@ pmap_release(pmap_t pmap)
atomic_subtract_int(cnt.v_wire_count, 1);
vm_page_free(m);
}
+#ifdef PAE
+   pmap_qremove((vm_offset_t)pmap-pm_pdpt, 1);
+#endif
PMAP_LOCK_DESTROY(pmap);
 }
 
___
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: r215473 - in head/sys/dev: acpica atkbdc

2010-11-18 Thread John Baldwin
Author: jhb
Date: Thu Nov 18 22:17:20 2010
New Revision: 215473
URL: http://svn.freebsd.org/changeset/base/215473

Log:
  Various small typos and grammar nits in comments.

Modified:
  head/sys/dev/acpica/acpi_hpet.c
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/acpica/acpi_hpet.c
==
--- head/sys/dev/acpica/acpi_hpet.c Thu Nov 18 21:29:43 2010
(r215472)
+++ head/sys/dev/acpica/acpi_hpet.c Thu Nov 18 22:17:20 2010
(r215473)
@@ -501,7 +501,7 @@ hpet_attach(device_t dev)
/*
 * Neither QEMU nor VirtualBox report supported IRQs correctly.
 * The only way to use HPET there is to specify IRQs manually
-* and/or use legacy_route. Legacy_route mode work on both.
+* and/or use legacy_route. Legacy_route mode works on both.
 */
if (vm_guest)
sc-allowed_irqs = 0x;
@@ -591,7 +591,7 @@ hpet_attach(device_t dev)
bus_write_4(sc-mem_res, HPET_ISR, 0x);
sc-irq = -1;
sc-intr_rid = -1;
-   /* If at least one timer needs legacy IRQ - setup it. */
+   /* If at least one timer needs legacy IRQ - set it up. */
if (sc-useirq) {
j = i = fls(cvectors) - 1;
while (j  0  (cvectors  (1  (j - 1))) != 0)

Modified: head/sys/dev/atkbdc/psm.c
==
--- head/sys/dev/atkbdc/psm.c   Thu Nov 18 21:29:43 2010(r215472)
+++ head/sys/dev/atkbdc/psm.c   Thu Nov 18 22:17:20 2010(r215473)
@@ -1214,12 +1214,12 @@ psmprobe(device_t dev)
 * be that this is only the case when the controller DOES have the aux
 * port but the port is not wired on the motherboard.) The keyboard
 * controllers without the port, such as the original AT, are
-* supporsed to return with an error code or simply time out. In any
+* supposed to return with an error code or simply time out. In any
 * case, we have to continue probing the port even when the controller
 * passes this test.
 *
 * XXX: some controllers erroneously return the error code 1, 2 or 3
-* when it has the perfectly functional aux port. We have to ignore
+* when it has a perfectly functional aux port. We have to ignore
 * this error code. Even if the controller HAS error with the aux
 * port, it will be detected later...
 * XXX: another incompatible controller returns PSM_ACK (0xfa)...
@@ -1250,7 +1250,7 @@ psmprobe(device_t dev)
if (sc-config  PSM_CONFIG_NORESET) {
/*
 * Don't try to reset the pointing device.  It may possibly be
-* left in the unknown state, though...
+* left in an unknown state, though...
 */
} else {
/*
@@ -1277,7 +1277,7 @@ psmprobe(device_t dev)
}
 
/*
-* both the aux port and the aux device is functioning, see if the
+* both the aux port and the aux device are functioning, see if the
 * device can be enabled. NOTE: when enabled, the device will start
 * sending data; we shall immediately disable the device once we know
 * the device can be enabled.
___
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: r215474 - head/usr.bin/netstat

2010-11-18 Thread Ryan Stone
Author: rstone
Date: Thu Nov 18 23:46:55 2010
New Revision: 215474
URL: http://svn.freebsd.org/changeset/base/215474

Log:
  When netstat was run with -i/-I and -w1 to produce running counters, the idrop
  field printed an absolute value rather than the delta from the last value
  
  Approved by:  emaste (mentor)
  MFC after:1 week

Modified:
  head/usr.bin/netstat/if.c

Modified: head/usr.bin/netstat/if.c
==
--- head/usr.bin/netstat/if.c   Thu Nov 18 22:17:20 2010(r215473)
+++ head/usr.bin/netstat/if.c   Thu Nov 18 23:46:55 2010(r215474)
@@ -627,6 +627,7 @@ loop:
}
ip-ift_ip = ifnet.if_ipackets;
ip-ift_ie = ifnet.if_ierrors;
+   ip-ift_id = ifnet.if_iqdrops;
ip-ift_ib = ifnet.if_ibytes;
ip-ift_op = ifnet.if_opackets;
ip-ift_oe = ifnet.if_oerrors;
___
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: r215508 - head/sys/vm

2010-11-18 Thread Max Laier
Author: mlaier
Date: Fri Nov 19 04:30:33 2010
New Revision: 215508
URL: http://svn.freebsd.org/changeset/base/215508

Log:
  Off by one page in vm_reserv_reclaim_contig(): Also reclaim reservations
  with only a single free page if that satisfies the requested size.
  
  MFC after:3 days
  Reviewed by:  alc

Modified:
  head/sys/vm/vm_reserv.c

Modified: head/sys/vm/vm_reserv.c
==
--- head/sys/vm/vm_reserv.c Fri Nov 19 03:47:10 2010(r215507)
+++ head/sys/vm/vm_reserv.c Fri Nov 19 04:30:33 2010(r215508)
@@ -654,7 +654,8 @@ vm_reserv_reclaim_contig(vm_paddr_t size
((pa ^ (pa + size - 1)) 
~(boundary - 1)) != 0)
pa_length = 0;
-   } else if (pa_length = size) {
+   }
+   if (pa_length = size) {
vm_reserv_reclaim(rv);
return (TRUE);
}
___
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