Page MenuHomeFreeBSD

HWPMC tracing support (2) -- VM
Needs ReviewPublic

Authored by br on Apr 16 2018, 1:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 5, 3:43 PM
Unknown Object (File)
Thu, May 2, 10:51 AM
Unknown Object (File)
Mon, Apr 29, 12:25 AM
Unknown Object (File)
Fri, Apr 19, 10:14 PM
Unknown Object (File)
Mar 8 2024, 2:53 PM
Unknown Object (File)
Feb 21 2024, 12:27 AM
Unknown Object (File)
Feb 10 2024, 7:00 AM
Unknown Object (File)
Feb 6 2024, 6:38 AM
Subscribers
None

Details

Reviewers
kib
emaste
markj

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br added a reviewer: kib.
sys/dev/hwpmc/hwpmc_vm.c
76

Did you looked at OSD, sys/osd.h ? OSD_THREAD should remove the ugly side-list of threads.

79

What protects the map->obj from the parallel dereference ?

103

This should be CPU_FOREACH(). Or instead, just allocate the whole array by one malloc().

110

You should use make_dev_s(), to guard againts si_drv1 races.

Use:

  1. osd(9)
  2. CPU_FOREACH macro
  3. make_dev_s instead of make_dev
  4. mtx_lock around map->obj dereferencing
sys/dev/hwpmc/hwpmc_vm.c
79

I still do not see any protection against possible object deallocation.

147

Why destroy_dev_sched() and not destroy_dev() ?

  • reference the object
  • use destroy_dev, not destroy_dev_sched
sys/dev/hwpmc/hwpmc_vm.c
79

Added vm_object_reference() call

147

No reason, just testing. Restored

Ok.

Where is the dereference of the vm object reference owned by the OSD ?

In D15089#318912, @kib wrote:

Ok.

Where is the dereference of the vm object reference owned by the OSD ?

  1. in pt_buffer_deallocate() @ https://reviews.freebsd.org/D15091
  2. in coresight_buffer_deallocate() @ https://reviews.freebsd.org/D15090
This revision is now accepted and ready to land.Apr 20 2018, 4:54 PM
This revision now requires review to proceed.May 25 2018, 3:18 PM

merge changes from upstream

sys/dev/hwpmc/hwpmc_vm.c
123

Why is the device writable? Isn't the purpose just to provide read-only trace buffers?

146

Isn't osd_thread_deregister() needed?

  • deregister thread OSD
  • use read-only permissions for /dev/pmc*
sys/dev/hwpmc/hwpmc_vm.c
123

Yes. Thanks. I changed to read-only.

146

Yes, it is needed. I missed this. Thanks!

sys/dev/hwpmc/hwpmc_vm.c
146

I think the appropriate order here would be to destroy the device first.

destroy the character device first, and then osd_thread_deregister()

sys/dev/hwpmc/hwpmc_vm.c
128

I think osd_thread_deregister() needs to be called in this path too.

sys/modules/hwpmc/Makefile
14

Seems this is unrelated to the rest of the diff.

19

Ditto.

deregister osd thread on failure

correctly deregister osd thread on failure

  • fix destroying device on failure
  • destroy mtx lock

fix memory leak on failure

another attempt to handle failure case correctly

br marked 3 inline comments as done.Jan 23 2019, 1:52 PM
br added inline comments.
sys/modules/hwpmc/Makefile
14

these two chunks are not related to VM, but I am lazy to edit the patch every time I submit changes.
All parts will go together anyway

br marked an inline comment as done.

rebase