Page MenuHomeFreeBSD

zlei (Zhenlei Huang)
User

Projects

User Details

User Since
Apr 1 2021, 3:21 AM (160 w, 8 h)

Recent Activity

Thu, Apr 18

zlei accepted D44797: freebsd-update(8): Use kern.module_path.

Looks good to me.

Thu, Apr 18, 2:36 PM
zlei updated subscribers of D44760: fbt: Fix compiler warnings in CDDL fbt sources..
Thu, Apr 18, 12:08 PM
zlei added inline comments to D44763: pmcstat: Fix compiler warnings when building pcmstat with -Werror.
Thu, Apr 18, 11:17 AM
zlei added inline comments to D44797: freebsd-update(8): Use kern.module_path.
Thu, Apr 18, 9:52 AM
zlei accepted D44817: Support IFCOUNTER_OBYTES and IFCOUNTER_OMCASTS even with VTNET_LEGACY_TX defined .

Looks like driver does "hardware" accounting and software accounting at the same time. That's why we see correct counts without your patches. If vtnet_accum_stats() provides us with all what we need, then the driver should declare IFCAP_HWSTATS in its capabilities. That will turn off software accounting by the network stack. May I ask you to add this and also combine D44816 and D44817 into a single review?

Thu, Apr 18, 9:21 AM
zlei requested changes to D44817: Support IFCOUNTER_OBYTES and IFCOUNTER_OMCASTS even with VTNET_LEGACY_TX defined .
Thu, Apr 18, 7:49 AM

Tue, Apr 16

zlei committed rGd77e45e29f04: ng_socket: Treat EEXIST from kern_kldload() as success (authored by zlei).
ng_socket: Treat EEXIST from kern_kldload() as success
Tue, Apr 16, 4:37 AM
zlei committed rG2e8d60c68540: ng_socket: Treat EEXIST from kern_kldload() as success (authored by zlei).
ng_socket: Treat EEXIST from kern_kldload() as success
Tue, Apr 16, 4:36 AM

Mon, Apr 15

zlei added inline comments to D44518: hvsock: Use zfree(9) instead of non-standard bzero(3).
Mon, Apr 15, 5:38 PM
zlei added a reviewer for D44518: hvsock: Use zfree(9) instead of non-standard bzero(3): whu.
Mon, Apr 15, 5:33 PM
zlei updated subscribers of D44518: hvsock: Use zfree(9) instead of non-standard bzero(3).
Mon, Apr 15, 5:16 PM
zlei added inline comments to D44768: cloudware: purge pkg cache after installation.
Mon, Apr 15, 4:43 PM
zlei added inline comments to D44797: freebsd-update(8): Use kern.module_path.
Mon, Apr 15, 4:31 PM
zlei added inline comments to D44797: freebsd-update(8): Use kern.module_path.
Mon, Apr 15, 2:58 PM
zlei committed rG41e4389a3d0d: debugnet: Fix logging of frame length (authored by zlei).
debugnet: Fix logging of frame length
Mon, Apr 15, 4:04 AM
zlei committed rG65212656f845: ethernet: Fix logging of frame length (authored by zlei).
ethernet: Fix logging of frame length
Mon, Apr 15, 4:04 AM
zlei committed rG800bd7da4c20: debugnet: Fix logging of frame length (authored by zlei).
debugnet: Fix logging of frame length
Mon, Apr 15, 4:03 AM
zlei committed rG4d65728d55a7: ethernet: Fix logging of frame length (authored by zlei).
ethernet: Fix logging of frame length
Mon, Apr 15, 4:03 AM

Fri, Apr 12

zlei committed rGf0edd08b27d7: LinuxKPI: Remove the temporary variable fileid from the macro request_module (authored by zlei).
LinuxKPI: Remove the temporary variable fileid from the macro request_module
Fri, Apr 12, 11:28 AM
zlei committed rGd4d5aed66a3f: LinuxKPI: Remove the temporary variable fileid from the macro request_module (authored by zlei).
LinuxKPI: Remove the temporary variable fileid from the macro request_module
Fri, Apr 12, 11:27 AM

Wed, Apr 10

zlei added a reviewer for D44667: vm_reserv_reclaim_contig: Return NULL not false: dougm.
Wed, Apr 10, 9:11 AM · Contributor Reviews (src)
zlei accepted D44667: vm_reserv_reclaim_contig: Return NULL not false.

Looks good to me.

Wed, Apr 10, 8:57 AM · Contributor Reviews (src)

Tue, Apr 9

zlei added a comment to D44623: vm: add macro to mark arguments used when NUMA is defined.

What about stub functions for !NUMA ?
For example, converting

static inline int
vm_page_domain(vm_page_t m)
{
#ifdef NUMA
	int domn, segind;
Tue, Apr 9, 2:36 PM
zlei committed rGf6f67f58c19d: ng_socket: Treat EEXIST from kern_kldload() as success (authored by zlei).
ng_socket: Treat EEXIST from kern_kldload() as success
Tue, Apr 9, 10:07 AM
zlei closed D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.
Tue, Apr 9, 10:07 AM
zlei committed rGa7b2c455505a: kern linker: Do not touch userrefs of the kernel file (authored by zlei).
kern linker: Do not touch userrefs of the kernel file
Tue, Apr 9, 4:14 AM
zlei committed rGa2f57656620d: kern linker: Do not unload a module if it has dependants (authored by zlei).
kern linker: Do not unload a module if it has dependants
Tue, Apr 9, 4:14 AM
zlei committed rG7da45efb0921: kern linker: Do not touch userrefs of the kernel file (authored by zlei).
kern linker: Do not touch userrefs of the kernel file
Tue, Apr 9, 4:11 AM
zlei committed rGf1994d1eb215: kern linker: Do not unload a module if it has dependants (authored by zlei).
kern linker: Do not unload a module if it has dependants
Tue, Apr 9, 4:11 AM

Mon, Apr 8

zlei updated the diff for D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.

Bite out the translation for errors from kernel linker.

Mon, Apr 8, 5:45 PM
zlei added a comment to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Responding to your comment in D44581 here:

The initial version of EUNSDEP is defined as (ELAST + 1) in sys/kern/kern_linker.c. I have to admit it is more a hack but I did not find a good candidate from 'sys/sys/error.h`.

To proceed, I'm proposing:

  1. Re-use error EXDEV for unsatisfied dependency, thus omit unneeded translations, but it should be documented in kldload(2). This is preferred.
  2. Re-use error EXDEV, but translate it to ENOEXEC. This is less ideal but prevent KPI breakage.
  3. Define EUNSDEP in sys/kern/kern_linker.c, document it is only used internally and should not be leaked (even to other subsystem). Obviously translation to ENOEXEC is needed. Not preferred.

Following my last message in D44581, I would just rule out the first two, and in fact also replace the third with an even more radical option: Just forego EUNSDEP entirely. With the first two options ruled out, the only remaining purpose of this change is its initial one, that is to say, to print error messages allowing to distinguish between loading errors (including required modules' load failures), which is what the new switch(error) block containing the printf's already accomplishes. This code (without EUNSDEP) is enough to output the chain of dependencies in the kernel log. Could you please also split it, with only a single printf mentioning the dependency error remaining (the only important point here is to print both the names of the top-level module to load and that of the dependency that failed), and move the rest to linker_load_module(), for reasons explained in an earlier comment (better reporting for in-kernel loads and top-level modules)?

I think I see what you meant. I'll try that.

As for

with a signature allowing to pass back a text describing the error.

I think that is perfect, but given linker_load_module() can be called recursively, the signature should be designed carefully. IMO a failure from kernel linkers should be rare thus one of the above simpler fixes should be adequate. It is not perfect but user can still get the real reason from dmesg or /var/log/message.

I would just give up on that in that revision, this would be a separate change anyway, way more useful to users than just returning EUNSDEP, but it requires some (hopefully short) design discussion. This way, we also stop delaying the current change, which is useful to users on its own, and that I personally would like to see in, e.g., 14.1-RELEASE.

As propagation error from other subsystem is a common issue. Actually languages such as C++ / Java do that well. Those languages have type exception and exceptions can be wrapped up ( nested exceptions ). I think C can mimic but that is not elegance IMO.
+1 for 14.1-RELEASE .

Mon, Apr 8, 5:31 PM
zlei committed rG6fe4d8395bc5: debugnet: Fix logging of frame length (authored by zlei).
debugnet: Fix logging of frame length
Mon, Apr 8, 4:49 PM
zlei closed D42390: ethernet: Fix logging of frame length.
Mon, Apr 8, 4:46 PM
zlei committed rGe7102929bf4f: ethernet: Fix logging of frame length (authored by zlei).
ethernet: Fix logging of frame length
Mon, Apr 8, 4:46 PM

Sun, Apr 7

zlei accepted D39695: freebsd-update: Add check for kernel modules.

Looks good to me.

Sun, Apr 7, 3:14 PM
zlei added inline comments to D39695: freebsd-update: Add check for kernel modules.
Sun, Apr 7, 3:07 PM
zlei added a comment to D44581: Introduce a new kernel-only errno EUNSDEP for unsatisfied dependency.
In D44581#1017956, @kib wrote:

Adding anything to errno is the wrong direction. If you want to get arbitrary error back from kldload(2), then perhaps kldload2(2) is due, with a signature allowing to pass back a text describing the error.
This would be similar to the interface of rtld itself, where dl*() functions do not try to extend errno but provide dlerror() with the description of the problem.

Sun, Apr 7, 2:38 PM
zlei added a comment to D44581: Introduce a new kernel-only errno EUNSDEP for unsatisfied dependency.
In D44581#1017690, @kib wrote:
In D44581#1017675, @kib wrote:

I do not like it. Errno has the defined scope of providing the communication between kernel and userspace. Some of the 'out of band' values like ERESTART and EJUSTRETURN and valid extensions because they modify the kernel->user edge behavior, all other in the list are hacks.
More, the hack you propose is for very special and local situation, where error can be propagated by other means, if ever needed.

Would you like if it get a positive value and goes under #ifndef _POSIX_SOURCE like other our errnos that are extensions?

This is a no-starter at all. It would increase the sys_errlist[] size which is de-facto ABI break with all the consequeneces.

Sun, Apr 7, 1:48 PM

Fri, Apr 5

zlei committed rG317cc829ee22: LinuxKPI: Remove the temporary variable fileid from the macro request_module (authored by zlei).
LinuxKPI: Remove the temporary variable fileid from the macro request_module
Fri, Apr 5, 4:27 PM
zlei closed D44583: LinuxKPI: Remove an unused local var fileid from the macro request_module.
Fri, Apr 5, 4:27 PM
zlei updated subscribers of D44583: LinuxKPI: Remove an unused local var fileid from the macro request_module.

I spotted this while working on D44581 which intends to introduce new kernel-only error code EUNSDEP and on D44552 which uses it.

As in D44552 kern_kldload() will return the new error. It should not be leaked to the userspace. I was evaluating the impact and @olce pointed out the macro request_module is consuming kern_kldload().

Fri, Apr 5, 3:42 PM
zlei added a comment to D44583: LinuxKPI: Remove an unused local var fileid from the macro request_module.
In D44583#1017691, @bz wrote:

I don't know if the code path in drm_encoder_slave.c actually uses this

I don't think the change in this review should have any effect - we just go from discarding the returned fileid to not requesting it at all.

Yes, I understand; hence accepted. I was just curious how (and why) this got spotted given it's been sitting there like this for a decade. If there are (public) consumers I missed it would be good to know as I am still curious as to why it can hang a system (and if it does why has no one noticed it in the past; e.g. what the invariants are).

Fri, Apr 5, 3:29 PM

Thu, Apr 4

zlei added a comment to D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.

Reducing multiple error codes to one is losing information and it is confusing regardless of how experienced a user is. Even in case of the least experienced user, they would file a problem report or ask on mailing lists, forums, or whatever, they will come asking for help with reduced information. First thing to help such a user would be to write a dtrace script or ask him to patch kernel with printfs to get the actual error.

Thu, Apr 4, 5:47 PM
zlei added reviewers for D44581: Introduce a new kernel-only errno EUNSDEP for unsatisfied dependency: jhb, kib, markj.
Thu, Apr 4, 5:26 PM
zlei added a comment to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Rechecked this, CURRENT and stable/14 vfs_byname_kld() has translated error to ENODEV. As for stable/13 it will be leaked.

Ah, I had forgotten the added translation to ENODEV in vfs_byname_kld(), but not in stable/13 indeed.

I would conclude, an error in domain A has the context, so when it goes cross to another domain B the context get lost, then probably it should be translated (to a proper error for domain B).

That seems a good principle in general but then there's the question of where the "crossing" happens. kern_*() interfaces were initially meant to be called from syscall glue code (adaptation for alternate syscall tables, e.g., 32-bit on 64-bit or Linux), which in particular performs copyin/copyout, and my current view is that they can also be used to make some subsystem functionality available to other subsystem with a kind of relatively formal interface. So, kern_*() functions should control relatively strictly their return codes and not, e.g., let new ones leak to callers, which also implies new return codes should land in the appropriate manual pages. In other words, this means that kern_*() and sys_*() should generally be treated the same, unless you have good reasons, and return the same codes (barring additional ones the syscall glue code can return). And, concerning the "crossing" part, if kern_*() is considered a kind of public interface to the rest of the kernel, crossing happens in fact in there and must be handled by it, and not the caller. Now, it is true that KPI restrictions are less stringent than syscall API restrictions, which I'd guess could be a common "reason" for divergence between sys_*() and kern_*().

Thu, Apr 4, 5:23 PM
zlei added a comment to D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.

Why do we really want to lose a meaningful error code and reduce all errors into one value? IMHO, it is counterproductive. And if we got a new error code type, why can't we propagate it to userland, too?

Thu, Apr 4, 3:35 PM
zlei added a comment to D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.

@olce
As a side effect, the error from kern_kldload() is lost, so I think you are right , we should emit logs from kernel about the error, to help diagnosing.

Thu, Apr 4, 1:33 AM
zlei updated the test plan for D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.
Thu, Apr 4, 1:26 AM
zlei requested review of D44633: ng_socket: Treat EEXIST from kern_kldload() as success in case there is a race condition.
Thu, Apr 4, 1:25 AM

Wed, Apr 3

zlei committed rG223077d0a847: kern linker: Make linker_file_add_dependency() void (authored by zlei).
kern linker: Make linker_file_add_dependency() void
Wed, Apr 3, 6:39 AM
zlei committed rG41d9d301fbd0: kern linker: Make linker_file_add_dependency() void (authored by zlei).
kern linker: Make linker_file_add_dependency() void
Wed, Apr 3, 6:25 AM
zlei added a comment to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Move translating errno EUNSDEP from kern_kldload() to sys_kldload()

I really think doing this in this review is ill-advised. And as is stands, the current change has impacts so should be amended.

Sorry for that.

After carefully checking, I can conclude it is safe to move the translation to sys_kldload(), as consumers of kern_kldload() either have done the translation themself, or totally ignore the return value, e.g. request_module in sys/compat/linuxkpi/common/include/linux/kmod.h, [1] and [2]. For the latter the current change will not make it worse.

I agree with the second part (some ignore the return value, so don't really care), but not with the first. Unless I'm mistaken, there are almost direct return paths to userland in these two cases:

  • vfs_byname_kld()

Rechecked this, CURRENT and stable/14 vfs_byname_kld() has translated error to ENODEV. As for stable/13 it will be leaked.

  • ngc_send()

ngcontrol_protosw.pr_send == ngc_send so EUNSDEP will be leaked. Really sorry I did not read the code carefully.

so EUNSDEP is going to be leaked.

Could you revert that modification? In other words, kern_kldload() still should translate the error itself, for now.

Wed, Apr 3, 4:57 AM
zlei added a comment to D44594: kern linker: Do not invoke event handlers for partially linked file.

Another option could be refactor linker_file_unload() into two functions. One for normal unload and another is for abnormal ones such as unloading partially linked file.
Almost all abnormal unload requires the flag LINKER_UNLOAD_FORCE and at that moment the reference count of file should be right one. The logic will be much clear.

Wed, Apr 3, 2:59 AM

Tue, Apr 2

zlei requested review of D44595: kern linker: Invoke kld_unload event handlers in reverse order.
Tue, Apr 2, 3:09 PM
zlei added a comment to D44594: kern linker: Do not invoke event handlers for partially linked file.

The only in-tree consumers of kld_unload_try and kld_unload even handlers are sdt and dtrace. Hopefully these even handlers are not abused by out-tree consumers.

Tue, Apr 2, 2:31 PM
zlei updated the summary of D44594: kern linker: Do not invoke event handlers for partially linked file.
Tue, Apr 2, 2:28 PM
zlei requested review of D44594: kern linker: Do not invoke event handlers for partially linked file.
Tue, Apr 2, 2:25 PM
zlei added inline comments to D39695: freebsd-update: Add check for kernel modules.
Tue, Apr 2, 3:37 AM
zlei added inline comments to D39695: freebsd-update: Add check for kernel modules.
Tue, Apr 2, 3:04 AM

Mon, Apr 1

zlei requested review of D44583: LinuxKPI: Remove an unused local var fileid from the macro request_module.
Mon, Apr 1, 4:38 PM
zlei added inline comments to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Mon, Apr 1, 4:15 PM
zlei updated the diff for D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Address @imp 's comments.

Mon, Apr 1, 3:56 PM
zlei added inline comments to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Mon, Apr 1, 3:37 PM
zlei updated the diff for D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Move translating errno EUNSDEP from kern_kldload() to sys_kldload()

Mon, Apr 1, 3:32 PM
zlei updated the diff for D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Stop translating errno from linker_reference_module() .

Mon, Apr 1, 2:43 PM
zlei added inline comments to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Mon, Apr 1, 2:38 PM
zlei updated the diff for D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Moved the errno into sys/sys/errno.h, see D44581 .

Mon, Apr 1, 2:27 PM
zlei added a comment to D44581: Introduce a new kernel-only errno EUNSDEP for unsatisfied dependency.

Hi @imp , does this need broader attention ?

Mon, Apr 1, 2:20 PM
zlei requested review of D44581: Introduce a new kernel-only errno EUNSDEP for unsatisfied dependency.
Mon, Apr 1, 2:20 PM

Sun, Mar 31

zlei accepted D44559: linker: Don't invoke dtors without having invoked ctors.

Looks good to me.

Sun, Mar 31, 4:11 PM
zlei committed rGf3b21c553681: acpi_hpet: Make use of enum for vm_guest to improve readability (authored by zlei).
acpi_hpet: Make use of enum for vm_guest to improve readability
Sun, Mar 31, 3:56 PM
zlei committed rGddd779a062c1: acpi_hpet: Make use of enum for vm_guest to improve readability (authored by zlei).
acpi_hpet: Make use of enum for vm_guest to improve readability
Sun, Mar 31, 3:56 PM

Fri, Mar 29

zlei added inline comments to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Fri, Mar 29, 4:20 PM
zlei added inline comments to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Fri, Mar 29, 4:13 PM
zlei added a comment to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.

Made a reverse call graph to help evaluating the impact of this change:

linker_load_dependencies() --> linker_load_module()
	LINKER_LOAD_FILE()
		linker_load_file()
			linker_load_module()
				linker_reference_module()
					loadimage()
						TASK_INIT(&fwload_task, 0, loadimage, (void *)&fwli)
				kern_kldload() # syscall from userland
Fri, Mar 29, 3:36 PM
zlei added inline comments to D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Fri, Mar 29, 3:58 AM
zlei requested review of D44552: kern linker: Use EUNSDEP for unsatisfied dependencies.
Fri, Mar 29, 3:50 AM

Wed, Mar 27

zlei committed rG1c7307cf6763: kern linker: Make linker_file_add_dependency() void (authored by zlei).
kern linker: Make linker_file_add_dependency() void
Wed, Mar 27, 4:04 AM
zlei closed D44507: kern linker: Make linker_file_add_dependency() void.
Wed, Mar 27, 4:04 AM

Mar 26 2024

zlei updated the summary of D44507: kern linker: Make linker_file_add_dependency() void.
Mar 26 2024, 10:25 AM
zlei requested review of D44507: kern linker: Make linker_file_add_dependency() void.
Mar 26 2024, 10:20 AM
zlei added inline comments to D44506: kldunload.2 Document another case for the error EBUSY.
Mar 26 2024, 9:18 AM
zlei requested review of D44506: kldunload.2 Document another case for the error EBUSY.
Mar 26 2024, 9:16 AM
zlei committed rG39450eba8e6c: kern linker: Do not touch userrefs of the kernel file (authored by zlei).
kern linker: Do not touch userrefs of the kernel file
Mar 26 2024, 8:48 AM
zlei closed D42530: kern linker: Do not try to unload kernel.
Mar 26 2024, 8:48 AM
zlei committed rGf43ff3e15c8b: kern linker: Do not unload a module if it has dependants (authored by zlei).
kern linker: Do not unload a module if it has dependants
Mar 26 2024, 3:57 AM
zlei closed D42527: kern linker: Do not try to unload module if it has dependants.
Mar 26 2024, 3:57 AM

Mar 24 2024

zlei closed D44402: acpi_hpet: Make use of enum for vm_guest to improve readability.
Mar 24 2024, 3:33 PM
zlei committed rG579cb41b132f: acpi_hpet: Make use of enum for vm_guest to improve readability (authored by zlei).
acpi_hpet: Make use of enum for vm_guest to improve readability
Mar 24 2024, 3:33 PM
zlei accepted D44482: icmp6: bring rate limiting on a par with IPv4.

Looks good to me.

Mar 24 2024, 3:17 PM
zlei accepted D44480: icmp6: rate limit our echo replies.

Generally looks good to me.

Mar 24 2024, 3:00 PM
zlei added inline comments to D44479: icmp6: make icmp6_ratelimit() responsible to update the stats counter.
Mar 24 2024, 2:48 PM
zlei accepted D44478: icmp: improve ICMP limit jitter.

Looks good to me.

Mar 24 2024, 2:34 PM
zlei accepted D44477: icmp: when logging ICMP ratelimiting message use correct jitter value.

Looks good to me.

Mar 24 2024, 2:12 AM
zlei accepted D44476: icmp: hide icmp_bandlimit_uninit() under VIMAGE.

Looks good to me.

Mar 24 2024, 2:00 AM

Mar 23 2024

zlei accepted D44475: icmp: do not store per-VNET identical array of strings.

Looks good to me.

Mar 23 2024, 1:55 AM

Mar 18 2024

zlei requested review of D44402: acpi_hpet: Make use of enum for vm_guest to improve readability.
Mar 18 2024, 9:26 AM

Mar 17 2024

zlei committed rG4319ccae876a: Add myself (zlei) to the calendar (authored by zlei).
Add myself (zlei) to the calendar
Mar 17 2024, 3:23 PM

Mar 14 2024

zlei committed rG9a2b4665958e: route: introduce add interface route test cases (authored by rcm).
route: introduce add interface route test cases
Mar 14 2024, 9:55 AM
zlei committed rGb2cb054dac62: netlink: Add tests when adding an interface route (authored by jlduran_gmail.com).
netlink: Add tests when adding an interface route
Mar 14 2024, 8:30 AM