Page MenuHomeFreeBSD

kib (Konstantin Belousov)
User

Projects

User Details

User Since
May 16 2014, 7:35 PM (618 w, 6 d)

Recent Activity

Today

kib updated the diff for D56055: rtld: properly handle update of several vars in rtld_set_var().

Add test from PR 294054

Thu, Mar 26, 2:48 AM

Yesterday

kib updated the diff for D56055: rtld: properly handle update of several vars in rtld_set_var().

Update the commit message with the list of vars allowed in the commit.
Provide the whole list of changeable vars in rtld_get_var(3).

Wed, Mar 25, 10:40 PM
kib accepted D56076: diff: prefer posix_spawn over pdfork/execl.
Wed, Mar 25, 10:21 PM
kib added a comment to D56085: kern_mib: remove kern.fallback_elf_brand compat sysctl.

Does the extern declaration for __elfN(fallback_brand) in sys/sys/imgact_elf.h is needed after the patch? Could the __elfN(fallback_brand) var made static in kern_elf.c?

Wed, Mar 25, 10:12 PM
kib accepted D56075: diff3: prefer posix_spawn over pdfork/execlp.

Unrelated note: it seems that pipe fds leak to both pd13 and pd23 processes. This is perhaps not too important but just not accurate. And since we care about 'security' by entering cap mode, ability of the children to affect input of siblings or parent might be considered undesirable.

Wed, Mar 25, 9:57 PM
kib updated the diff for D56055: rtld: properly handle update of several vars in rtld_set_var().

Note that dangerous_ld_env is never reset back to false.

Wed, Mar 25, 4:50 AM
kib updated the diff for D56055: rtld: properly handle update of several vars in rtld_set_var().

More uses for rtld_recalc_bind_not().

Wed, Mar 25, 4:15 AM
kib added inline comments to D56055: rtld: properly handle update of several vars in rtld_set_var().
Wed, Mar 25, 4:15 AM
kib updated the diff for D56055: rtld: properly handle update of several vars in rtld_set_var().

Handle recalculations second-order effects.

Wed, Mar 25, 3:52 AM
kib added inline comments to D56055: rtld: properly handle update of several vars in rtld_set_var().
Wed, Mar 25, 3:51 AM
kib added inline comments to D56055: rtld: properly handle update of several vars in rtld_set_var().
Wed, Mar 25, 3:48 AM
kib updated the diff for D56055: rtld: properly handle update of several vars in rtld_set_var().

Do call on_update()

Wed, Mar 25, 3:03 AM
kib added a comment to D55912: net: Add page/bank fields to ifi2cre; update mce(4) to use them.

I mean something like this (ignore naming), in the generic ioctl handler, not in the driver code;

case SIOCGI2C_OLD:
     i2c.page = i2c.bank = 0;
     ioctl(SIOCG2C, &i2c);
     break;

I.e. drivers only need to implement the new ioctl that knows about bank/page.

Wed, Mar 25, 12:03 AM

Tue, Mar 24

kib added a comment to D56022: libc: Remove redundant code in thread atexit code.
In D56022#1281980, @kib wrote:

No. Perhaps it is simpler to show code than to try to explain it, See D56053.

The example you provided would not work with my patch, it requires increasing the CXA_DTORS_ITERATIONS. Not sure if we want this.

If it breaks the valid C++ code, we should rethink about it. The T value can be somehow greater than CXA_DTORS_ITERATIONS if the user wants.

Tue, Mar 24, 11:57 PM
kib added reviewers for D56055: rtld: properly handle update of several vars in rtld_set_var(): markj, emaste, dim.
Tue, Mar 24, 11:14 PM
kib requested review of D56055: rtld: properly handle update of several vars in rtld_set_var().
Tue, Mar 24, 1:51 AM

Mon, Mar 23

kib added a comment to D56022: libc: Remove redundant code in thread atexit code.

No. Perhaps it is simpler to show code than to try to explain it, See D56053.

Mon, Mar 23, 6:54 PM
kib requested review of D56053: cxa_thread_call_dtors(): restore limit on the number of destructors called.
Mon, Mar 23, 6:53 PM
kib updated the diff for D55829: amd64: FRED support.

Move fred check into setidt().

Mon, Mar 23, 6:31 PM
kib added inline comments to D55829: amd64: FRED support.
Mon, Mar 23, 6:30 PM
kib added a comment to D56005: x86 xen: provide the prototype for xen_arch_intr_handle_upcall() in xen/arch-intr.h.

It might be easier if I just switch Xen to use lapic_ipi_alloc() like mentioned in the other review. That would prevent more Xen stuff leaking into generic headers which is not specially nice.

