git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Lutz Donnerhacke
The branch main has been updated by donner:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=effc8e57fbf03d7f1423c662caf2b63f0d1d21a9

commit effc8e57fbf03d7f1423c662caf2b63f0d1d21a9
Author: Lutz Donnerhacke 
AuthorDate: 2021-05-14 13:08:08 +
Commit: Lutz Donnerhacke 
CommitDate: 2021-05-15 06:57:55 +

libalias: Style cleanup

libalias is a convolut of various coding styles modified by a series
of different editors enforcing interesting convetions on spacing and
comments.

This patch is a baseline to start with a perfomance rework of
libalias.  Upcoming patches should be focus on the code, not on the
style.  That's why most annoying style errors should be fixed
beforehand.

Reviewed by:hselasky
Discussed by:   emaste
MFC after:  2 weeks
Differential Revision: https://reviews.freebsd.org/D30259
---
 sys/netinet/libalias/alias.c| 379 -
 sys/netinet/libalias/alias.h|  44 ++--
 sys/netinet/libalias/alias_db.c | 414 +---
 sys/netinet/libalias/alias_dummy.c  |  15 +-
 sys/netinet/libalias/alias_ftp.c|  68 +++---
 sys/netinet/libalias/alias_irc.c|  52 +++--
 sys/netinet/libalias/alias_local.h  | 178 +++-
 sys/netinet/libalias/alias_mod.c|   2 -
 sys/netinet/libalias/alias_nbt.c| 253 ++
 sys/netinet/libalias/alias_pptp.c   |  84 
 sys/netinet/libalias/alias_proxy.c  | 271 ---
 sys/netinet/libalias/alias_sctp.c   | 138 ++--
 sys/netinet/libalias/alias_sctp.h   |  26 +--
 sys/netinet/libalias/alias_skinny.c |  30 ++-
 sys/netinet/libalias/alias_smedia.c |  91 
 sys/netinet/libalias/alias_util.c   |  30 +--
 16 files changed, 975 insertions(+), 1100 deletions(-)

diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c
index 900731fcbec6..cac19ab55d56 100644
--- a/sys/netinet/libalias/alias.c
+++ b/sys/netinet/libalias/alias.c
@@ -146,7 +146,7 @@ __FBSDID("$FreeBSD$");
 #include "alias_mod.h"
 #endif
 
-/* 
+/*
  * Define libalias SYSCTL Node
  */
 #ifdef SYSCTL_NODE
