Skip to content

feat: Logging license type usage - #268

Open
dominicprice-lowrisc wants to merge 2 commits into
lowRISC:masterfrom
dominicprice-lowrisc:logging-license-type-usage
Open

dominicprice-lowrisc wants to merge 2 commits into
lowRISC:masterfrom
dominicprice-lowrisc:logging-license-type-usage

Conversation

@dominicprice-lowrisc

@dominicprice-lowrisc dominicprice-lowrisc commented Oct 5, 2026 •

Copy link
Copy Markdown

Description

This PR addresses #267 by adding additional logging at the verbose level. There is already logging for when a job has changed status (e.g. from scheduled to queued), and now a table is also logged showing per resource, the number of jobs with each status. I have attached an image and text copy of how these logs look when run in the OpenTitan repository. I have also added a test case to intercept the logs and check that each of the simulation tools is present in the logs at the debug level.

The way I implemented this was to create an index in the ResourceManager to track job statuses per resource, and register callbacks in the Scheduler to log this information whenever a job changes status. I also modified tool_meta_factory in the tests file to randomly select real simulation tools names, rather than just using "test_tool" by default.

I identified a minor bug in logging.py where logs at the verbose level are always seen to be coming a line in logging.py, rather than from the file and line number where that log function was being called. I fixed this by passing stacklevel=2.

(The exact command I used to generate the attached screenshot was uv run --no-sync dvsim hw/top_earlgrey/dv/top_earlgrey_sim_cfgs.hjson -i smoke --scratch ~/scratch --fixed-seed 1 --verbose=debug --cov -R A=20, with my fork of DVSim installed).

(The image and text are now slightly out of date, with Resource instead of Tool, and improved formatting)

dvsim_logs_cropped
[D 261005 10:18:38 backend:101] Job cover_reg_top completed execution: P
[V 261005 10:18:38 core:286] Status change to [P: Passed] for csrng:cover_reg_top
[D 261005 10:18:38 resources:134] [Tool: vcs            ] [ S:   181, Q:    51, R:    12, P:     0, F:     0, K:     0 ]
[D 261005 10:18:38 resources:134] [Tool: xcelium        ] [ S:    46, Q:    14, R:     3, P:     1, F:     0, K:     0 ]
[V 261005 10:18:38 core:286] Status change to [Q: Queued] for csrng:0.csrng_csr_hw_reset.1
[D 261005 10:18:38 resources:134] [Tool: vcs            ] [ S:   181, Q:    51, R:    12, P:     0, F:     0, K:     0 ]
[D 261005 10:18:38 resources:134] [Tool: xcelium        ] [ S:    45, Q:    15, R:     3, P:     1, F:     0, K:     0 ]
[V 261005 10:18:38 core:286] Status change to [Q: Queued] for csrng:0.csrng_csr_rw.1
[D 261005 10:18:38 resources:134] [Tool: vcs            ] [ S:   181, Q:    51, R:    12, P:     0, F:     0, K:     0 ]
[D 261005 10:18:38 resources:134] [Tool: xcelium        ] [ S:    44, Q:    16, R:     3, P:     1, F:     0, K:     0 ]
[V 261005 10:18:38 logging:67] [local]: Dispatching jobs: hmac:cover_reg_top
[D 261005 10:18:38 resources:134] [Tool: vcs            ] [ S:   181, Q:    50, R:    13, P:     0, F:     0, K:     0 ]
[D 261005 10:18:38 resources:134] [Tool: xcelium        ] [ S:    44, Q:    16, R:     3, P:     1, F:     0, K:     0 ]
[D 261005 10:18:39 backend:101] Job cover_reg_top completed execution: P
[V 261005 10:18:39 core:286] Status change to [P: Passed] for aes_unmasked:cover_reg_top
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    50, R:    13, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    44, Q:    16, R:     2, P:     2, F:     0, K:     0 ]
[V 261005 10:18:39 core:286] Status change to [Q: Queued] for aes_unmasked:0.aes_csr_rw.1
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    50, R:    13, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    43, Q:    17, R:     2, P:     2, F:     0, K:     0 ]
[V 261005 10:18:39 core:286] Status change to [Q: Queued] for aes_unmasked:0.aes_csr_hw_reset.1
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    50, R:    13, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    42, Q:    18, R:     2, P:     2, F:     0, K:     0 ]
[V 261005 10:18:39 logging:67] [local]: Dispatching jobs: i2c:cover_reg_top
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    49, R:    14, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    42, Q:    18, R:     2, P:     2, F:     0, K:     0 ]
[D 261005 10:18:39 backend:101] Job cover_reg_top completed execution: P
[V 261005 10:18:39 core:286] Status change to [P: Passed] for entropy_src_rng_4bits:cover_reg_top
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    49, R:    14, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    42, Q:    18, R:     1, P:     3, F:     0, K:     0 ]
[V 261005 10:18:39 core:286] Status change to [Q: Queued] for entropy_src_rng_4bits:0.entropy_src_csr_hw_reset.1
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    49, R:    14, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    41, Q:    19, R:     1, P:     3, F:     0, K:     0 ]
[V 261005 10:18:39 core:286] Status change to [Q: Queued] for entropy_src_rng_4bits:0.entropy_src_csr_rw.1
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    49, R:    14, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    40, Q:    20, R:     1, P:     3, F:     0, K:     0 ]
[V 261005 10:18:39 logging:67] [local]: Dispatching jobs: keymgr_dpe_earlgrey:cover_reg_top
[D 261005 10:18:39 resources:134] [Tool: vcs            ] [ S:   181, Q:    48, R:    15, P:     0, F:     0, K:     0 ]
[D 261005 10:18:39 resources:134] [Tool: xcelium        ] [ S:    40, Q:    20, R:     1, P:     3, F:     0, K:     0 ]
[D 261005 10:18:40 backend:101] Job cover_reg_top completed execution: P
[V 261005 10:18:40 core:286] Status change to [P: Passed] for aes_masked:cover_reg_top
[D 261005 10:18:40 resources:134] [Tool: vcs            ] [ S:   181, Q:    48, R:    15, P:     0, F:     0, K:     0 ]
[D 261005 10:18:40 resources:134] [Tool: xcelium        ] [ S:    40, Q:    20, R:     0, P:     4, F:     0, K:     0 ]
[V 261005 10:18:40 core:286] Status change to [Q: Queued] for aes_masked:0.aes_csr_rw.1
[D 261005 10:18:40 resources:134] [Tool: vcs            ] [ S:   181, Q:    48, R:    15, P:     0, F:     0, K:     0 ]
[D 261005 10:18:40 resources:134] [Tool: xcelium        ] [ S:    39, Q:    21, R:     0, P:     4, F:     0, K:     0 ]