Mon, Mar 23, 6:23 PM
kib accepted D55536: vm_fault: Avoid creating clean, writeable superpage mappings.
Mon, Mar 23, 4:43 PM
kib added a comment to D55975: fenv.h: stop declaring feclearexcept() extern inline.

Do we need to handle the rest of the fenv functions same, they all are extern inline. Then we can remove the requirement to have gcc semantic for inline as a bonus.

Mon, Mar 23, 3:15 AM
kib added a comment to D55915: pciconf: Add option to write into a BAR region.
In D55915#1281289, @kib wrote:
In D55915#1280245, @kib wrote:

You only write a single value into the specified offset, right?
This should be clearly explained in the man page addition.
Or consider adding a possibility of writing the series of values starting at the given offset, of the specified width for each value (IMO it is fine as is, but needs to be properly documented).

In my use case, I only had to write a single value. Do you know use cases where a series of values needs to be written to a BAR region?

I tried to make it similar to -w (write to config space). This is the man page part about -w:

The -w option writes the value into a configuration space register at byte offset addr of device selector.

Do you find this more clear?

Yes

OK. This is the synopsis:

pciconf -Bw [-b | -h | -x] device bar offset value

and this is the current text:

The -Bw option writes to the BAR specified by its offset in config space bar. The value is written at byte offset offset in the BAR region.

How about this?

The -Bw option writes the value into a BAR region of a PCI device at the given byte offset. It uses the BAR specified by its offset in the config space bar of the PCI device specified by the selector device.
Mon, Mar 23, 3:14 AM
kib added inline comments to D55536: vm_fault: Avoid creating clean, writeable superpage mappings.
Mon, Mar 23, 3:06 AM
kib committed rGf0d5f46a1e42: mlx5: postpone freeing the completed command entity to taskqueue (authored by kib).
mlx5: postpone freeing the completed command entity to taskqueue
Mon, Mar 23, 12:24 AM

Sun, Mar 22

kib accepted D56022: libc: Remove redundant code in thread atexit code.

I am on edge of proposing to count the number of the list members, and still do the walk_cb_nocall if the number of members does not go to zero after e.g. CXA_DTORS_ITERATIONS times initial list length for dtor removals.

Sun, Mar 22, 9:22 PM
kib added inline comments to D18768: Describe FreeBSD's virtual memory in memory(7).
Sun, Mar 22, 8:58 PM
kib added a comment to D55915: pciconf: Add option to write into a BAR region.
In D55915#1280245, @kib wrote:

You only write a single value into the specified offset, right?
This should be clearly explained in the man page addition.
Or consider adding a possibility of writing the series of values starting at the given offset, of the specified width for each value (IMO it is fine as is, but needs to be properly documented).

In my use case, I only had to write a single value. Do you know use cases where a series of values needs to be written to a BAR region?

I tried to make it similar to -w (write to config space). This is the man page part about -w:

The -w option writes the value into a configuration space register at byte offset addr of device selector.

Do you find this more clear?

Sun, Mar 22, 1:55 AM
kib updated the diff for D55975: fenv.h: stop declaring feclearexcept() extern inline.

Handle all arches

Sun, Mar 22, 1:23 AM
kib updated the diff for D56005: x86 xen: provide the prototype for xen_arch_intr_handle_upcall() in xen/arch-intr.h.

Move the proto to apicvar.h.

Sun, Mar 22, 12:44 AM

Sat, Mar 21

kib added a comment to D56005: x86 xen: provide the prototype for xen_arch_intr_handle_upcall() in xen/arch-intr.h.

This is wrong. Specifically machine/xen/arch-intr.h is the MI <=> MD interface whereas xen_arch_intr_handle_upcall() is the x86 assembly-language <=> C interface. Mixing the two together would be bad.

It is C function, it can be called from C. What is the problem?

Sat, Mar 21, 11:29 PM
kib updated the diff for D55829: amd64: FRED support.

Use trapframe_fred

Sat, Mar 21, 10:40 PM
kib committed rG1ba29614c4ce: amd64: revert back struct trapframe to the pre-FRED definition (authored by kib).
amd64: revert back struct trapframe to the pre-FRED definition
Sat, Mar 21, 10:38 PM
kib abandoned D56004: x86: provide external access to local_apic.c:lapic_read32().

Not needed for the latest code.

Sat, Mar 21, 7:42 PM
kib added a comment to D55912: net: Add page/bank fields to ifi2cre; update mce(4) to use them.
In D55912#1279758, @kib wrote:

Why not simply not allocate the new number for the new ioctl. Rename current ioctl to something like SIOCGI2C_NOBANK. Then, at the ioctl level, do two things:

  • for new SIOCGI2C check that reserved bytes in the structure are zero
  • for SIOCGI2C_NOBANK, zero bank/page/padding and call into SIOCGI2C

I think I'd rather go the other direction, so as to avoid touching legacy ioctl users from ports. It turns out there are many from the ports sweep.

Eg, we add SIOCGI2CPB (where PB means page/bank) for new code. Drivers like mlx5 which can support page and/or bank access add a fallthru to SIOCGI2CPB to their SIOCGI2C case and zero page & bank for SIOCGI2C. Eg:

	case SIOCGI2C:
	case SIOCGI2CPB:
		ifr = (struct ifreq *)data;

		/*
		 * Copy from the user-space address ifr_data to the
		 * kernel-space address i2c
		 */
		error = copyin(ifr_data_get_ptr(ifr), &i2c, sizeof(i2c));
		if (error)
			break;

		/* Esnure page & bank are zero for legacy SIOCGI2C ioctl */
		if (command == SIOCGI2C) {
			i2c.page = i2c.bank = 0;
		}
Sat, Mar 21, 1:15 AM
kib accepted D55996: x86: Handle when MPERF/APERF MSRs aren't writable.
Sat, Mar 21, 1:08 AM
kib added inline comments to D55893: libc: Fix cxa_thread_atexit test..
Sat, Mar 21, 1:06 AM

Fri, Mar 20

kib updated the diff for D55829: amd64: FRED support.

XENHVM upcall IPI handler

Fri, Mar 20, 11:31 PM
kib requested review of D56005: x86 xen: provide the prototype for xen_arch_intr_handle_upcall() in xen/arch-intr.h.
Fri, Mar 20, 11:28 PM
kib updated the diff for D55829: amd64: FRED support.

This should be functionally complete with the one minor missed XEN ipi handler code.

Fri, Mar 20, 11:12 PM
kib requested review of D56004: x86: provide external access to local_apic.c:lapic_read32().
Fri, Mar 20, 11:02 PM
kib requested review of D56003: x86: move the NUM_ISA_IRQS symbol from atpic.c into x86/isa/icu.h.
Fri, Mar 20, 11:01 PM
kib committed rG8cc1c0f35ec8: amd64 trap.c: provide tag for the struct sfhandlers definition (authored by kib).
amd64 trap.c: provide tag for the struct sfhandlers definition
Fri, Mar 20, 10:50 PM
kib committed rG23dc4850fbc9: amd64: add prototype for ia32_syscall() (authored by kib).
amd64: add prototype for ia32_syscall()
Fri, Mar 20, 10:50 PM
kib committed rGacce5fa3dbe8: amd64: remove assertion about sizeof(struct pcb) (authored by kib).
amd64: remove assertion about sizeof(struct pcb)
Fri, Mar 20, 10:50 PM
kib committed rG6275cd73aca7: sys/param.h: bump __FreeBSD_version for amd64 struct trapframe size change (authored by kib).
sys/param.h: bump __FreeBSD_version for amd64 struct trapframe size change
Fri, Mar 20, 10:50 PM
kib committed rGe90950627327: x86 FRED: add hardware definitions for the trap frames fields (authored by kib).
x86 FRED: add hardware definitions for the trap frames fields
Fri, Mar 20, 10:50 PM
kib committed rG8892176c86db: amd64: check that %cs and %ss values from ucontext fit into registers (authored by kib).
amd64: check that %cs and %ss values from ucontext fit into registers
Fri, Mar 20, 10:50 PM
kib committed rGe18449fbe273: amd64: move code to check for traps with interrupts disabled into helpers (authored by kib).
amd64: move code to check for traps with interrupts disabled into helpers
Fri, Mar 20, 10:50 PM
kib closed D55931: amd64: remove assertion about sizeof(struct pcb).
Fri, Mar 20, 10:50 PM
kib closed D55831: x86 FRED: add hardware definitions for the trap frames fields.
Fri, Mar 20, 10:50 PM
kib closed D55861: amd64: check that %cs and %ss values from ucontext fit into registers.
Fri, Mar 20, 10:50 PM
kib closed D55809: amd64: move code to check for traps with interrupts disabled into helpers.
Fri, Mar 20, 10:50 PM
kib accepted D55852: kqueue: Fix a race when adding an fd-based knote to a queue.
Fri, Mar 20, 4:58 PM
kib added inline comments to D54070: uio.9: Document uiomove_fromphys().
Fri, Mar 20, 4:57 PM
kib updated the diff for D55861: amd64: check that %cs and %ss values from ucontext fit into registers.

Missed check.