@@ -192,7 +192,6 @@ static void TcpMonitorOut(u_char, struct alias_link *);
 static void
 TcpMonitorIn(u_char th_flags, struct alias_link *lnk)
 {
-
switch (GetStateIn(lnk)) {
case ALIAS_TCP_STATE_NOT_CONNECTED:
if (th_flags & TH_RST)
@@ -210,7 +209,6 @@ TcpMonitorIn(u_char th_flags, struct alias_link *lnk)
 static void
 TcpMonitorOut(u_char th_flags, struct alias_link *lnk)
 {
-
switch (GetStateOut(lnk)) {
case ALIAS_TCP_STATE_NOT_CONNECTED:
if (th_flags & TH_RST)
@@ -285,21 +283,20 @@ static intUdpAliasOut(struct libalias *, struct 
ip *, int, int create);
 static int TcpAliasIn(struct libalias *, struct ip *);
 static int TcpAliasOut(struct libalias *, struct ip *, int, int create);
 
-static int
-IcmpAliasIn1(struct libalias *la, struct ip *pip)
-{
-
-   LIBALIAS_LOCK_ASSERT(la);
 /*
 De-alias incoming echo and timestamp replies.
 Alias incoming echo and timestamp requests.
 */
+static int
+IcmpAliasIn1(struct libalias *la, struct ip *pip)
+{
+   LIBALIAS_LOCK_ASSERT(la);
struct alias_link *lnk;
struct icmp *ic;
 
ic = (struct icmp *)ip_next(pip);
 
-/* Get source address from ICMP data field and restore original data */
+   /* Get source address from ICMP data field and restore original data */
lnk = FindIcmpIn(la, pip->ip_src, pip->ip_dst, ic->icmp_id, 1);
if (lnk != NULL) {
u_short original_id;
@@ -307,15 +304,15 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip)
 
original_id = GetOriginalPort(lnk);
 
-/* Adjust ICMP checksum */
+   /* Adjust ICMP checksum */
accumulate = ic->icmp_id;
accumulate -= original_id;
ADJUST_CHECKSUM(accumulate, ic->icmp_cksum);
 
-/* Put original sequence number back in */
+   /* Put original sequence number back in */
ic->icmp_id = original_id;
 
-/* Put original address back into IP header */
+   /* Put original address back into IP header */
{
struct in_addr original_address;
 
@@ -330,15 +327,14 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip)
return (PKT_ALIAS_IGNORED);
 }
 
-static int
-IcmpAliasIn2(struct libalias *la, struct ip *pip)
-{
-
-   LIBALIAS_LOCK_ASSERT(la);
 /*
 Alias incoming ICMP error messages containing
 IP header and first 64 bits of datagram.
 */
+static int
+IcmpAliasIn2(struct libalias *la, struct ip *pip)
+{
+   LIBALIAS_LOCK_ASSERT(la);
struct ip *ip;
struct icmp *ic, *ic2;
struct udphdr *ud;
@@ -377,7 +373,7 @@ IcmpAliasIn2(struct libalias *la, struct ip *pip)
original_address = GetOriginalAddress(lnk);
original_po

git: 189f8eea138a - main - libalias: replace placeholder with static constant

2021-05-15 Thread Lutz Donnerhacke
The branch main has been updated by donner:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=189f8eea138a78b09c9f19114b1362b0df1cf87d

commit 189f8eea138a78b09c9f19114b1362b0df1cf87d
Author: Lutz Donnerhacke 
AuthorDate: 2021-05-13 21:47:57 +
Commit: Lutz Donnerhacke 
CommitDate: 2021-05-15 07:05:30 +

libalias: replace placeholder with static constant

The field nullAddress in struct libalias is never set and never used.
It exists as a placeholder for an unused argument only.

Reviewed by:hselasky
MFC after:  2 weeks
Differential Revision: https://reviews.freebsd.org/D30253
---
 sys/netinet/libalias/alias_db.c| 24 ++--
 sys/netinet/libalias/alias_local.h |  2 --
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c
index cd29c16ac945..518f221c63f9 100644
--- a/sys/netinet/libalias/alias_db.c
+++ b/sys/netinet/libalias/alias_db.c
@@ -224,6 +224,10 @@ static LIST_HEAD(, libalias) instancehead = 
LIST_HEAD_INITIALIZER(instancehead);
 #define NO_DEST_PORT 1
 #define NO_SRC_PORT  1
 
+/* Dummy address used for FindLinkIn/Out() and AddLink().
+   The value of this variable is never used. */
+static struct in_addr const NO_ADDR;
+
 /* Data Structures
 
 The fundamental data structure used in this program is
@@ -,12 +1115,12 @@ _FindLinkOut(struct libalias *la, struct in_addr 
src_addr,
lnk = _FindLinkOut(la, src_addr, dst_addr, src_port, 0,
link_type, 0);
if (lnk == NULL)
-   lnk = _FindLinkOut(la, src_addr, 
la->nullAddress, src_port,
+   lnk = _FindLinkOut(la, src_addr, NO_ADDR, 
src_port,
dst_port, link_type, 0);
}
if (lnk == NULL &&
(dst_port != 0 || dst_addr.s_addr != INADDR_ANY)) {
-   lnk = _FindLinkOut(la, src_addr, la->nullAddress, 
src_port, 0,
+   lnk = _FindLinkOut(la, src_addr, NO_ADDR, src_port, 0,
link_type, 0);
}
if (lnk != NULL) {
@@ -1152,7 +1156,7 @@ FindLinkOut(struct libalias *la, struct in_addr src_addr,
 */
if (la->aliasAddress.s_addr != INADDR_ANY &&
src_addr.s_addr == la->aliasAddress.s_addr) {
-   lnk = _FindLinkOut(la, la->nullAddress, dst_addr, 
src_port, dst_port,
+   lnk = _FindLinkOut(la, NO_ADDR, dst_addr, src_port, 
dst_port,
link_type, replace_partial_links);
}
}
@@ -1294,7 +1298,7 @@ FindLinkIn(struct libalias *la, struct in_addr dst_addr,
 */
if (la->aliasAddress.s_addr != INADDR_ANY &&
alias_addr.s_addr == la->aliasAddress.s_addr) {
-   lnk = _FindLinkIn(la, dst_addr, la->nullAddress, 
dst_port, alias_port,
+   lnk = _FindLinkIn(la, dst_addr, NO_ADDR, dst_port, 
alias_port,
link_type, replace_partial_links);
}
}
@@ -1376,7 +1380,7 @@ FindFragmentIn1(struct libalias *la, struct in_addr 
dst_addr,
LINK_FRAGMENT_ID, 0);
 
if (lnk == NULL) {
-   lnk = AddLink(la, la->nullAddress, dst_addr, alias_addr,
+   lnk = AddLink(la, NO_ADDR, dst_addr, alias_addr,
NO_SRC_PORT, NO_DEST_PORT, ip_id,
LINK_FRAGMENT_ID);
}
@@ -1399,7 +1403,7 @@ AddFragmentPtrLink(struct libalias *la, struct in_addr 
dst_addr,
 u_short ip_id)
 {
LIBALIAS_LOCK_ASSERT(la);
-   return AddLink(la, la->nullAddress, dst_addr, la->nullAddress,
+   return AddLink(la, NO_ADDR, dst_addr, NO_ADDR,
NO_SRC_PORT, NO_DEST_PORT, ip_id,
LINK_FRAGMENT_PTR);
 }
@@ -1409,7 +1413,7 @@ FindFragmentPtr(struct libalias *la, struct in_addr 
dst_addr,
 u_short ip_id)
 {
LIBALIAS_LOCK_ASSERT(la);
-   return FindLinkIn(la, dst_addr, la->nullAddress,
+   return FindLinkIn(la, dst_addr, NO_ADDR,
NO_DEST_PORT, ip_id,
LINK_FRAGMENT_PTR, 0);
 }
@@ -1669,7 +1673,7 @@ FindOriginalAddress(struct libalias *la, struct in_addr 
alias_addr)
struct alias_link *lnk;
 
LIBALIAS_LOCK_ASSERT(la);
-   lnk = FindLinkIn(la, la->nullAddress, alias_addr,
+   lnk = FindLinkIn(la, NO_ADDR, alias_addr,
0, 0, LINK_ADDR, 0);
if (lnk == NULL) {
la->newDefaultLink = 1;
@@ -1701,7 +1705,7 @@ FindAliasAddress(struct libalias *la, struct in_addr 
original_addr)
struct alias_link *lnk;
 
LIBALIAS_LOCK_ASSERT(la);
-   lnk = FindLinkOut(la, original_addr, la->nullAddress,
+   lnk = FindLinkOut(la, original_addr, NO_ADDR,
0, 0, LINK_ADDR, 0

git: 3394d4239b85 - main - cam: allocate CCBs from UMA for SCSI and ATA IO

2021-05-15 Thread Edward Tomasz Napierala
The branch main has been updated by trasz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3394d4239b85b5577845d9e6de4e97b18d3dba58

commit 3394d4239b85b5577845d9e6de4e97b18d3dba58
Author: Edward Tomasz Napierala 
AuthorDate: 2021-05-15 10:17:22 +
Commit: Edward Tomasz Napierala 
CommitDate: 2021-05-15 11:03:49 +

cam: allocate CCBs from UMA for SCSI and ATA IO

This patch makes it possible for CAM to use small CCBs allocated
from an periph-specific UMA zone instead of the usual, huge ones.
The end result is that CCBs issued via da(4) take 544B (size of
ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB,
rounded up by malloc(9)).  For ATA it's 272B.  We waste less
memory, we avoid zeroing the unused 1kB, and it should be easier
to allocate those CCBs in low memory conditions.  It should also
be possible to use uma_zone_reserve(9) to improve behaviour
in low memory conditions even further.

Note that this does not change the size, or the layout, of CCBs
as such.  CCBs get allocated in various different ways, in particular
on the stack, and I don't want to redo all that.  Instead, this
provides an opt-in mechanism for the periph to declare "my start()
callback is fine with receiving a CCB allocated from this UMA zone".
In other words, most of the code works exactly as it used to; the
change only happens to IOs issued by xpt_run_allockq(), which
is - conveniently - pretty much all that matters for performance.

The reason for doing it this way is that it's pretty small, localized
change, and can be implemented gradually and iteratively: take a
periph, make sure its start() callback only casts the CCBs it takes
to a particular type of CCB, for example ccb_scsiio, and that it only
casts CCBs returned by cam_periph_getccb() to that type, then add UMA
zone for that size, and declare it safe to XPT.

This is disabled by default.  Set 'kern.cam.ada.enable_uma_ccbs=1'
and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it.  Testing
is welcome; I will flip the default to enable in two weeks from now.

Reviewed By:imp
Sponsored by:   NetApp, Inc.
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D28674
---
 sys/cam/ata/ata_da.c| 18 ++
 sys/cam/ata/ata_xpt.c   |  7 +++
 sys/cam/cam_ccb.h   | 14 +-
 sys/cam/cam_periph.h|  3 +++
 sys/cam/cam_xpt.c   | 32 +---
 sys/cam/scsi/scsi_da.c  | 18 ++
 sys/cam/scsi/scsi_xpt.c |  7 +++
 7 files changed, 95 insertions(+), 4 deletions(-)

diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index c29235e64e81..a8b67b2254a6 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -297,6 +297,8 @@ struct ada_softc {
charannounce_buffer[ADA_ANNOUNCE_SZ];
 };
 
+static uma_zone_t ada_ccb_zone;
+
 struct ada_quirk_entry {
struct scsi_inquiry_pattern inq_pat;
ada_quirks quirks;
@@ -902,6 +904,7 @@ static int ada_spindown_suspend = 
ADA_DEFAULT_SPINDOWN_SUSPEND;
 static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD;
 static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE;
 static int ada_enable_biospeedup = 1;
+static int ada_enable_uma_ccbs = 0;
 
 static SYSCTL_NODE(_kern_cam, OID_AUTO, ada, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
 "CAM Direct Access Disk driver");
@@ -921,6 +924,8 @@ SYSCTL_INT(_kern_cam_ada, OID_AUTO, write_cache, 
CTLFLAG_RWTUN,
&ada_write_cache, 0, "Enable disk write cache");
 SYSCTL_INT(_kern_cam_ada, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN,
   &ada_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing");
+SYSCTL_INT(_kern_cam_ada, OID_AUTO, enable_uma_ccbs, CTLFLAG_RWTUN,
+   &ada_enable_uma_ccbs, 0, "Use UMA for CCBs");
 
 /*
  * ADA_ORDEREDTAG_INTERVAL determines how often, relative
@@ -1178,6 +1183,10 @@ adainit(void)
 {
cam_status status;
 
+   ada_ccb_zone = uma_zcreate("ada_ccb",
+   sizeof(struct ccb_ataio), NULL, NULL, NULL, NULL,
+   UMA_ALIGN_PTR, 0);
+
/*
 * Install a global async callback.  This callback will
 * receive async callbacks like "new device found".
@@ -1855,6 +1864,15 @@ adaregister(struct cam_periph *periph, void *arg)
"kern.cam.ada.%d.write_cache", periph->unit_number);
TUNABLE_INT_FETCH(announce_buf, &softc->write_cache);
 
+   /*
+* Let XPT know we can use UMA-allocated CCBs.
+*/
+   if (ada_enable_uma_ccbs) {
+   KASSERT(ada_ccb_zone != NULL,
+   ("%s: NULL ada_ccb_zone", __func__));
+   periph->ccb_zone = ada_ccb_zone;
+   }
+
/*
 * Set support flags based on the Identify data and quirks.
 */
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index 0f94e556745a..c13c7b493c78 100644
--- a/sys/cam/ata/ata_xpt

git: 7fbc0c98a8ef - main - build(7): use a more relevant example for PORTS_MODULES

2021-05-15 Thread Mitchell Horne
The branch main has been updated by mhorne:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7fbc0c98a8efaef86d72759372ec7746d929302e

commit 7fbc0c98a8efaef86d72759372ec7746d929302e
Author: Mitchell Horne 
AuthorDate: 2021-05-15 14:14:52 +
Commit: Mitchell Horne 
CommitDate: 2021-05-15 14:15:25 +

build(7): use a more relevant example for PORTS_MODULES

emulators/kqemu-kmod no longer exists in the ports tree.

Reviewed by:imp, bcr
Differential Revision:  https://reviews.freebsd.org/D30261
---
 share/man/man7/build.7 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index 9591b0365307..62c24eaed0dc 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 28, 2021
+.Dd May 15, 2021
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -602,7 +602,7 @@ and
 .Cm installkernel
 process.
 .Bd -literal -offset indent
-make PORTS_MODULES=emulators/kqemu-kmod kernel
+make PORTS_MODULES=emulators/virtualbox-ose-kmod kernel
 .Ed
 .It Va SRCCONF
 Specify a file to override the default
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 3394d4239b85 - main - cam: allocate CCBs from UMA for SCSI and ATA IO

2021-05-15 Thread Gary Jennejohn
On Sat, 15 May 2021 11:05:49 GMT
Edward Tomasz Napierala  wrote:

> The branch main has been updated by trasz:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=3394d4239b85b5577845d9e6de4e97b18d3dba58
> 
> commit 3394d4239b85b5577845d9e6de4e97b18d3dba58
> Author: Edward Tomasz Napierala 
> AuthorDate: 2021-05-15 10:17:22 +
> Commit: Edward Tomasz Napierala 
> CommitDate: 2021-05-15 11:03:49 +
> 
> cam: allocate CCBs from UMA for SCSI and ATA IO
> 
> This patch makes it possible for CAM to use small CCBs allocated
> from an periph-specific UMA zone instead of the usual, huge ones.
> The end result is that CCBs issued via da(4) take 544B (size of
> ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB,
> rounded up by malloc(9)).  For ATA it's 272B.  We waste less
> memory, we avoid zeroing the unused 1kB, and it should be easier
> to allocate those CCBs in low memory conditions.  It should also
> be possible to use uma_zone_reserve(9) to improve behaviour
> in low memory conditions even further.
> 
> Note that this does not change the size, or the layout, of CCBs
> as such.  CCBs get allocated in various different ways, in particular
> on the stack, and I don't want to redo all that.  Instead, this
> provides an opt-in mechanism for the periph to declare "my start()
> callback is fine with receiving a CCB allocated from this UMA zone".
> In other words, most of the code works exactly as it used to; the
> change only happens to IOs issued by xpt_run_allockq(), which
> is - conveniently - pretty much all that matters for performance.
> 
> The reason for doing it this way is that it's pretty small, localized
> change, and can be implemented gradually and iteratively: take a
> periph, make sure its start() callback only casts the CCBs it takes
> to a particular type of CCB, for example ccb_scsiio, and that it only
> casts CCBs returned by cam_periph_getccb() to that type, then add UMA
> zone for that size, and declare it safe to XPT.
> 
> This is disabled by default.  Set 'kern.cam.ada.enable_uma_ccbs=1'
> and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it.  Testing
> is welcome; I will flip the default to enable in two weeks from now.
> 

[snip diff]

I built and installed world and kernel and enabled both tunables.

System's been up for about two hours using both ada and da disks
pretty intensely and hasn't trashed any yet.

-- 
Gary Jennejohn
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Konstantin Belousov
On Sat, May 15, 2021 at 07:01:07AM +, Lutz Donnerhacke wrote:
> The branch main has been updated by donner:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=effc8e57fbf03d7f1423c662caf2b63f0d1d21a9
> 
> commit effc8e57fbf03d7f1423c662caf2b63f0d1d21a9
> Author: Lutz Donnerhacke 
> AuthorDate: 2021-05-14 13:08:08 +
> Commit: Lutz Donnerhacke 
> CommitDate: 2021-05-15 06:57:55 +
> 
> libalias: Style cleanup
> 
> libalias is a convolut of various coding styles modified by a series
> of different editors enforcing interesting convetions on spacing and
> comments.
> 
> This patch is a baseline to start with a perfomance rework of
> libalias.  Upcoming patches should be focus on the code, not on the
> style.  That's why most annoying style errors should be fixed
> beforehand.
> 
> Reviewed by:hselasky
> Discussed by:   emaste
> MFC after:  2 weeks
> Differential Revision: https://reviews.freebsd.org/D30259
> ---
>  sys/netinet/libalias/alias.c| 379 -
>  sys/netinet/libalias/alias.h|  44 ++--
>  sys/netinet/libalias/alias_db.c | 414 
> +---
>  sys/netinet/libalias/alias_dummy.c  |  15 +-
>  sys/netinet/libalias/alias_ftp.c|  68 +++---
>  sys/netinet/libalias/alias_irc.c|  52 +++--
>  sys/netinet/libalias/alias_local.h  | 178 +++-
>  sys/netinet/libalias/alias_mod.c|   2 -
>  sys/netinet/libalias/alias_nbt.c| 253 ++
>  sys/netinet/libalias/alias_pptp.c   |  84 
>  sys/netinet/libalias/alias_proxy.c  | 271 ---
>  sys/netinet/libalias/alias_sctp.c   | 138 ++--
>  sys/netinet/libalias/alias_sctp.h   |  26 +--
>  sys/netinet/libalias/alias_skinny.c |  30 ++-
>  sys/netinet/libalias/alias_smedia.c |  91 
>  sys/netinet/libalias/alias_util.c   |  30 +--
>  16 files changed, 975 insertions(+), 1100 deletions(-)
> 
> diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c
> index 900731fcbec6..cac19ab55d56 100644
> --- a/sys/netinet/libalias/alias.c
> +++ b/sys/netinet/libalias/alias.c
> @@ -146,7 +146,7 @@ __FBSDID("$FreeBSD$");
>  #include "alias_mod.h"
>  #endif
>  
> -/* 
> +/*
>   * Define libalias SYSCTL Node
>   */
>  #ifdef SYSCTL_NODE
> @@ -192,7 +192,6 @@ static void   TcpMonitorOut(u_char, struct alias_link 
> *);
>  static void
>  TcpMonitorIn(u_char th_flags, struct alias_link *lnk)
>  {
> -
>   switch (GetStateIn(lnk)) {
This was style-compatible.

>   case ALIAS_TCP_STATE_NOT_CONNECTED:
>   if (th_flags & TH_RST)
> @@ -210,7 +209,6 @@ TcpMonitorIn(u_char th_flags, struct alias_link *lnk)
>  static void
>  TcpMonitorOut(u_char th_flags, struct alias_link *lnk)
>  {
> -
>   switch (GetStateOut(lnk)) {
>   case ALIAS_TCP_STATE_NOT_CONNECTED:
>   if (th_flags & TH_RST)
> @@ -285,21 +283,20 @@ static int  UdpAliasOut(struct libalias *, struct 
> ip *, int, int create);
>  static int   TcpAliasIn(struct libalias *, struct ip *);
>  static int   TcpAliasOut(struct libalias *, struct ip *, int, int create);
>  
> -static int
> -IcmpAliasIn1(struct libalias *la, struct ip *pip)
> -{
> -
> - LIBALIAS_LOCK_ASSERT(la);
>  /*
>  De-alias incoming echo and timestamp replies.
>  Alias incoming echo and timestamp requests.
>  */
> +static int
> +IcmpAliasIn1(struct libalias *la, struct ip *pip)
> +{
> + LIBALIAS_LOCK_ASSERT(la);
>   struct alias_link *lnk;
>   struct icmp *ic;
And this is not in style.  Declarations must precede executable statements,
even asserts.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Lutz Donnerhacke
On Sat, May 15, 2021 at 10:41:53PM +0300, Konstantin Belousov wrote:
> On Sat, May 15, 2021 at 07:01:07AM +, Lutz Donnerhacke wrote:
> > @@ -285,21 +283,20 @@ static intUdpAliasOut(struct libalias *, struct 
> > ip *, int, int create);
> >  static int TcpAliasIn(struct libalias *, struct ip *);
> >  static int TcpAliasOut(struct libalias *, struct ip *, int, int create);
> >  
> > -static int
> > -IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > -{
> > -
> > -   LIBALIAS_LOCK_ASSERT(la);
> >  /*
> >  De-alias incoming echo and timestamp replies.
> >  Alias incoming echo and timestamp requests.
> >  */
> > +static int
> > +IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > +{
> > +   LIBALIAS_LOCK_ASSERT(la);
> > struct alias_link *lnk;
> > struct icmp *ic;
> And this is not in style.  Declarations must precede executable statements,
> even asserts.

Of course it was a style commit.

+ /*
+  De-alias incoming echo and timestamp replies.
+  Alias incoming echo and timestamp requests.
+  */
  static int
  IcmpAliasIn1(struct libalias *la, struct ip *pip)
  {
-
LIBALIAS_LOCK_ASSERT(la);
- /*
-  De-alias incoming echo and timestamp replies.
-  Alias incoming echo and timestamp requests.
-  */
struct alias_link *lnk;
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Konstantin Belousov
On Sat, May 15, 2021 at 09:58:12PM +0200, Lutz Donnerhacke wrote:
> On Sat, May 15, 2021 at 10:41:53PM +0300, Konstantin Belousov wrote:
> > On Sat, May 15, 2021 at 07:01:07AM +, Lutz Donnerhacke wrote:
> > > @@ -285,21 +283,20 @@ static int  UdpAliasOut(struct libalias *, struct 
> > > ip *, int, int create);
> > >  static int   TcpAliasIn(struct libalias *, struct ip *);
> > >  static int   TcpAliasOut(struct libalias *, struct ip *, int, int 
> > > create);
> > >  
> > > -static int
> > > -IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > > -{
> > > -
> > > - LIBALIAS_LOCK_ASSERT(la);
> > >  /*
> > >  De-alias incoming echo and timestamp replies.
> > >  Alias incoming echo and timestamp requests.
> > >  */
> > > +static int
> > > +IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > > +{
> > > + LIBALIAS_LOCK_ASSERT(la);
> > >   struct alias_link *lnk;
> > >   struct icmp *ic;
> > And this is not in style.  Declarations must precede executable statements,
> > even asserts.
> 
> Of course it was a style commit.
> 
> + /*
> +  De-alias incoming echo and timestamp replies.
> +  Alias incoming echo and timestamp requests.
> +  */
>   static int
>   IcmpAliasIn1(struct libalias *la, struct ip *pip)
>   {
> -
>   LIBALIAS_LOCK_ASSERT(la);
> - /*
> -  De-alias incoming echo and timestamp replies.
> -  Alias incoming echo and timestamp requests.
> -  */
>   struct alias_link *lnk;
I do not understand what are you trying to say.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Lutz Donnerhacke
On Sat, May 15, 2021 at 11:14:31PM +0300, Konstantin Belousov wrote:
> On Sat, May 15, 2021 at 09:58:12PM +0200, Lutz Donnerhacke wrote:
> > Of course it was a style commit.
> > 
> > + /*
> > +  De-alias incoming echo and timestamp replies.
> > +  Alias incoming echo and timestamp requests.
> > +  */
> >   static int
> >   IcmpAliasIn1(struct libalias *la, struct ip *pip)
> >   {
> > -
> > LIBALIAS_LOCK_ASSERT(la);
> > - /*
> > -  De-alias incoming echo and timestamp replies.
> > -  Alias incoming echo and timestamp requests.
> > -  */
> > struct alias_link *lnk;
>
> I do not understand what are you trying to say.

The diff above is a reformatting of the original diff in the commit.
It does show, what really happend during the edit:
  - The empty line at the beginnen of the function body was removed
  - The comment at the beginning of the function body was moved
before the function definition.

The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: eec2e4ef7f96 - main - tmpfs: reimplement the mtime scan to use the lazy list

2021-05-15 Thread Mateusz Guzik
The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=eec2e4ef7f964d18fcec3dc2cdcd7530be490835

commit eec2e4ef7f964d18fcec3dc2cdcd7530be490835
Author: Mateusz Guzik 
AuthorDate: 2021-05-07 14:43:43 +
Commit: Mateusz Guzik 
CommitDate: 2021-05-15 20:48:45 +

tmpfs: reimplement the mtime scan to use the lazy list

Tested by:  pho
Reviewed by:kib, markj
Differential Revision:  https://reviews.freebsd.org/D30065
---
 sys/fs/tmpfs/tmpfs.h|   1 +
 sys/fs/tmpfs/tmpfs_subr.c   | 107 
 sys/fs/tmpfs/tmpfs_vfsops.c |  67 ++-
 3 files changed, 143 insertions(+), 32 deletions(-)

diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h
index bb777e29e3d0..99368d67 100644
--- a/sys/fs/tmpfs/tmpfs.h
+++ b/sys/fs/tmpfs/tmpfs.h
@@ -46,6 +46,7 @@ MALLOC_DECLARE(M_TMPFSNAME);
 #endif
 
 #defineOBJ_TMPFS   OBJ_PAGERPRIV1  /* has tmpfs vnode allocated */
+#defineOBJ_TMPFS_VREF  OBJ_PAGERPRIV2  /* vnode is referenced */
 
 /*
  * Internal representation of a tmpfs directory entry.
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 67eb12598e24..8b75c58d69a2 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -99,6 +99,92 @@ tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t 
prot,
return (object);
 }
 
+/*
+ * Make sure tmpfs vnodes with writable mappings can be found on the lazy list.
+ *
+ * This allows for periodic mtime updates while only scanning vnodes which are
+ * plausibly dirty, see tmpfs_update_mtime_lazy.
+ */
+static void
+tmpfs_pager_writecount_recalc(vm_object_t object, vm_offset_t old,
+vm_offset_t new)
+{
+   struct vnode *vp;
+
+   VM_OBJECT_ASSERT_WLOCKED(object);
+
+   vp = object->un_pager.swp.swp_tmpfs;
+
+   /*
+* Forced unmount?
+*/
+   if (vp == NULL) {
+   KASSERT((object->flags & OBJ_TMPFS_VREF) == 0,
+   ("object %p with OBJ_TMPFS_VREF but without vnode", 
object));
+   VM_OBJECT_WUNLOCK(object);
+   return;
+   }
+
+   if (old == 0) {
+   VNASSERT((object->flags & OBJ_TMPFS_VREF) == 0, vp,
+   ("object without writable mappings has a reference"));
+   VNPASS(vp->v_usecount > 0, vp);
+   } else {
+   VNASSERT((object->flags & OBJ_TMPFS_VREF) != 0, vp,
+   ("object with writable mappings does not have a 
reference"));
+   }
+
+   if (old == new) {
+   VM_OBJECT_WUNLOCK(object);
+   return;
+   }
+
+   if (new == 0) {
+   vm_object_clear_flag(object, OBJ_TMPFS_VREF);
+   VM_OBJECT_WUNLOCK(object);
+   vrele(vp);
+   } else {
+   if ((object->flags & OBJ_TMPFS_VREF) == 0) {
+   vref(vp);
+   vlazy(vp);
+   vm_object_set_flag(object, OBJ_TMPFS_VREF);
+   }
+   VM_OBJECT_WUNLOCK(object);
+   }
+}
+
+static void
+tmpfs_pager_update_writecount(vm_object_t object, vm_offset_t start,
+vm_offset_t end)
+{
+   vm_offset_t new, old;
+
+   VM_OBJECT_WLOCK(object);
+   KASSERT((object->flags & OBJ_ANON) == 0,
+   ("%s: object %p with OBJ_ANON", __func__, object));
+   old = object->un_pager.swp.writemappings;
+   object->un_pager.swp.writemappings += (vm_ooffset_t)end - start;
+   new = object->un_pager.swp.writemappings;
+   tmpfs_pager_writecount_recalc(object, old, new);
+   VM_OBJECT_ASSERT_UNLOCKED(object);
+}
+
+static void
+tmpfs_pager_release_writecount(vm_object_t object, vm_offset_t start,
+vm_offset_t end)
+{
+   vm_offset_t new, old;
+
+   VM_OBJECT_WLOCK(object);
+   KASSERT((object->flags & OBJ_ANON) == 0,
+   ("%s: object %p with OBJ_ANON", __func__, object));
+   old = object->un_pager.swp.writemappings;
+   object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start;
+   new = object->un_pager.swp.writemappings;
+   tmpfs_pager_writecount_recalc(object, old, new);
+   VM_OBJECT_ASSERT_UNLOCKED(object);
+}
+
 static void
 tmpfs_pager_getvp(vm_object_t object, struct vnode **vpp, bool *vp_heldp)
 {
@@ -131,6 +217,8 @@ struct pagerops tmpfs_pager_ops = {
.pgo_kvme_type = KVME_TYPE_VNODE,
.pgo_alloc = tmpfs_pager_alloc,
.pgo_set_writeable_dirty = vm_object_set_writeable_dirty_,
+   .pgo_update_writecount = tmpfs_pager_update_writecount,
+   .pgo_release_writecount = tmpfs_pager_release_writecount,
.pgo_mightbedirty = vm_object_mightbedirty_,
.pgo_getvp = tmpfs_pager_getvp,
 };
@@ -643,6 +731,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct 
tmpfs_dirent *de)
 void
 tmpfs_destroy_vobject(struct vnode *vp, vm_object_t obj)
 {
+   bool want_vrele;
 
ASSERT_VOP_ELOCKED

git: 128e25842ef5 - main - vm: add another pager private flag

2021-05-15 Thread Mateusz Guzik
The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=128e25842ef510b39815d784e1d2af0d4afd584f

commit 128e25842ef510b39815d784e1d2af0d4afd584f
Author: Mateusz Guzik 
AuthorDate: 2021-05-14 07:50:10 +
Commit: Mateusz Guzik 
CommitDate: 2021-05-15 20:47:29 +

vm: add another pager private flag

Move OBJ_SHADOWLIST around to let pager flags be next to each other.

Reviewed by:kib, markj
Differential Revision:  https://reviews.freebsd.org/D30258
---
 sys/fs/tmpfs/tmpfs.h | 2 +-
 sys/vm/vm_object.h   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h
index 549339d9b6d1..bb777e29e3d0 100644
--- a/sys/fs/tmpfs/tmpfs.h
+++ b/sys/fs/tmpfs/tmpfs.h
@@ -45,7 +45,7 @@
 MALLOC_DECLARE(M_TMPFSNAME);
 #endif
 
-#defineOBJ_TMPFS   OBJ_PAGERPRIV   /* has tmpfs vnode allocated */
+#defineOBJ_TMPFS   OBJ_PAGERPRIV1  /* has tmpfs vnode allocated */
 
 /*
  * Internal representation of a tmpfs directory entry.
diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h
index d159c621d2e6..1bf4cee856c7 100644
--- a/sys/vm/vm_object.h
+++ b/sys/vm/vm_object.h
@@ -201,13 +201,14 @@ struct vm_object {
 #defineOBJ_UMTXDEAD0x0020  /* umtx pshared was terminated 
*/
 #defineOBJ_SIZEVNLOCK  0x0040  /* lock vnode to check obj size 
*/
 #defineOBJ_PG_DTOR 0x0080  /* dont reset object, leave 
that for dtor */
+#defineOBJ_SHADOWLIST  0x0100  /* Object is on the shadow 
list. */
 #defineOBJ_SWAP0x0200  /* object swaps */
 #defineOBJ_SPLIT   0x0400  /* object is being split */
 #defineOBJ_COLLAPSING  0x0800  /* Parent of collapse. */
 #defineOBJ_COLORED 0x1000  /* pg_color is defined */
 #defineOBJ_ONEMAPPING  0x2000  /* One USE (a single, 
non-forked) mapping flag */
-#defineOBJ_SHADOWLIST  0x4000  /* Object is on the shadow 
list. */
-#defineOBJ_PAGERPRIV   0x8000  /* Pager private */
+#defineOBJ_PAGERPRIV1  0x4000  /* Pager private */
+#defineOBJ_PAGERPRIV2  0x8000  /* Pager private */
 
 /*
  * Helpers to perform conversion between vm_object page indexes and offsets.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: e73e2ee0acf5 - main - cxgbei: Handle target transfers with excess unsolicited data.

2021-05-15 Thread Mateusz Guzik
One of these commits breaks tinderbox:
i386 MINIMAL kernel failed, check _.i386.MINIMAL for details
i386 GENERIC kernel failed, check _.i386.GENERIC for details
i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for details
i386 PAE kernel failed, check _.i386.PAE for details
i386 LINT kernel failed, check _.i386.LINT for details
i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details
i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details
i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details

/usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1045:15: error: invalid operands
to binary expression ('void *' and 'int')
start_pva = trunc_page(sgl->addr);
^
./machine/param.h:150:29: note: expanded from macro 'trunc_page'
#define trunc_page(x)   ((x) & ~PAGE_MASK)
 ~~~ ^ ~~
/usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1300:8: error: invalid operands to
binary expression ('void *' and 'int')
pva = trunc_page(sgl->addr);
  ^
./machine/param.h:150:29: note: expanded from macro 'trunc_page'
#define trunc_page(x)   ((x) & ~PAGE_MASK)
 ~~~ ^ ~~


On 5/14/21, John Baldwin  wrote:
> The branch main has been updated by jhb:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab
>
> commit e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab
> Author: John Baldwin 
> AuthorDate: 2021-05-14 19:20:57 +
> Commit: John Baldwin 
> CommitDate: 2021-05-14 19:21:34 +
>
> cxgbei: Handle target transfers with excess unsolicited data.
>
> The CTL frontend might have provided a buffer that is smaller than the
> FirstBurstLength and thus smaller than the amount of unsolicited data
> included in the request PDU.  Treat these transfers as an empty
> transfer.
>
> Reported by:Jithesh Arakkan @ Chelsio
> Sponsored by:   Chelsio Communications
>
> Differential Revision:  https://reviews.freebsd.org/D29940
> ---
>  sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
> b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
> index 7f638c96483a..c4eb4a35ad31 100644
> --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
> +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
> @@ -1064,10 +1064,15 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic,
> union ctl_io *io,
>   /*
>* Note that ICL calls conn_transfer_setup even if the first
>* burst had everything and there's nothing left to transfer.
> +  *
> +  * NB: The CTL frontend might have provided a buffer
> +  * whose length (kern_data_len) is smaller than the
> +  * FirstBurstLength of unsolicited data.  Treat those
> +  * as an empty transfer.
>*/
> - MPASS(ctsio->kern_data_len >= first_burst);
>   xferlen = ctsio->kern_data_len;
> - if (xferlen - first_burst < ci->ddp_threshold) {
> + if (xferlen < first_burst ||
> + xferlen - first_burst < ci->ddp_threshold) {
>  no_ddp:
>   /*
>* No DDP for this transfer.  Allocate a TTT (based on
>


-- 
Mateusz Guzik 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: e73e2ee0acf5 - main - cxgbei: Handle target transfers with excess unsolicited data.

2021-05-15 Thread Jessica Clarke
On 15 May 2021, at 21:56, Mateusz Guzik  wrote:
> 
> One of these commits breaks tinderbox:
> i386 MINIMAL kernel failed, check _.i386.MINIMAL for details
> i386 GENERIC kernel failed, check _.i386.GENERIC for details
> i386 GENERIC-NODEBUG kernel failed, check _.i386.GENERIC-NODEBUG for details
> i386 PAE kernel failed, check _.i386.PAE for details
> i386 LINT kernel failed, check _.i386.LINT for details
> i386 LINT-NOINET kernel failed, check _.i386.LINT-NOINET for details
> i386 LINT-NOINET6 kernel failed, check _.i386.LINT-NOINET6 for details
> i386 LINT-NOIP kernel failed, check _.i386.LINT-NOIP for details
> 
> /usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1045:15: error: invalid operands
> to binary expression ('void *' and 'int')
>start_pva = trunc_page(sgl->addr);
>^
> ./machine/param.h:150:29: note: expanded from macro 'trunc_page'
> #define trunc_page(x)   ((x) & ~PAGE_MASK)
> ~~~ ^ ~~
> /usr/src/sys/dev/cxgbe/tom/t4_ddp.c:1300:8: error: invalid operands to
> binary expression ('void *' and 'int')
>pva = trunc_page(sgl->addr);
>  ^
> ./machine/param.h:150:29: note: expanded from macro 'trunc_page'
> #define trunc_page(x)   ((x) & ~PAGE_MASK)
> ~~~ ^ ~~

It seems amd64, arm64 and riscv cast to unsigned long first, but arm, i386,
mips and powerpc do not. These macros should probably just become MI in
sys/sys/param.h rather than fixing the MD copies to include casts.

Jess

> On 5/14/21, John Baldwin  wrote:
>> The branch main has been updated by jhb:
>> 
>> URL:
>> https://cgit.FreeBSD.org/src/commit/?id=e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab
>> 
>> commit e73e2ee0acf5a0e0f47b9c2bcd73c835c4922fab
>> Author: John Baldwin 
>> AuthorDate: 2021-05-14 19:20:57 +
>> Commit: John Baldwin 
>> CommitDate: 2021-05-14 19:21:34 +
>> 
>>cxgbei: Handle target transfers with excess unsolicited data.
>> 
>>The CTL frontend might have provided a buffer that is smaller than the
>>FirstBurstLength and thus smaller than the amount of unsolicited data
>>included in the request PDU.  Treat these transfers as an empty
>>transfer.
>> 
>>Reported by:Jithesh Arakkan @ Chelsio
>>Sponsored by:   Chelsio Communications
>> 
>>Differential Revision:  https://reviews.freebsd.org/D29940
>> ---
>> sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 9 +++--
>> 1 file changed, 7 insertions(+), 2 deletions(-)
>> 
>> diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
>> b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
>> index 7f638c96483a..c4eb4a35ad31 100644
>> --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
>> +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
>> @@ -1064,10 +1064,15 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic,
>> union ctl_io *io,
>>  /*
>>   * Note that ICL calls conn_transfer_setup even if the first
>>   * burst had everything and there's nothing left to transfer.
>> + *
>> + * NB: The CTL frontend might have provided a buffer
>> + * whose length (kern_data_len) is smaller than the
>> + * FirstBurstLength of unsolicited data.  Treat those
>> + * as an empty transfer.
>>   */
>> -MPASS(ctsio->kern_data_len >= first_burst);
>>  xferlen = ctsio->kern_data_len;
>> -if (xferlen - first_burst < ci->ddp_threshold) {
>> +if (xferlen < first_burst ||
>> +xferlen - first_burst < ci->ddp_threshold) {
>> no_ddp:
>>  /*
>>   * No DDP for this transfer.  Allocate a TTT (based on
>> 
> 
> 
> -- 
> Mateusz Guzik 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Mark Millard via dev-commits-src-main
Konstantin Belousov kostikbel at gmail.com wrote on
Sat May 15 19:42:08 UTC 2021 :

> On Sat, May 15, 2021 at 07:01:07AM +, Lutz Donnerhacke wrote:
> > . . .
> > +static int
> > +IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > +{
> > +   LIBALIAS_LOCK_ASSERT(la);
> > struct alias_link *lnk;
> > struct icmp *ic;
> And this is not in style.  Declarations must precede executable statements,
> even asserts.

Looks like the "may be placed" wording in "man 9 style"
below might need adjustment in the first paragraph
quoted. The beginning of a function is an example of a
block and I got a rather different interpretation of the
wording out of reading the material as it is: I read it
as indicating an optional status for such a placement of
declarations in blocks generally.

QUOTE
 When declaring variables in functions declare them sorted by size, then
 in alphabetical order; multiple ones per line are okay.  If a line
 overflows reuse the type keyword.  Variables may be initialized where
 declared especially when they are constant for the rest of the scope.
 Declarations may be placed before executable lines at the start of any
 block.  Calls to complicated functions should be avoided when
 initializing variables.
. . .
 Do not insert a blank line at the beginning of functions with local
 variables.  Instead, these should have local variable declarations first,
 followed by one blank line, followed by the first statement.
END QUOTE

In the second paragraph quoted, the "should have" possibly
should be "must have". Having read the other wording first,
and misinterpreted, I apparently read too much optionality
into "should have" as well.


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

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


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Konstantin Belousov
On Sat, May 15, 2021 at 10:51:33PM +0200, Lutz Donnerhacke wrote:
> On Sat, May 15, 2021 at 11:14:31PM +0300, Konstantin Belousov wrote:
> > On Sat, May 15, 2021 at 09:58:12PM +0200, Lutz Donnerhacke wrote:
> > > Of course it was a style commit.
> > > 
> > > + /*
> > > +  De-alias incoming echo and timestamp replies.
> > > +  Alias incoming echo and timestamp requests.
> > > +  */
> > >   static int
> > >   IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > >   {
> > > -
> > >   LIBALIAS_LOCK_ASSERT(la);
> > > - /*
> > > -  De-alias incoming echo and timestamp replies.
> > > -  Alias incoming echo and timestamp requests.
> > > -  */
> > >   struct alias_link *lnk;
> >
> > I do not understand what are you trying to say.
> 
> The diff above is a reformatting of the original diff in the commit.
> It does show, what really happend during the edit:
>   - The empty line at the beginnen of the function body was removed
This is optional, empty line at the beginning for the functions without
local declarations was required before, and is allowed right now.

>   - The comment at the beginning of the function body was moved
> before the function definition.
> 
> The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved.
So you changed some style, but left the large violation in place.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Lutz Donnerhacke
On Sun, May 16, 2021 at 12:30:54AM +0300, Konstantin Belousov wrote:
> > The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved.
> So you changed some style, but left the large violation in place.

This cleanup is a preparation to fix various issues in this code.
So yes, the change was intentionally limited to style issues.

Mixing style and functional changes makes it very hard to track down a
broken behavior to a single commit.  This change is huge, it must not break
anything.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Jessica Clarke
On 15 May 2021, at 23:36, Lutz Donnerhacke  wrote:
> 
> On Sun, May 16, 2021 at 12:30:54AM +0300, Konstantin Belousov wrote:
>>> The LIBALIAS_LOCK_ASSERT and the variable declarations were not moved.
>> So you changed some style, but left the large violation in place.
> 
> This cleanup is a preparation to fix various issues in this code.
> So yes, the change was intentionally limited to style issues.
> 
> Mixing style and functional changes makes it very hard to track down a
> broken behavior to a single commit.  This change is huge, it must not break
> anything.

I think you two are talking past each other. kib@’s point is that some of the
changes made in this commit were style *changes* not style *fixes* (i.e. the
code was compliant before, you’ve just changed it from one acceptable
formatting to another), and that there were instances of significant style
violations *not* fixed (e.g. the assertion macro before variable declarations
pointed out). He is not talking about functional violations, only style ones.
However, in your defence, your original commit did not claim to fix *all* style
violations, only "most annoying style errors", though that doesn’t account for
unnecessary churn as seen with the blank lines at the starts of functions.

Jess

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


Re: git: effc8e57fbf0 - main - libalias: Style cleanup

2021-05-15 Thread Lutz Donnerhacke
On Sat, May 15, 2021 at 11:42:06PM +0100, Jessica Clarke wrote:
> I think you two are talking past each other. kib@’s point is that some of the
> changes made in this commit were style *changes* not style *fixes* (i.e. the
> code was compliant before, you’ve just changed it from one acceptable
> formatting to another), and that there were instances of significant style
> violations *not* fixed (e.g. the assertion macro before variable declarations
> pointed out). He is not talking about functional violations, only style ones.
> However, in your defence, your original commit did not claim to fix *all* 
> style
> violations, only "most annoying style errors", though that doesn’t account for
> unnecessary churn as seen with the blank lines at the starts of functions.

You are right. Let's close this discussion.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 3394d4239b85 - main - cam: allocate CCBs from UMA for SCSI and ATA IO

2021-05-15 Thread Shawn Webb
On Sat, May 15, 2021 at 11:05:49AM +, Edward Tomasz Napierala wrote:
> The branch main has been updated by trasz:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=3394d4239b85b5577845d9e6de4e97b18d3dba58
> 
> commit 3394d4239b85b5577845d9e6de4e97b18d3dba58
> Author: Edward Tomasz Napierala 
> AuthorDate: 2021-05-15 10:17:22 +
> Commit: Edward Tomasz Napierala 
> CommitDate: 2021-05-15 11:03:49 +
> 
> cam: allocate CCBs from UMA for SCSI and ATA IO
> 
> This patch makes it possible for CAM to use small CCBs allocated
> from an periph-specific UMA zone instead of the usual, huge ones.
> The end result is that CCBs issued via da(4) take 544B (size of
> ccb_scsiio) instead of the usual 2kB (size of 'union ccb', ~1.5kB,
> rounded up by malloc(9)).  For ATA it's 272B.  We waste less
> memory, we avoid zeroing the unused 1kB, and it should be easier
> to allocate those CCBs in low memory conditions.  It should also
> be possible to use uma_zone_reserve(9) to improve behaviour
> in low memory conditions even further.
> 
> Note that this does not change the size, or the layout, of CCBs
> as such.  CCBs get allocated in various different ways, in particular
> on the stack, and I don't want to redo all that.  Instead, this
> provides an opt-in mechanism for the periph to declare "my start()
> callback is fine with receiving a CCB allocated from this UMA zone".
> In other words, most of the code works exactly as it used to; the
> change only happens to IOs issued by xpt_run_allockq(), which
> is - conveniently - pretty much all that matters for performance.
> 
> The reason for doing it this way is that it's pretty small, localized
> change, and can be implemented gradually and iteratively: take a
> periph, make sure its start() callback only casts the CCBs it takes
> to a particular type of CCB, for example ccb_scsiio, and that it only
> casts CCBs returned by cam_periph_getccb() to that type, then add UMA
> zone for that size, and declare it safe to XPT.
> 
> This is disabled by default.  Set 'kern.cam.ada.enable_uma_ccbs=1'
> and 'kern.cam.da.enable_uma_ccbs=1' tunables to enable it.  Testing
> is welcome; I will flip the default to enable in two weeks from now.
> 
> Reviewed By:imp
> Sponsored by:   NetApp, Inc.
> Sponsored by:   Klara, Inc.
> Differential Revision:  https://reviews.freebsd.org/D28674
> ---
>  sys/cam/ata/ata_da.c| 18 ++
>  sys/cam/ata/ata_xpt.c   |  7 +++
>  sys/cam/cam_ccb.h   | 14 +-
>  sys/cam/cam_periph.h|  3 +++
>  sys/cam/cam_xpt.c   | 32 +---
>  sys/cam/scsi/scsi_da.c  | 18 ++
>  sys/cam/scsi/scsi_xpt.c |  7 +++
>  7 files changed, 95 insertions(+), 4 deletions(-)

Hey Edward,

I suspect this may be the cause of a kernel panic I just had when
booting my Softiron Overdrive 1000 arm64 system:

panic: ata_action: ccb 0x40388828, func_code 0x15 should not be 
allocated from UMA zone

cpuid = 1
time = 1
__HardenedBSD_version = 140 __FreeBSD_version = 1400013
version = FreeBSD 14.0-CURRENT-HBSD #1  
hardened/current/master-n190374-a541810e5fa: Sat May 15 17:05:42 EDT 2021
shawn@arm64-02:/usr/obj/usr/src/arm64.aarch64/sys/HARDENEDBSD
KDB: stack backtrace:
db_trace_self() at db_trace_self
db_trace_self_wrapper() at db_trace_self_wrapper+0x30
vpanic() at vpanic+0x188
panic() at panic+0x44
ata_action() at ata_action+0x340
_ata_announce_periph() at _ata_announce_periph+0x74
ata_announce_periph_sbuf() at ata_announce_periph_sbuf+0x24
xpt_announce_periph_sbuf() at xpt_announce_periph_sbuf+0x1a8
adaregister() at adaregister+0x420
cam_periph_alloc() at cam_periph_alloc+0x528
adaasync() at adaasync+0xa8
xptsetasyncfunc() at xptsetasyncfunc+0x100
xptdevicetraverse() at xptdevicetraverse+0x9c
xpttargettraverse() at xpttargettraverse+0x78
xptbustraverse() at xptbustraverse+0x80
xpt_register_async() at xpt_register_async+0x1fc
adainit() at adainit+0x4c
periphdriver_init() at periphdriver_init+0x54
xpt_finishconfig_task() at xpt_finishconfig_task+0x18
taskqueue_run_locked() at taskqueue_run_locked+0x188
taskqueue_thread_loop() at taskqueue_thread_loop+0x9c
fork_exit() at fork_exit+0x74
fork_trampoline() at fork_trampoline+0x14
KDB: enter: panic
[ thread pid 0 tid 100023 ]
Stopped at  kdb_enter+0x44: undefined   f904411f

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc


signature.asc
Description: PGP signature


git: 2e6b07866f9e - main - libalias: Ensure ASSERT behind varable declarations

2021-05-15 Thread Lutz Donnerhacke
The branch main has been updated by donner:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2e6b07866f9e1520626a1523f6609cc411bdda1c

commit 2e6b07866f9e1520626a1523f6609cc411bdda1c
Author: Lutz Donnerhacke 
AuthorDate: 2021-05-15 22:49:11 +
Commit: Lutz Donnerhacke 
CommitDate: 2021-05-16 00:28:36 +

libalias: Ensure ASSERT behind varable declarations

At some places the ASSERT was inserted before variable declarations are
finished.  This is fixed now.

Reported by:kib
Reviewed by:kib
MFC after:  1 week
Differential Revision: https://reviews.freebsd.org/D30282
---
 sys/netinet/libalias/alias.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c
index cac19ab55d56..0e2756affcb4 100644
--- a/sys/netinet/libalias/alias.c
+++ b/sys/netinet/libalias/alias.c
@@ -290,10 +290,10 @@ static intTcpAliasOut(struct libalias *, struct 
ip *, int, int create);
 static int
 IcmpAliasIn1(struct libalias *la, struct ip *pip)
 {
-   LIBALIAS_LOCK_ASSERT(la);
struct alias_link *lnk;
struct icmp *ic;
 
+   LIBALIAS_LOCK_ASSERT(la);
ic = (struct icmp *)ip_next(pip);
 
/* Get source address from ICMP data field and restore original data */
@@ -334,13 +334,13 @@ IcmpAliasIn1(struct libalias *la, struct ip *pip)
 static int
 IcmpAliasIn2(struct libalias *la, struct ip *pip)
 {
-   LIBALIAS_LOCK_ASSERT(la);
struct ip *ip;
struct icmp *ic, *ic2;
struct udphdr *ud;
struct tcphdr *tc;
struct alias_link *lnk;
 
+   LIBALIAS_LOCK_ASSERT(la);
ic = (struct icmp *)ip_next(pip);
ip = &ic->icmp_ip;
 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 80ba60f64394 - main - kerberos.8: Replace dead link

2021-05-15 Thread Guangyuan Yang
The branch main has been updated by ygy (doc committer):

URL: 
https://cgit.FreeBSD.org/src/commit/?id=80ba60f64394fab3cda10d5921af896ed1c57c5f

commit 80ba60f64394fab3cda10d5921af896ed1c57c5f
Author: Guangyuan Yang 
AuthorDate: 2021-05-16 05:37:09 +
Commit: Guangyuan Yang 
CommitDate: 2021-05-16 05:37:09 +

kerberos.8: Replace dead link

Replace it with a tutorial hosted on kerberos.org and the classic
"dialogue" from Bill Bryant. The change has been reported and
merged upstream (https://github.com/heimdal/heimdal/commit/7f3445f1b7).

MFC after:  3 days
PR: 251854
Reported by:ktulla...@gmail.com
Submitted by:   bjk (upstream github)
Reviewed by:bcr
---
 crypto/heimdal/lib/krb5/kerberos.8 | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/crypto/heimdal/lib/krb5/kerberos.8 
b/crypto/heimdal/lib/krb5/kerberos.8
index 94d49955180b..a4161eea5953 100644
--- a/crypto/heimdal/lib/krb5/kerberos.8
+++ b/crypto/heimdal/lib/krb5/kerberos.8
@@ -31,7 +31,7 @@
 .\"
 .\" $Id$
 .\"
-.Dd September 1, 2000
+.Dd May 15, 2021
 .Dt KERBEROS 8
 .Os HEIMDAL
 .Sh NAME
@@ -71,9 +71,12 @@ or
 .Ic ftp ,
 without giving your password.
 .Pp
-For more information on how Kerberos works, and other general Kerberos
-questions see the Kerberos FAQ at
-.Pa http://www.nrl.navy.mil/CCS/people/kenh/kerberos-faq.html .
+For more information on how Kerberos works, see the tutorial at
+.Lk https://kerberos.org/software/tutorial.html
+or the informal
+.Dq dialogue
+at
+.Lk https://web.mit.edu/kerberos/dialogue.html .
 .Pp
 For setup instructions see the Heimdal Texinfo manual.
 .Sh SEE ALSO
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"