Summary: | rctl -a user:test:readiops:throttle=0/user crash the system | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Christos Chatzaras <chris> | ||||||
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | jah | ||||||
Priority: | --- | ||||||||
Version: | 12.2-RELEASE | ||||||||
Hardware: | amd64 | ||||||||
OS: | Any | ||||||||
Attachments: |
|
Description
Christos Chatzaras
2020-12-13 12:52:02 UTC
Created attachment 220704 [details]
treat throttle=0 rules as deny=0 rules
Looks like rctl_enforce() is blowing up when it tries to scale the throttle timeout according to the specified limit, which in this case produces division by zero. In general, it doesn't seem like attempting to throttle resource usage to 0 makes sense; it seems like this should instead be treated as a request to deny the resource and checked as such. Can you try the attached patch? Created attachment 220739 [details]
treat throttle=0 rules as throttle_max
On second thought, it might make more sense to treat throttle=0 as "suspend forward progress as long as possible", in other words kern.racct.rctl.throttle_max.
I will try the patch and I will inform you soon. Sorry for the delay. I test it today and everything is ok. After commit to head are you going to MFC it to 12-STABLE? A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e8a5a1ad7154dc34e3a5234267e19faa86d5ff33 commit e8a5a1ad7154dc34e3a5234267e19faa86d5ff33 Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2020-12-30 23:29:44 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-01-11 23:36:57 +0000 rctl(4): support throttling resource usage to 0 For rate-based resources that support throttling (e.g. readiops/writeips), this fixes a divide-by-zero panic when rctl(8) passes 0 as the throttle value. For these resources, treat zero-throttle requests as requests to suspend forward progress as long as possible using the duration specified in kern.racct.rctl.throttle_max. PR: 251803 Reported by: chris@cretaforce.gr Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27858 sys/kern/kern_rctl.c | 5 +++++ 1 file changed, 5 insertions(+) A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=70cdab054c8ffe7f5561ab8f31db33ee62d12c9c commit 70cdab054c8ffe7f5561ab8f31db33ee62d12c9c Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2020-12-30 23:29:44 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-01-26 03:57:44 +0000 rctl(4): support throttling resource usage to 0 For rate-based resources that support throttling (e.g. readiops/writeips), this fixes a divide-by-zero panic when rctl(8) passes 0 as the throttle value. For these resources, treat zero-throttle requests as requests to suspend forward progress as long as possible using the duration specified in kern.racct.rctl.throttle_max. PR: 251803 Reported by: chris@cretaforce.gr (cherry picked from commit e8a5a1ad7154dc34e3a5234267e19faa86d5ff33) sys/kern/kern_rctl.c | 5 +++++ 1 file changed, 5 insertions(+) |