2023-05-12 01:18:25

by Angus Chen

[permalink] [raw]
Subject: [PATCH v2] net: Remove low_thresh in ip defrag

As low_thresh has no work in fragment reassembles,del it.
And Mark it deprecated in sysctl Document.

Signed-off-by: Angus Chen <[email protected]>
---

v2:
Fix some spelling errors,and remove low_thresh from struct fqdir.
suggested by Jakub Kicinski <[email protected]>.

Documentation/networking/nf_conntrack-sysctl.rst | 1 +
include/net/inet_frag.h | 1 -
net/ieee802154/6lowpan/reassembly.c | 9 ++++-----
net/ipv4/ip_fragment.c | 13 +++++--------
net/ipv6/netfilter/nf_conntrack_reasm.c | 9 ++++-----
net/ipv6/reassembly.c | 9 ++++-----
6 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/Documentation/networking/nf_conntrack-sysctl.rst b/Documentation/networking/nf_conntrack-sysctl.rst
index 8b1045c3b59e..9ca356bc7217 100644
--- a/Documentation/networking/nf_conntrack-sysctl.rst
+++ b/Documentation/networking/nf_conntrack-sysctl.rst
@@ -55,6 +55,7 @@ nf_conntrack_frag6_high_thresh - INTEGER
nf_conntrack_frag6_low_thresh is reached.

nf_conntrack_frag6_low_thresh - INTEGER
+ (Obsolete since linux-4.17)
default 196608

See nf_conntrack_frag6_low_thresh
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index b23ddec3cd5c..79f88ecb6467 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -13,7 +13,6 @@
struct fqdir {
/* sysctls */
long high_thresh;
- long low_thresh;
int timeout;
int max_dist;
struct inet_frags *f;
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
index a91283d1e5bf..3ba4c0f27af9 100644
--- a/net/ieee802154/6lowpan/reassembly.c
+++ b/net/ieee802154/6lowpan/reassembly.c
@@ -318,7 +318,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
}