Fri, Mar 20, 3:24 AM
kib updated the diff for D55861: amd64: check that %cs and %ss values from ucontext fit into registers.

Centralize and fix checks.

Fri, Mar 20, 3:13 AM

Thu, Mar 19

kib added inline comments to D55943: arm64: Handle changing self-referential DMAP pages.
Thu, Mar 19, 10:54 PM
kib added a comment to D55915: pciconf: Add option to write into a BAR region.

You only write a single value into the specified offset, right?
This should be clearly explained in the man page addition.
Or consider adding a possibility of writing the series of values starting at the given offset, of the specified width for each value (IMO it is fine as is, but needs to be properly documented).

Thu, Mar 19, 9:16 PM
kib added a comment to D55975: fenv.h: stop declaring feclearexcept() extern inline.

I only handled x86 for start. After everybody is fine with the patch, I will add other arches.

Thu, Mar 19, 8:42 PM
kib requested review of D55975: fenv.h: stop declaring feclearexcept() extern inline.
Thu, Mar 19, 8:42 PM
kib added a comment to D55831: x86 FRED: add hardware definitions for the trap frames fields.
In D55831#1279764, @jhb wrote:

I can't recall if kgdb has to know the size of struct trapframe is my only concern. I think we already only use the 16 bits for cs/ss today.

Thu, Mar 19, 4:02 PM
kib added a comment to D55912: net: Add page/bank fields to ifi2cre; update mce(4) to use them.

Why not simply not allocate the new number for the new ioctl. Rename current ioctl to something like SIOCGI2C_NOBANK. Then, at the ioctl level, do two things:

  • for new SIOCGI2C check that reserved bytes in the structure are zero
  • for SIOCGI2C_NOBANK, zero bank/page/padding and call into SIOCGI2C
Thu, Mar 19, 3:57 PM
kib added a comment to D55931: amd64: remove assertion about sizeof(struct pcb).
In D55931#1279683, @jhb wrote:

Speaking of this btw, it might be nice to fix other architectures to also pull the pcb out of the kstack in general. Certainly for CHERI we prefer that arrangement.

Thu, Mar 19, 3:48 PM
kib updated the summary of D55831: x86 FRED: add hardware definitions for the trap frames fields.
Thu, Mar 19, 3:46 PM
kib added a comment to D55831: x86 FRED: add hardware definitions for the trap frames fields.
In D55831#1279681, @jhb wrote:

FYI, kgdb will have to know about the change in layout to trapframe I think, so bump __FreeBSD_version when you land this just to be on the safe side please?

Thu, Mar 19, 3:28 PM
kib updated the diff for D55829: amd64: FRED support.

Functionally complete patch

Thu, Mar 19, 4:04 AM
kib requested review of D55931: amd64: remove assertion about sizeof(struct pcb).
Thu, Mar 19, 3:45 AM
kib added inline comments to D55912: net: Add page/bank fields to ifi2cre; update mce(4) to use them.
Thu, Mar 19, 1:57 AM

Wed, Mar 18

kib added inline comments to D55912: net: Add page/bank fields to ifi2cre; update mce(4) to use them.
Wed, Mar 18, 7:10 PM
kib accepted D55893: libc: Fix cxa_thread_atexit test..
Wed, Mar 18, 7:05 PM
kib accepted D55888: Refinement of extended errors for mmap(2).
Wed, Mar 18, 12:56 AM
kib updated the diff for D55829: amd64: FRED support.

Continue the WIP.
Handle NMIs and #MC.
Misc bug fixes.

Wed, Mar 18, 12:06 AM

Tue, Mar 17

kib added inline comments to D55888: Refinement of extended errors for mmap(2).
Tue, Mar 17, 9:46 PM
kib added inline comments to D55888: Refinement of extended errors for mmap(2).
Tue, Mar 17, 8:52 PM
kib added a comment to D55893: libc: Fix cxa_thread_atexit test..

For now, I suggest to #ifdef 0 the ADD_TEST(), then revert it when the updated test is written.

Tue, Mar 17, 4:00 PM
kib added inline comments to D55881: linux: Fix sockopt copyout.
Tue, Mar 17, 3:16 PM
kib added a comment to D55893: libc: Fix cxa_thread_atexit test..
In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

In D55893#1278865, @kib wrote:

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

What about the nothr case? Since there is only one main thread. The dtos will be called after the ATF_TEST_CASE_BODY, which means we are unable to use assert since the main thread is destroyed.

Tue, Mar 17, 2:59 PM
kib added inline comments to D55888: Refinement of extended errors for mmap(2).
Tue, Mar 17, 2:55 PM
kib added a comment to D55893: libc: Fix cxa_thread_atexit test..

No, I mean to keep this test, adjusted.
Create a global static var that is incremented on each again() call, and do not call __cxa_thread_atexit() if the counter greater than some value.
As an additional check, you might assert that the counter indeed counted to the specified value.

Tue, Mar 17, 2:33 PM
kib accepted D55250: arm64: Have a common call to userret.
Tue, Mar 17, 2:30 PM
kib committed rGfc1c67912bf1: p9fs: use atomics for updating node->flags (authored by kib).
p9fs: use atomics for updating node->flags
Tue, Mar 17, 12:39 AM
kib committed rGdb4caf69d734: p9fs: locking improvements for p9fs_stat_vnode_dotl() (authored by kib).
p9fs: locking improvements for p9fs_stat_vnode_dotl()
Tue, Mar 17, 12:38 AM
kib committed rG1ff01f6ca2d3: vn_delayed_setsize(): post-commit review' changes (authored by kib).
vn_delayed_setsize(): post-commit review' changes
Tue, Mar 17, 12:38 AM
kib committed rG47f299838540: nfsclient: convert to use vn_delayed_setsize() (authored by kib).
nfsclient: convert to use vn_delayed_setsize()
Tue, Mar 17, 12:38 AM
kib committed rG89559b5d279c: vfs: add VOP_DELAYED_SETSIZE() and related infrastructure (authored by kib).
vfs: add VOP_DELAYED_SETSIZE() and related infrastructure
Tue, Mar 17, 12:38 AM

Mon, Mar 16

kib added inline comments to D55851: lapic_handle_intr: KASSERT isrc != NULL.
Mon, Mar 16, 10:00 PM
kib added a comment to D55857: io_apic: Don't route to APIC ID > 255.

Did you tried enabling DMAR/AMD IOMMU and interrupt remapping on this machine?

Mon, Mar 16, 8:51 PM
kib added inline comments to D55851: lapic_handle_intr: KASSERT isrc != NULL.
Mon, Mar 16, 8:49 PM
kib added inline comments to D55882: linux: Add TCP_INFO support.
Mon, Mar 16, 8:46 PM
kib added inline comments to D55881: linux: Fix sockopt copyout.
Mon, Mar 16, 8:43 PM
kib accepted D44454: intelhfi - Intel TD/HFI driver - Part2: Enable thermal interrupt handler for Local APIC's..
Mon, Mar 16, 4:04 PM · Contributor Reviews (src)
kib added a comment to D55826: libc: Fix dtor order in __cxa_thread_atexit.

@aokblast this commit breaks the following tests in CI:

lib/libc/stdlib/cxa_thread_atexit_nothr_test:cxx__thread_inf_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_inf_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_add_while_calling_dtors
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_after
lib/libc/stdlib/cxa_thread_atexit_test:cxx__thread_local_before

See https://ci.freebsd.org/view/Test/job/FreeBSD-main-amd64-test/28044/testReport/.

I don't think the test actually make sense with my change.
The following code in the test makes it unables to terminate

static void                                                                                                                                        
again(void *arg)                                                                                                                                   
{                                                                                                                                                  
                                                                                                                                                   
    __cxa_thread_atexit(again, arg, &output);                                                                                                      
}

This makes again(void *) called himself and create a infinite loop. In my opnion, the user of the __cxa_thread_atexit should take the responsibility on the infinite loop instead of setting the hard limit on iteration.

I just take a look at the original commit which add this test and would like to ask @kib and @dim on their opinions.

Should we remove the again function or if there is any suggestions on this?

Mon, Mar 16, 4:00 PM

Sun, Mar 15

kib requested review of D55861: amd64: check that %cs and %ss values from ucontext fit into registers.
Sun, Mar 15, 7:20 AM
kib accepted D55852: kqueue: Fix a race when adding an fd-based knote to a queue.
Sun, Mar 15, 7:03 AM
kib committed rG8365f877b1e4: amd64: do reset %rip after page fault if pcb_onfault is set (authored by kib).
amd64: do reset %rip after page fault if pcb_onfault is set
Sun, Mar 15, 6:58 AM

Sat, Mar 14

kib committed rG756689232e6a: sigreturn.2: refresh the man page (authored by kib).
sigreturn.2: refresh the man page
Sat, Mar 14, 12:03 PM
kib added inline comments to D55852: kqueue: Fix a race when adding an fd-based knote to a queue.
Sat, Mar 14, 11:57 AM
kib updated the diff for D55831: x86 FRED: add hardware definitions for the trap frames fields.

Fix typo in the name of the reserved field.
Remove cs masking.

Sat, Mar 14, 10:55 AM