Page MenuHomeFreeBSD

amd64: Intel Processor Trace support
Needs ReviewPublic

Authored by bnovkov on Wed, Aug 21, 2:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 16, 10:55 PM
Unknown Object (File)
Sun, Sep 8, 12:25 PM
Unknown Object (File)
Sun, Sep 8, 10:26 AM
Unknown Object (File)
Thu, Sep 5, 6:07 PM
Unknown Object (File)
Wed, Sep 4, 1:22 PM
Unknown Object (File)
Tue, Sep 3, 2:16 PM
Unknown Object (File)
Mon, Aug 26, 7:03 PM
Unknown Object (File)
Mon, Aug 26, 6:51 PM
Subscribers

Details

Reviewers
markj
kib
br
Group Reviewers
x86
Summary

Add support for Intel Processor Trace (PT) to the Hardware Trace Framework (HWT).

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br requested review of this revision.Wed, Aug 21, 2:48 PM
br created this revision.
br foisted this revision upon bnovkov.
br added a reviewer: br.
br edited reviewers, added: x86; removed: br.
sys/amd64/pt/pt.c
322

[picking a random example] Rather than one-line comments which describe what the code is doing, it is much more helpful to readers to have some high-level description of what's happening in this function.

372

Please use calloc() here.

491

What should happen here?

639

What is this memory barrier for?

Usually we prefer to use atomic(9) acq/rel barriers.

757

Can this be const?

819

This shouldn't be necessary, assuming we're in a hardware interrupt context.

837

Why pass this flag? This code isn't checking the return value.

883

calloc() would be a bit nicer than malloc() here.

885

Do you need to check the return value?

942

Shouldn't this be if (!initialized)?

sys/x86/x86/local_apic.c
910 ↗(On Diff #142307)

Why not just if (refcount_release(...)) return;?

lwhsu added inline comments.
sys/amd64/pt/pt.h
4

A SPDX-License-Identifier is desired, and "All rights reserved" is not really needed for a new file.

Please split the review. At least, specialreg.h additions are easy and should go separately. Same for the nmi interrupt handler refactoring.
Then the refcounting for perf interrupt can go. Then we will see about the rest.

sys/amd64/amd64/trap.c
211 ↗(On Diff #142307)
212 ↗(On Diff #142307)

Why not bool?

219 ↗(On Diff #142307)

This line violates every single style(9) requirement, at once.

Address review comments:

  • review is now split into multiple parts
  • fixed copyright header issues
  • hoisted single-line comments on top of functions
bnovkov added inline comments.
sys/amd64/pt/pt.c
372

Sorry if I'm missing something, but as far as I know (and what my grepping efforts turned up) calloc isn't defined in the kernel.
I've substituted malloc with mallocarray, were you thinking of defining a calloc-like macro on top of the file?

491

Thanks for catching this, it slipped by. This was meant to clear any features flags that aren't supported by the driver.

639

The barrier is here for the NMI interrupt handler.

757

At the moment no due to how things are setup in hwt(4) code, but I'll see what I can do about it.