#ifdef CONFIG_SYSCTL
-
+static unsigned long lowpanfrag_low_thresh_unuesd = IPV6_FRAG_LOW_THRESH;
static struct ctl_table lowpan_frags_ns_ctl_table[] = {
{
.procname = "6lowpanfrag_high_thresh",
@@ -374,9 +374,9 @@ static int __net_init lowpan_frags_ns_sysctl_register(struct net *net)
}

table[0].data = &ieee802154_lowpan->fqdir->high_thresh;
- table[0].extra1 = &ieee802154_lowpan->fqdir->low_thresh;
- table[1].data = &ieee802154_lowpan->fqdir->low_thresh;
- table[1].extra2 = &ieee802154_lowpan->fqdir->high_thresh;
+ table[0].extra1 = &lowpanfrag_low_thresh_unuesd;
+ table[1].data = &lowpanfrag_low_thresh_unuesd;
+ table[1].extra2 = &ieee802154_lowpan->fqdir->high_thresh;
table[2].data = &ieee802154_lowpan->fqdir->timeout;

hdr = register_net_sysctl(net, "net/ieee802154/6lowpan", table);
@@ -451,7 +451,6 @@ static int __net_init lowpan_frags_init_net(struct net *net)
return res;

ieee802154_lowpan->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
- ieee802154_lowpan->fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
ieee802154_lowpan->fqdir->timeout = IPV6_FRAG_TIMEOUT;

res = lowpan_frags_ns_sysctl_register(net);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 69c00ffdcf3e..0db5eb3dec83 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -553,7 +553,7 @@ EXPORT_SYMBOL(ip_check_defrag);

#ifdef CONFIG_SYSCTL
static int dist_min;
-
+static unsigned long ipfrag_low_thresh_unused;
static struct ctl_table ip4_frags_ns_ctl_table[] = {
{
.procname = "ipfrag_high_thresh",
@@ -609,9 +609,9 @@ static int __net_init ip4_frags_ns_ctl_register(struct net *net)

}
table[0].data = &net->ipv4.fqdir->high_thresh;
- table[0].extra1 = &net->ipv4.fqdir->low_thresh;
- table[1].data = &net->ipv4.fqdir->low_thresh;
- table[1].extra2 = &net->ipv4.fqdir->high_thresh;
+ table[0].extra1 = &ipfrag_low_thresh_unused;
+ table[1].data = &ipfrag_low_thresh_unused;
+ table[1].extra2 = &net->ipv4.fqdir->high_thresh;
table[2].data = &net->ipv4.fqdir->timeout;
table[3].data = &net->ipv4.fqdir->max_dist;

@@ -674,12 +674,9 @@ static int __net_init ipv4_frags_init_net(struct net *net)
* A 64K fragment consumes 129736 bytes (44*2944)+200
* (1500 truesize == 2944, sizeof(struct ipq) == 200)
*
- * We will commit 4MB at one time. Should we cross that limit
- * we will prune down to 3MB, making room for approx 8 big 64K
- * fragments 8x128k.
+ * We will commit 4MB at one time. Should we cross that limit.
*/
net->ipv4.fqdir->high_thresh = 4 * 1024 * 1024;
- net->ipv4.fqdir->low_thresh = 3 * 1024 * 1024;
/*
* Important NOTE! Fragment queue must be destroyed before MSL expires.
* RFC791 is wrong proposing to prolongate timer each fragment arrival
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index d13240f13607..dc8a2854e7f3 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -42,7 +42,7 @@ static struct nft_ct_frag6_pernet *nf_frag_pernet(struct net *net)
}

#ifdef CONFIG_SYSCTL
-
+static unsigned long nf_conntrack_frag6_low_thresh_unused = IPV6_FRAG_LOW_THRESH;
static struct ctl_table nf_ct_frag6_sysctl_table[] = {
{
.procname = "nf_conntrack_frag6_timeout",
@@ -82,10 +82,10 @@ static int nf_ct_frag6_sysctl_register(struct net *net)
nf_frag = nf_frag_pernet(net);

table[0].data = &nf_frag->fqdir->timeout;
- table[1].data = &nf_frag->fqdir->low_thresh;
- table[1].extra2 = &nf_frag->fqdir->high_thresh;
+ table[1].data = &nf_conntrack_frag6_low_thresh_unused;
+ table[1].extra2 = &nf_frag->fqdir->high_thresh;
table[2].data = &nf_frag->fqdir->high_thresh;
- table[2].extra1 = &nf_frag->fqdir->low_thresh;
+ table[2].extra1 = &nf_conntrack_frag6_low_thresh_unused;

hdr = register_net_sysctl(net, "net/netfilter", table);
if (hdr == NULL)
@@ -500,7 +500,6 @@ static int nf_ct_net_init(struct net *net)
return res;

nf_frag->fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
- nf_frag->fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
nf_frag->fqdir->timeout = IPV6_FRAG_TIMEOUT;

res = nf_ct_frag6_sysctl_register(net);
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 5bc8a28e67f9..eb8373c25675 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -416,7 +416,7 @@ static const struct inet6_protocol frag_protocol = {
};

#ifdef CONFIG_SYSCTL
-
+static unsigned long ip6_frags_low_thresh_unused = IPV6_FRAG_LOW_THRESH;
static struct ctl_table ip6_frags_ns_ctl_table[] = {
{
.procname = "ip6frag_high_thresh",
@@ -465,9 +465,9 @@ static int __net_init ip6_frags_ns_sysctl_register(struct net *net)

}
table[0].data = &net->ipv6.fqdir->high_thresh;
- table[0].extra1 = &net->ipv6.fqdir->low_thresh;
- table[1].data = &net->ipv6.fqdir->low_thresh;
- table[1].extra2 = &net->ipv6.fqdir->high_thresh;
+ table[0].extra1 = &ip6_frags_low_thresh_unused;
+ table[1].data = &ip6_frags_low_thresh_unused;
+ table[1].extra2 = &net->ipv6.fqdir->high_thresh;
table[2].data = &net->ipv6.fqdir->timeout;

hdr = register_net_sysctl(net, "net/ipv6", table);
@@ -536,7 +536,6 @@ static int __net_init ipv6_frags_init_net(struct net *net)
return res;

net->ipv6.fqdir->high_thresh = IPV6_FRAG_HIGH_THRESH;
- net->ipv6.fqdir->low_thresh = IPV6_FRAG_LOW_THRESH;
net->ipv6.fqdir->timeout = IPV6_FRAG_TIMEOUT;

res = ip6_frags_ns_sysctl_register(net);
--
2.25.1



2023-05-15 08:02:11

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <[email protected]>:

On Fri, 12 May 2023 09:01:52 +0800 you wrote:
> As low_thresh has no work in fragment reassembles,del it.
> And Mark it deprecated in sysctl Document.
>
> Signed-off-by: Angus Chen <[email protected]>
> ---
>
> v2:
> Fix some spelling errors,and remove low_thresh from struct fqdir.
> suggested by Jakub Kicinski <[email protected]>.
>
> [...]

Here is the summary with links:
- [v2] net: Remove low_thresh in ip defrag
https://git.kernel.org/netdev/net-next/c/b2cbac9b9b28

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2023-05-15 11:16:48

by Ido Schimmel

[permalink] [raw]
Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag

On Fri, May 12, 2023 at 09:01:52AM +0800, Angus Chen wrote:
> As low_thresh has no work in fragment reassembles,del it.
> And Mark it deprecated in sysctl Document.
>
> Signed-off-by: Angus Chen <[email protected]>

Getting the following traces with this patch when creating a netns:

[ 10.186564] ------------[ cut here ]------------
[ 10.186596] sysctl net/ipv4/ipfrag_low_thresh: data points to kernel global data: ipfrag_low_thresh_unused
[ 10.186648] WARNING: CPU: 1 PID: 193 at net/sysctl_net.c:155 register_net_sysctl+0xaf/0x150
[ 10.186659] Modules linked in:
[ 10.186667] CPU: 1 PID: 193 Comm: ip Not tainted 6.4.0-rc1-custom-gd1e4632b304c #57
[ 10.186672] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc37 04/01/2014
[ 10.186681] RIP: 0010:register_net_sysctl+0xaf/0x150
[ 10.186691] Code: 00 a3 72 b9 48 81 fd 00 00 20 a3 73 b0 48 c7 c1 0b 7b dc a1 48 8b 13 4c 8b 43 08 4c 89 ee 48 c7 c7 d0 c2 eb a1 e8 41 66 44 ff <0f> 0b 66 81 63 14 6d ff 48 8b 53 40 48 83 c3 40 48 85 d2 75 8b 5b
[ 10.186696] RSP: 0018:ffffaca28031bd98 EFLAGS: 00010282
[ 10.186705] RAX: 0000000000000000 RBX: ffff9daa80846640 RCX: 00000000ffffdfff
[ 10.186711] RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
[ 10.186714] RBP: ffffffffa3162b28 R08: 00000000ffffdfff R09: 00000000ffffdfff
[ 10.186717] R10: ffffffffa2670880 R11: ffffffffa2670880 R12: ffff9daa83100000
[ 10.186720] R13: ffffffffa1e19fc9 R14: ffff9daa80846600 R15: 0000000000000000
[ 10.186728] FS: 00007fe0e810d740(0000) GS:ffff9dabb7c80000(0000) knlGS:0000000000000000
[ 10.186732] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 10.186735] CR2: 000056387c867530 CR3: 000000010318d005 CR4: 0000000000170ee0
[ 10.186739] Call Trace:
[ 10.186766] <TASK>
[ 10.186807] ipv4_frags_init_net+0xe1/0x180
[ 10.186817] ops_init+0x37/0x120
[ 10.186826] setup_net+0x12a/0x290
[ 10.186831] copy_net_ns+0xd8/0x180
[ 10.186836] create_new_namespaces+0x123/0x300
[ 10.186849] unshare_nsproxy_namespaces+0x60/0xa0
[ 10.186857] ksys_unshare+0x181/0x360
[ 10.186869] __x64_sys_unshare+0x12/0x20
[ 10.186876] do_syscall_64+0x38/0x80
[ 10.186885] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 10.186897] RIP: 0033:0x7fe0e82f23cb
[ 10.186908] Code: 73 01 c3 48 8b 0d 65 5a 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 10 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 35 5a 0c 00 f7 d8 64 89 01 48
[ 10.186912] RSP: 002b:00007ffe0513ec08 EFLAGS: 00000217 ORIG_RAX: 0000000000000110
[ 10.186918] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fe0e82f23cb
[ 10.186921] RDX: 0000000000000000 RSI: 000056387c863113 RDI: 0000000040000000
[ 10.186924] RBP: 000056387c862c3a R08: 0000000000000000 R09: 0000000000000073
[ 10.186927] R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000000000
[ 10.186930] R13: 00007fe0e810d6b8 R14: 00007ffe05140e10 R15: 000056387c864fe5
[ 10.186934] </TASK>
[ 10.186936] ---[ end trace 0000000000000000 ]---
[ 10.187912] ------------[ cut here ]------------
[ 10.187917] sysctl net/ipv6/ip6frag_low_thresh: data points to kernel global data: ip6_frags_low_thresh_unused
[ 10.187955] WARNING: CPU: 0 PID: 193 at net/sysctl_net.c:155 register_net_sysctl+0xaf/0x150
[ 10.187966] Modules linked in:
[ 10.187970] CPU: 0 PID: 193 Comm: ip Tainted: G W 6.4.0-rc1-custom-gd1e4632b304c #57
[ 10.187980] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc37 04/01/2014
[ 10.187982] RIP: 0010:register_net_sysctl+0xaf/0x150
[ 10.187989] Code: 00 a3 72 b9 48 81 fd 00 00 20 a3 73 b0 48 c7 c1 0b 7b dc a1 48 8b 13 4c 8b 43 08 4c 89 ee 48 c7 c7 d0 c2 eb a1 e8 41 66 44 ff <0f> 0b 66 81 63 14 6d ff 48 8b 53 40 48 83 c3 40 48 85 d2 75 8b 5b
[ 10.187993] RSP: 0018:ffffaca28031bd98 EFLAGS: 00010282
[ 10.187998] RAX: 0000000000000000 RBX: ffff9daa822d8240 RCX: 00000000ffffdfff
[ 10.188002] RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
[ 10.188004] RBP: ffffffffa28ade80 R08: 00000000ffffdfff R09: 00000000ffffdfff
[ 10.188008] R10: ffffffffa2670880 R11: ffffffffa2670880 R12: ffff9daa83100000
[ 10.188010] R13: ffffffffa1e1c4fc R14: ffff9daa822d8200 R15: 0000000000000000
[ 10.188017] FS: 00007fe0e810d740(0000) GS:ffff9dabb7c00000(0000) knlGS:0000000000000000
[ 10.188021] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 10.188024] CR2: 00007f1a0e26ece0 CR3: 000000010318d003 CR4: 0000000000170ef0
[ 10.188027] Call Trace:
[ 10.188031] <TASK>
[ 10.188035] ipv6_frags_init_net+0xbd/0x150
[ 10.188046] ops_init+0x37/0x120
[ 10.188051] setup_net+0x12a/0x290
[ 10.188057] copy_net_ns+0xd8/0x180
[ 10.188062] create_new_namespaces+0x123/0x300
[ 10.188071] unshare_nsproxy_namespaces+0x60/0xa0
[ 10.188078] ksys_unshare+0x181/0x360
[ 10.188087] __x64_sys_unshare+0x12/0x20
[ 10.188094] do_syscall_64+0x38/0x80
[ 10.188100] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[ 10.188108] RIP: 0033:0x7fe0e82f23cb
[ 10.188113] Code: 73 01 c3 48 8b 0d 65 5a 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 10 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 35 5a 0c 00 f7 d8 64 89 01 48
[ 10.188117] RSP: 002b:00007ffe0513ec08 EFLAGS: 00000217 ORIG_RAX: 0000000000000110
[ 10.188122] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fe0e82f23cb
[ 10.188125] RDX: 0000000000000000 RSI: 000056387c863113 RDI: 0000000040000000
[ 10.188128] RBP: 000056387c862c3a R08: 0000000000000000 R09: 0000000000000073
[ 10.188131] R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000000000
[ 10.188133] R13: 00007fe0e810d6b8 R14: 00007ffe05140e10 R15: 000056387c864fe5
[ 10.188138] </TASK>
[ 10.188140] ---[ end trace 0000000000000000 ]---

2023-05-15 12:13:37

by Angus Chen

[permalink] [raw]
Subject: RE: [PATCH v2] net: Remove low_thresh in ip defrag

Hi idosch.

> -----Original Message-----
> From: Ido Schimmel <[email protected]>
> Sent: Monday, May 15, 2023 7:03 PM
> To: Angus Chen <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]
> Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag
>
> On Fri, May 12, 2023 at 09:01:52AM +0800, Angus Chen wrote:
> > As low_thresh has no work in fragment reassembles,del it.
> > And Mark it deprecated in sysctl Document.
> >
> > Signed-off-by: Angus Chen <[email protected]>
>
> Getting the following traces with this patch when creating a netns:
Sorry for test miss because I tested it in card and didn't test it with multi net.
Should I create a pernet struct for it?
It may looks too complicated.
Thank you.
>
> [ 10.186564] ------------[ cut here ]------------
> [ 10.186596] sysctl net/ipv4/ipfrag_low_thresh: data points to kernel global
> data: ipfrag_low_thresh_unused
> [ 10.186648] WARNING: CPU: 1 PID: 193 at net/sysctl_net.c:155
> register_net_sysctl+0xaf/0x150
> [ 10.186659] Modules linked in:
> [ 10.186667] CPU: 1 PID: 193 Comm: ip Not tainted
> 6.4.0-rc1-custom-gd1e4632b304c #57
> [ 10.186672] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
> 1.16.2-1.fc37 04/01/2014
> [ 10.186681] RIP: 0010:register_net_sysctl+0xaf/0x150
> [ 10.186691] Code: 00 a3 72 b9 48 81 fd 00 00 20 a3 73 b0 48 c7 c1 0b 7b dc
> a1 48 8b 13 4c 8b 43 08 4c 89 ee 48 c7 c7 d0 c2 eb a1 e8 41 66 44 ff <0f> 0b 66
> 81 63 14 6d ff 48 8b 53 40 48 83 c3 40 48 85 d2 75 8b 5b
> [ 10.186696] RSP: 0018:ffffaca28031bd98 EFLAGS: 00010282
> [ 10.186705] RAX: 0000000000000000 RBX: ffff9daa80846640 RCX:
> 00000000ffffdfff
> [ 10.186711] RDX: 0000000000000000 RSI: 0000000000000001 RDI:
> 0000000000000001
> [ 10.186714] RBP: ffffffffa3162b28 R08: 00000000ffffdfff R09:
> 00000000ffffdfff
> [ 10.186717] R10: ffffffffa2670880 R11: ffffffffa2670880 R12:
> ffff9daa83100000
> [ 10.186720] R13: ffffffffa1e19fc9 R14: ffff9daa80846600 R15:
> 0000000000000000
> [ 10.186728] FS: 00007fe0e810d740(0000) GS:ffff9dabb7c80000(0000)
> knlGS:0000000000000000
> [ 10.186732] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 10.186735] CR2: 000056387c867530 CR3: 000000010318d005 CR4:
> 0000000000170ee0
> [ 10.186739] Call Trace:
> [ 10.186766] <TASK>
> [ 10.186807] ipv4_frags_init_net+0xe1/0x180
> [ 10.186817] ops_init+0x37/0x120
> [ 10.186826] setup_net+0x12a/0x290
> [ 10.186831] copy_net_ns+0xd8/0x180
> [ 10.186836] create_new_namespaces+0x123/0x300
> [ 10.186849] unshare_nsproxy_namespaces+0x60/0xa0
> [ 10.186857] ksys_unshare+0x181/0x360
> [ 10.186869] __x64_sys_unshare+0x12/0x20
> [ 10.186876] do_syscall_64+0x38/0x80
> [ 10.186885] entry_SYSCALL_64_after_hwframe+0x63/0xcd
> [ 10.186897] RIP: 0033:0x7fe0e82f23cb
> [ 10.186908] Code: 73 01 c3 48 8b 0d 65 5a 0c 00 f7 d8 64 89 01 48 83 c8 ff
> c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 10 01 00 00 0f 05 <48> 3d 01 f0
> ff ff 73 01 c3 48 8b 0d 35 5a 0c 00 f7 d8 64 89 01 48
> [ 10.186912] RSP: 002b:00007ffe0513ec08 EFLAGS: 00000217 ORIG_RAX:
> 0000000000000110
> [ 10.186918] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
> 00007fe0e82f23cb
> [ 10.186921] RDX: 0000000000000000 RSI: 000056387c863113 RDI:
> 0000000040000000
> [ 10.186924] RBP: 000056387c862c3a R08: 0000000000000000 R09:
> 0000000000000073
> [ 10.186927] R10: 0000000000000000 R11: 0000000000000217 R12:
> 0000000000000000
> [ 10.186930] R13: 00007fe0e810d6b8 R14: 00007ffe05140e10 R15:
> 000056387c864fe5
> [ 10.186934] </TASK>
> [ 10.186936] ---[ end trace 0000000000000000 ]---
> [ 10.187912] ------------[ cut here ]------------
> [ 10.187917] sysctl net/ipv6/ip6frag_low_thresh: data points to kernel global
> data: ip6_frags_low_thresh_unused
> [ 10.187955] WARNING: CPU: 0 PID: 193 at net/sysctl_net.c:155
> register_net_sysctl+0xaf/0x150
> [ 10.187966] Modules linked in:
> [ 10.187970] CPU: 0 PID: 193 Comm: ip Tainted: G W
> 6.4.0-rc1-custom-gd1e4632b304c #57
> [ 10.187980] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
> 1.16.2-1.fc37 04/01/2014
> [ 10.187982] RIP: 0010:register_net_sysctl+0xaf/0x150
> [ 10.187989] Code: 00 a3 72 b9 48 81 fd 00 00 20 a3 73 b0 48 c7 c1 0b 7b dc
> a1 48 8b 13 4c 8b 43 08 4c 89 ee 48 c7 c7 d0 c2 eb a1 e8 41 66 44 ff <0f> 0b 66
> 81 63 14 6d ff 48 8b 53 40 48 83 c3 40 48 85 d2 75 8b 5b
> [ 10.187993] RSP: 0018:ffffaca28031bd98 EFLAGS: 00010282
> [ 10.187998] RAX: 0000000000000000 RBX: ffff9daa822d8240 RCX:
> 00000000ffffdfff
> [ 10.188002] RDX: 0000000000000000 RSI: 0000000000000001 RDI:
> 0000000000000001
> [ 10.188004] RBP: ffffffffa28ade80 R08: 00000000ffffdfff R09:
> 00000000ffffdfff
> [ 10.188008] R10: ffffffffa2670880 R11: ffffffffa2670880 R12:
> ffff9daa83100000
> [ 10.188010] R13: ffffffffa1e1c4fc R14: ffff9daa822d8200 R15:
> 0000000000000000
> [ 10.188017] FS: 00007fe0e810d740(0000) GS:ffff9dabb7c00000(0000)
> knlGS:0000000000000000
> [ 10.188021] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 10.188024] CR2: 00007f1a0e26ece0 CR3: 000000010318d003 CR4:
> 0000000000170ef0
> [ 10.188027] Call Trace:
> [ 10.188031] <TASK>
> [ 10.188035] ipv6_frags_init_net+0xbd/0x150
> [ 10.188046] ops_init+0x37/0x120
> [ 10.188051] setup_net+0x12a/0x290
> [ 10.188057] copy_net_ns+0xd8/0x180
> [ 10.188062] create_new_namespaces+0x123/0x300
> [ 10.188071] unshare_nsproxy_namespaces+0x60/0xa0
> [ 10.188078] ksys_unshare+0x181/0x360
> [ 10.188087] __x64_sys_unshare+0x12/0x20
> [ 10.188094] do_syscall_64+0x38/0x80
> [ 10.188100] entry_SYSCALL_64_after_hwframe+0x63/0xcd
> [ 10.188108] RIP: 0033:0x7fe0e82f23cb
> [ 10.188113] Code: 73 01 c3 48 8b 0d 65 5a 0c 00 f7 d8 64 89 01 48 83 c8 ff
> c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 10 01 00 00 0f 05 <48> 3d 01 f0
> ff ff 73 01 c3 48 8b 0d 35 5a 0c 00 f7 d8 64 89 01 48
> [ 10.188117] RSP: 002b:00007ffe0513ec08 EFLAGS: 00000217 ORIG_RAX:
> 0000000000000110
> [ 10.188122] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
> 00007fe0e82f23cb
> [ 10.188125] RDX: 0000000000000000 RSI: 000056387c863113 RDI:
> 0000000040000000
> [ 10.188128] RBP: 000056387c862c3a R08: 0000000000000000 R09:
> 0000000000000073
> [ 10.188131] R10: 0000000000000000 R11: 0000000000000217 R12:
> 0000000000000000
> [ 10.188133] R13: 00007fe0e810d6b8 R14: 00007ffe05140e10 R15:
> 000056387c864fe5
> [ 10.188138] </TASK>
> [ 10.188140] ---[ end trace 0000000000000000 ]---

2023-05-15 13:16:39

by Petr Machata

[permalink] [raw]
Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag


Angus Chen <[email protected]> writes:

> As low_thresh has no work in fragment reassembles,del it.
> And Mark it deprecated in sysctl Document.
>
> Signed-off-by: Angus Chen <[email protected]>

When you spin a fix for the issue that Ido has reported, could you also
smuggle in the following fixlets?

> diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
> index a91283d1e5bf..3ba4c0f27af9 100644
> --- a/net/ieee802154/6lowpan/reassembly.c
> +++ b/net/ieee802154/6lowpan/reassembly.c
> @@ -318,7 +318,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
> }
>
> #ifdef CONFIG_SYSCTL
> -
> +static unsigned long lowpanfrag_low_thresh_unuesd = IPV6_FRAG_LOW_THRESH;

s/unuesd/unused/

> @@ -674,12 +674,9 @@ static int __net_init ipv4_frags_init_net(struct net *net)
> * A 64K fragment consumes 129736 bytes (44*2944)+200
> * (1500 truesize == 2944, sizeof(struct ipq) == 200)
> *
> - * We will commit 4MB at one time. Should we cross that limit
> - * we will prune down to 3MB, making room for approx 8 big 64K
> - * fragments 8x128k.
> + * We will commit 4MB at one time. Should we cross that limit.

"Should we cross that limit" means "when it happens that we cross that
limit". So on its own it conveys no information and can be dropped.

> */
> net->ipv4.fqdir->high_thresh = 4 * 1024 * 1024;
> - net->ipv4.fqdir->low_thresh = 3 * 1024 * 1024;
> /*
> * Important NOTE! Fragment queue must be destroyed before MSL expires.
> * RFC791 is wrong proposing to prolongate timer each fragment arrival

Thanks!

2023-05-16 08:25:45

by Ido Schimmel

[permalink] [raw]
Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag

On Mon, May 15, 2023 at 12:06:45PM +0000, Angus Chen wrote:
> > -----Original Message-----
> > From: Ido Schimmel <[email protected]>
> > Sent: Monday, May 15, 2023 7:03 PM
> > To: Angus Chen <[email protected]>
> > Cc: [email protected]; [email protected]; [email protected];
> > [email protected]; [email protected]; [email protected];
> > [email protected]
> > Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag
> >
> > On Fri, May 12, 2023 at 09:01:52AM +0800, Angus Chen wrote:
> > > As low_thresh has no work in fragment reassembles,del it.
> > > And Mark it deprecated in sysctl Document.
> > >
> > > Signed-off-by: Angus Chen <[email protected]>
> >
> > Getting the following traces with this patch when creating a netns:
> Sorry for test miss because I tested it in card and didn't test it with multi net.
> Should I create a pernet struct for it?
> It may looks too complicated.

Sorry but I don't understand the motivation behind this patch. IIUC, the
sysctl is deprecated and has no use in the kernel, yet it cannot be
removed because user space may rely on it being present. If so, what is
the significance of the code changes in this patch? Why not just update
the documentation?

2023-05-16 08:46:42

by Angus Chen

[permalink] [raw]
Subject: RE: [PATCH v2] net: Remove low_thresh in ip defrag



> -----Original Message-----
> From: Ido Schimmel <[email protected]>
> Sent: Tuesday, May 16, 2023 4:13 PM
> To: Angus Chen <[email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]
> Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag
>
> On Mon, May 15, 2023 at 12:06:45PM +0000, Angus Chen wrote:
> > > -----Original Message-----
> > > From: Ido Schimmel <[email protected]>
> > > Sent: Monday, May 15, 2023 7:03 PM
> > > To: Angus Chen <[email protected]>
> > > Cc: [email protected]; [email protected]; [email protected];
> > > [email protected]; [email protected]; [email protected];
> > > [email protected]
> > > Subject: Re: [PATCH v2] net: Remove low_thresh in ip defrag
> > >
> > > On Fri, May 12, 2023 at 09:01:52AM +0800, Angus Chen wrote:
> > > > As low_thresh has no work in fragment reassembles,del it.
> > > > And Mark it deprecated in sysctl Document.
> > > >
> > > > Signed-off-by: Angus Chen <[email protected]>
> > >
> > > Getting the following traces with this patch when creating a netns:
> > Sorry for test miss because I tested it in card and didn't test it with multi net.
> > Should I create a pernet struct for it?
> > It may looks too complicated.
>
> Sorry but I don't understand the motivation behind this patch. IIUC, the
> sysctl is deprecated and has no use in the kernel, yet it cannot be
> removed because user space may rely on it being present. If so, what is
> the significance of the code changes in this patch? Why not just update
> the documentation?
Thank you .
One tester asked me why low_thresh is not work well in our product,
So I want to send a little patch to mark the code.
I will just modify low_thresh to low_thresh_unused to simplify this cleanup.