mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
In current form, the default domain acts like any schedulable domain. TSGs are bound to it and it can be enumerated via the public interfaces. The new expectation for the default domain is meant to change from the current form to a pseudo domain that cannot act like an ordinary domain in other ways, i.e. it must not be reachable by in particular the domain management API, it can't be removed, does not show up in lists, and TSGs cannot be explicitly bound to this domain. It won't participate in round-robin domain scheduling. It is not really a domain, and acts like one only when activated in the manual mode. Following changes are made overall to support the above change in definition. 1) Domain creation and attaching the domain to the scheduler are now split into two separate functions. The new default domain (having ID = UINT64_MAX) is created separately from a static function without linking it with other domains in the scheduler. 2) struct nvgpu_nvs_scheduler explicitely stores the default domain to support direct lookups. 3) TSGs are initially not bound to default domain/rl_domain. Jira NVGPU-8165 Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Change-Id: I916d11f4eea5124d8d64176dc77f3806c6139695 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2697477 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
81 lines
2.4 KiB
C
81 lines
2.4 KiB
C
/*
|
|
* Copyright (c) 2021-2022 NVIDIA Corporation. All rights reserved.
|
|
*
|
|
* NVIDIA Corporation and its licensors retain all intellectual property
|
|
* and proprietary rights in and to this software, related documentation
|
|
* and any modifications thereto. Any use, reproduction, disclosure or
|
|
* distribution of this software and related documentation without an express
|
|
* license agreement from NVIDIA Corporation is strictly prohibited.
|
|
*/
|
|
|
|
#ifndef NVS_DOMAIN_H
|
|
#define NVS_DOMAIN_H
|
|
|
|
#include <nvs/types-internal.h>
|
|
|
|
struct nvs_sched;
|
|
struct nvs_domain;
|
|
|
|
/*
|
|
* nvsched provides a simple, singly linked list for keeping track of
|
|
* available domains. If algorithms need something more complex, like a
|
|
* table of priorities and domains therein, then it will need to build
|
|
* these data structures during its init().
|
|
*/
|
|
struct nvs_domain_list {
|
|
u32 nr;
|
|
struct nvs_domain *domains;
|
|
|
|
/*
|
|
* Convenience for adding a domain quickly.
|
|
*/
|
|
struct nvs_domain *last;
|
|
};
|
|
|
|
struct nvs_domain {
|
|
char name[32];
|
|
|
|
struct nvs_context_list *ctx_list;
|
|
|
|
/*
|
|
* Internal, singly linked list pointer.
|
|
*/
|
|
struct nvs_domain *next;
|
|
|
|
/*
|
|
* Scheduling parameters: specify how long this domain should be scheduled
|
|
* for and what the grace period the scheduler should give this domain when
|
|
* preempting. A value of zero is treated as an infinite timeslice or an
|
|
* infinite grace period.
|
|
*/
|
|
u64 timeslice_ns;
|
|
u64 preempt_grace_ns;
|
|
|
|
/*
|
|
* Priv pointer for downstream use.
|
|
*/
|
|
void *priv;
|
|
};
|
|
|
|
/**
|
|
* @brief Iterate over the list of domains present in the sched.
|
|
*/
|
|
#define nvs_domain_for_each(sched, domain_ptr) \
|
|
for ((domain_ptr) = (sched)->domain_list->domains; \
|
|
(domain_ptr) != NULL; \
|
|
(domain_ptr) = (domain_ptr)->next)
|
|
|
|
struct nvs_domain *nvs_domain_create(struct nvs_sched *sched,
|
|
const char *name, u64 timeslice, u64 preempt_grace,
|
|
void *priv);
|
|
struct nvs_domain *nvs_domain_get_next_domain(struct nvs_sched *sched, struct nvs_domain *dom);
|
|
void nvs_domain_scheduler_attach(struct nvs_sched *sched, struct nvs_domain *dom);
|
|
void nvs_domain_destroy(struct nvs_sched *sched, struct nvs_domain *dom);
|
|
void nvs_domain_unlink_and_destroy(struct nvs_sched *sched,
|
|
struct nvs_domain *dom);
|
|
void nvs_domain_clear_all(struct nvs_sched *sched);
|
|
u32 nvs_domain_count(struct nvs_sched *sched);
|
|
struct nvs_domain *nvs_domain_by_name(struct nvs_sched *sched, const char *name);
|
|
|
|
#endif
|