gpu: nvgpu: ensure worker thread is disabled during rg

A previous commit ID 44b6bfbc1 added a hack to prevent
the worker thread from calling nvgpu_runlist_tick()
in post_process if the next domain matches the previous.

This could potentially still face issues with multi-domains
in future.

A better way is to synchronize the thread to suspend/resume
alongwith the device's common OS agnostic suspend/resume
operations. This shall emulate the GSP as well.
This shall also take care of the power constraints
i.e. the worker thread can be expected to always work
with the power enabled and thus we can get rid of the complex
gk20a_busy() lock here for good.

Implemented a state-machine based approach for suspending/
resuming the NVS worker thread from the existing callbacks.

Remove support for NVS worker thread creation for VGPU.
hw_submit method is currently set to NULL for VGPU. VGPU
instead submits its updates via the runlist.reload() method.

Jira NVGPU-8609

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Change-Id: I51a20669e02bf6328dfe5baa122d5bfb75862ea2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2750403
Reviewed-by: Prateek Sethi <prsethi@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Debarshi Dutta
2022-08-16 18:43:49 +05:30
committed by mobile promotions
parent 21ab579341
commit 13699c4c15
4 changed files with 189 additions and 59 deletions

View File

@@ -125,9 +125,15 @@ struct nvgpu_nvs_domain {
struct nvgpu_runlist_domain **rl_domains;
};
#define NVS_WORKER_STATE_STOPPED 0
#define NVS_WORKER_STATE_RUNNING 1
#define NVS_WORKER_STATE_SHOULD_PAUSE 2
#define NVS_WORKER_STATE_PAUSED 3
#define NVS_WORKER_STATE_SHOULD_RESUME 4
struct nvgpu_nvs_worker {
nvgpu_atomic_t nvs_sched_init;
struct nvgpu_cond wq_init;
nvgpu_atomic_t nvs_sched_state;
struct nvgpu_cond wq_request;
struct nvgpu_worker worker;
struct nvgpu_timeout timeout;
u32 current_timeout;
@@ -248,6 +254,8 @@ const char *nvgpu_nvs_domain_get_name(struct nvgpu_nvs_domain *dom);
void nvgpu_nvs_ctrl_fifo_lock_queues(struct gk20a *g);
void nvgpu_nvs_ctrl_fifo_unlock_queues(struct gk20a *g);
void nvgpu_nvs_worker_pause(struct gk20a *g);
void nvgpu_nvs_worker_resume(struct gk20a *g);
struct nvgpu_nvs_domain_ctrl_fifo *nvgpu_nvs_ctrl_fifo_create(struct gk20a *g);
bool nvgpu_nvs_ctrl_fifo_user_exists(struct nvgpu_nvs_domain_ctrl_fifo *sched_ctrl,
int pid, bool rw);
@@ -288,6 +296,18 @@ void nvgpu_nvs_ctrl_fifo_erase_queue(struct gk20a *g, struct nvgpu_nvs_ctrl_queu
void nvgpu_nvs_ctrl_fifo_erase_all_queues(struct gk20a *g);
#else
static inline void nvgpu_nvs_worker_pause(struct gk20a *g)
{
(void)g;
}
static inline void nvgpu_nvs_worker_resume(struct gk20a *g)
{
(void)g;
}
static inline int nvgpu_nvs_init(struct gk20a *g)
{
(void)g;