@dominicprice-lowrisc
dominicprice-lowrisc force-pushed the logging-license-type-usage branch from 1f66ad8 to b6114ba Compare October 5, 2026 09:52
@dominicprice-lowrisc dominicprice-lowrisc changed the title Logging license type usage feat: Logging license type usage Oct 5, 2026

@AlexJones0 AlexJones0 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this @dominicprice-lowrisc, the overall approach LGTM.

I've left a lot of comments but most are very nitpicky, and hopefully quite easy to address or defer. The important comments are those on OpenTitan's commit guidelines and about handling resources vs. tools in the ResourceManager.

Comment thread src/dvsim/scheduler/core.py Outdated
Comment thread src/dvsim/scheduler/core.py Outdated
Comment thread src/dvsim/scheduler/core.py Outdated
Comment thread src/dvsim/scheduler/resources.py Outdated
Comment thread src/dvsim/scheduler/core.py Outdated
Comment thread src/dvsim/scheduler/resources.py Outdated
Comment thread src/dvsim/scheduler/resources.py Outdated
Comment thread tests/test_scheduler.py Outdated
Comment thread tests/test_scheduler.py
Comment thread tests/test_scheduler.py Outdated
@AlexJones0
AlexJones0 requested a review from machshev October 5, 2026 16:53
Signed-off-by: Dominic Price <dominic.price@lowrisc.org>

feat: Improved formatting of log messages

Signed-off-by: Dominic Price <dominic.price@lowrisc.org>

test: intercept logs and check they are present

Signed-off-by: Dominic Price <dominic.price@lowrisc.org>
… runner

Signed-off-by: Dominic Price <dominic.price@lowrisc.org>

@AlexJones0 AlexJones0 left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dominicprice-lowrisc, I think this is looking good! I much prefer it hooking onto the scheduler externally now that you've implemented it that way.

I only really have two high-level comments to address before this is merged, which are with the commits themselves:

  1. There are several changes that are introduced in the first commit and then dropped in the second. The history would be clearer if this was not the case. You could go and edit each commit, but the easier option is probably just to squash the two together into one.
  2. Can you edit the commit message(s) so they don't contain the full squashed history?

@machshev It would be nice if you could confirm that this works for your desired use case. To extend support to lint & formal tools etc. I think there may(?) be some very minor extension needed in the FlowCfgs / Deploys to declare the tool as a resource, but that can be left for a separate PR as is needed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants