590.44.01

This commit is contained in:
Maneet Singh
2025-12-02 15:32:25 -08:00
parent 2af9f1f0f7
commit a5bfb10e75
954 changed files with 421883 additions and 408177 deletions

View File

@@ -2354,7 +2354,9 @@ NV_STATUS UvmDisableReadDuplication(void *base,
//
// When a page is in its preferred location, a fault from another processor will
// not cause a migration if a mapping for that page from that processor can be
// established without migrating the page.
// established without migrating the page. Individual faulting pages will still
// migrate to service immediate access needs, but prefetch operations will not
// pull additional pages away from their preferred location.
//
// If the specified processor is a GPU and the GPU is not a NUMA node and the
// input range is system-allocated pageable memory and the system supports
@@ -2951,619 +2953,6 @@ NV_STATUS UvmIs8Supported(NvU32 *is8Supported);
// Tools API
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// UvmDebugGetVersion
//
// Returns the version number of the UVM debug library
// See uvm_types.h for valid verion numbers, e.g. UVM_DEBUG_V1
//
//------------------------------------------------------------------------------
unsigned UvmDebugVersion(void);
//------------------------------------------------------------------------------
// UvmDebugCreateSession
//
// Creates a handle for a debugging session.
//
// When the client initializes, it will pass in a process handle and get a
// session ID for itself. Subsequent calls to the UVM API will take in that
// session ID.
//
// There are security requirements to this call.
// One of the following must be true:
// 1. The session owner must be running as an elevated user
// 2. The session owner and target must belong to the same user and the
// session owner is at least as privileged as the target.
//
// For CUDA 6.0 we can create at most 64 sessions per debugger process.
//
// Arguments:
// pid: (INPUT)
// Process id for which the debugging session will be created
//
// session: (OUTPUT)
// Handle to the debugging session associated to that pid.
//
// Error codes:
// NV_ERR_PID_NOT_FOUND:
// pid is invalid/ not associated with UVM.
//
// NV_ERR_INSUFFICIENT_PERMISSIONS:
// Function fails the security check.
//
// NV_ERR_INSUFFICIENT_RESOURCES:
// Attempt is made to allocate more than 64 sessions per process.
//
// NV_ERR_BUSY_RETRY:
// internal resources are blocked by other threads.
//
//------------------------------------------------------------------------------
NV_STATUS UvmDebugCreateSession(unsigned pid,
UvmDebugSession *session);
//------------------------------------------------------------------------------
// UvmDebugDestroySession
//
// Destroys a debugging session.
//
// Arguments:
// session: (INPUT)
// Handle to the debugging session associated to that pid.
//
// Error codes:
// NV_ERR_INVALID_ARGUMENT:
// session is invalid.
//
// NV_ERR_BUSY_RETRY:
// ebug session is in use by some other thread.
//
//------------------------------------------------------------------------------
NV_STATUS UvmDebugDestroySession(UvmDebugSession session);
//------------------------------------------------------------------------------
// UvmDebugCountersEnable
//
// Enables the counters following the user specified configuration.
//
// The user must fill a list with the configuration of the counters it needs to
// either enable or disable. It can only enable one counter per line.
//
// The structure (UvmCounterConfig) has several fields:
// - scope: Please see the UvmCounterScope enum (above), for details.
// - name: Name of the counter. Please check UvmCounterName for list.
// - gpuid: Identifies the GPU for which the counter will be enabled/disabled
// This parameter is ignored in AllGpu scopes.
// - state: A value of 0 will disable the counter, a value of 1 will enable
// the counter.
//
// Note: All counters are refcounted, that means that a counter will only be
// disable when its refcount reached zero.
//
// Arguments:
// session: (INPUT)
// Handle to the debugging session.
//
// config: (INPUT)
// pointer to configuration list as per above.
//
// count: (INPUT)
// number of entries in the config list.
//
// Error codes:
// NV_ERR_INSUFFICIENT_PERMISSIONS:
// Function fails the security check
//
// RM_INVALID_ARGUMENT:
// debugging session is invalid or one of the counter lines is invalid.
// If call returns this value, no action specified by the config list
// will have taken effect.
//
// NV_ERR_NOT_SUPPORTED:
// UvmCounterScopeGlobalSingleGpu is not supported for CUDA 6.0
//
// NV_ERR_BUSY_RETRY:
// the debug session is in use by some other thread.
//
//------------------------------------------------------------------------------
NV_STATUS UvmDebugCountersEnable(UvmDebugSession session,
UvmCounterConfig *config,
unsigned count);
//------------------------------------------------------------------------------
// UvmDebugGetCounterHandle
//
// Returns handle to a particular counter. This is an opaque handle that the
// implementation uses in order to find your counter, later. This handle can be
// used in subsequent calls to UvmDebugGetCounterVal().
//
// Arguments:
// session: (INPUT)
// Handle to the debugging session.
//
// scope: (INPUT)
// Scope that will be mapped.
//
// counterName: (INPUT)
// Name of the counter in that scope.
//
// gpu: (INPUT)
// UUID of the physical GPU if the GPU is not SMC capable or SMC
// enabled, or the GPU instance UUID of the partition of the scoped GPU.
// This parameter is ignored in AllGpu scopes.
//
// pCounterHandle: (OUTPUT)
// Handle to the counter address.
//
// Error codes:
// NV_ERR_INVALID_ARGUMENT:
// Specified scope/gpu pair or session id is invalid
//
// NV_ERR_NOT_SUPPORTED:
// UvmCounterScopeGlobalSingleGpu is not supported for CUDA 6.0
//
// NV_ERR_BUSY_RETRY:
// debug session is in use by some other thread.
//
//------------------------------------------------------------------------------
NV_STATUS UvmDebugGetCounterHandle(UvmDebugSession session,
UvmCounterScope scope,
UvmCounterName counterName,
NvProcessorUuid gpu,
NvUPtr *pCounterHandle);
//------------------------------------------------------------------------------
// UvmDebugGetCounterVal
//
// Returns the counter value specified by the counter name.
//
// Arguments:
// session: (INPUT)
// Handle to the debugging session.
//
// counterHandleArray: (INPUT)
// Array of counter handles
//
// handleCount: (INPUT)
// Number of handles in the pPCounterHandle array.
//
// counterValArray: (OUTPUT)
// Array of counter values corresponding to the handles.
//
// Error codes:
// NV_ERR_INVALID_ARGUMENT:
// one of the specified handles is invalid.
//
//------------------------------------------------------------------------------
NV_STATUS UvmDebugGetCounterVal(UvmDebugSession session,
NvUPtr *counterHandleArray,
unsigned handleCount,
unsigned long long *counterValArray);
//------------------------------------------------------------------------------
// UvmEventQueueCreate
//
// This call creates an event queue of the given size.
// No events are added in the queue until they are enabled by the user.
// Event queue data is visible to the user even after the target process dies
// if the session is active and queue is not freed.
//
// User doesn't need to serialize multiple UvmEventQueueCreate calls as
// each call creates a new queue state associated with the returned queue
// handle.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (OUTPUT)
// Handle to created queue.
//
// queueSize: (INPUT)
// Size of the event queue buffer in units of UvmEventEntry's.
// This quantity must be > 1.
//
// notificationCount: (INPUT)
// Number of entries after which the user should be notified that
// there are events to fetch.
// User is notified when queueEntries >= notification count.
//
// Error codes:
// NV_ERR_INSUFFICIENT_PERMISSIONS:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
// NV_ERR_INSUFFICIENT_RESOURCES:
// it's not possible to allocate a queue of requested size.
//
// NV_ERR_BUSY_RETRY:
// internal resources are blocked by other threads.
//
// NV_ERR_PID_NOT_FOUND:
// queue create call is made on a session after the target dies.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventQueueCreate(UvmDebugSession sessionHandle,
UvmEventQueueHandle *queueHandle,
NvS64 queueSize,
NvU64 notificationCount,
UvmEventTimeStampType timeStampType);
//------------------------------------------------------------------------------
// UvmEventQueueDestroy
//
// This call frees all interal resources associated with the queue, including
// unpinning of the memory associated with that queue. Freeing user buffer is
// responsibility of a caller. Event queue might be also destroyed as a side
// effect of destroying a session associated with this queue.
//
// User needs to ensure that a queue handle is not deleted while some other
// thread is using the same queue handle.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (INPUT)
// Handle to the queue which is to be freed
//
// Error codes:
// RM_ERR_NOT_PERMITTED:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
// NV_ERR_BUSY_RETRY:
// internal resources are blocked by other threads.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventQueueDestroy(UvmDebugSession sessionHandle,
UvmEventQueueHandle queueHandle);
//------------------------------------------------------------------------------
// UvmEventEnable
//
// This call enables a particular event type in the event queue.
// All events are disabled by default when a queue is created.
//
// This API does not access the queue state maintained in the user
// library so the user doesn't need to acquire a lock to protect the queue
// state.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (INPUT)
// Handle to the queue where events are to be enabled
//
// eventTypeFlags: (INPUT)
// This field specifies the event types to be enabled. For example:
// To enable migration events and memory violations: pass flags
// "UVM_EVENT_ENABLE_MEMORY_VIOLATION |UVM_EVENT_ENABLE_MIGRATION"
//
// Error codes:
// RM_ERR_NOT_PERMITTED:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
// NV_ERR_PID_NOT_FOUND:
// this call is made after the target process dies
//
// NV_ERR_BUSY_RETRY:
// internal resources are blocked by other threads.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventEnable(UvmDebugSession sessionHandle,
UvmEventQueueHandle queueHandle,
unsigned eventTypeFlags);
//------------------------------------------------------------------------------
// UvmEventDisable
//
// This call disables a particular event type in the queue.
//
// This API does not access the queue state maintained in the user
// library so the user doesn't need to acquire a lock to protect the queue
// state.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (INPUT)
// Handle to the queue where events are to be enabled
//
// eventTypeFlags: (INPUT)
// This field specifies the event types to be enabled
// For example: To enable migration events and memory violations:
// pass "UVM_EVENT_ENABLE_MEMORY_VIOLATION |UVM_EVENT_ENABLE_MIGRATION"
// as flags
//
// Error codes:
// RM_ERR_NOT_PERMITTED:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
// NV_ERR_PID_NOT_FOUND:
// this call is made after the target process dies
//
// NV_ERR_BUSY_RETRY:
// internal resources are blocked by other threads.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventDisable(UvmDebugSession sessionHandle,
UvmEventQueueHandle queueHandle,
unsigned eventTypeFlags);
//------------------------------------------------------------------------------
// UvmEventWaitOnQueueHandles
//
// User is notified when queueEntries >= notification count.
// This call does a blocking wait for this notification. It returns when
// at least one of the queue handles has events to be fetched or if it timeouts
//
// This API accesses constant data maintained in the queue state. Hence,
// the user doesn't need to acquire a lock to protect the queue state.
//
// Arguments:
// queueHandles: (INPUT)
// array of queue handles.
//
// arraySize: (INPUT)
// number of handles in array.
//
// timeout: (INPUT)
// timeout in msec
//
// pNotificationFlags: (OUTPUT)
// If a particular queue handle in the input array is notified then
// the respective bit flag is set in pNotificationFlags.
//
// Error codes:
// NV_ERR_INVALID_ARGUMENT:
// one of the queueHandles is invalid.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventWaitOnQueueHandles(UvmEventQueueHandle *queueHandleArray,
unsigned arraySize,
NvU64 timeout,
unsigned *pNotificationFlags);
//------------------------------------------------------------------------------
// UvmEventGetNotificationHandles
//
// User is notified when queueEntries >= notification count.
// The user can directly get the queue notification handles rather than using
// a UVM API to wait on queue handles. This helps the user to wait on other
// objects (apart from queue notification) along with queue notification
// handles in the same thread. The user can safely use this call along with the
// library supported wait call UvmEventWaitOnQueueHandles.
//
// This API reads constant data maintained in the queue state. Hence,
// the user doesn't need to acquire a lock to protect the queue state.
//
// Arguments:
// queueHandles: (INPUT)
// array of queue handles.
//
// arraySize: (INPUT)
// number of handles in array.
//
// notificationHandles: (OUTPUT)
// Windows: Output of this call contains an array of 'windows event
// handles' corresponding to the queue handles passes as input.
// Linux: All queues belonging to the same process share the same
// file descriptor(fd) for notification. If the user chooses to use
// UvmEventGetNotificationHandles then he should check all queues
// for new events (by calling UvmEventFetch) when notified on
// the fd.
//
// Error codes:
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventGetNotificationHandles(UvmEventQueueHandle *queueHandleArray,
unsigned arraySize,
void **notificationHandleArray);
//------------------------------------------------------------------------------
// UvmEventGetGpuUuidTable
//
// Each migration event entry contains the gpu index to/from where data is
// migrated. This index maps to a corresponding physical gpu UUID in the
// gpuUuidTable. Using indices saves on the size of each event entry. This API
// provides the gpuIndex to gpuUuid relation to the user.
//
// This API does not access the queue state maintained in the user
// library and so the user doesn't need to acquire a lock to protect the
// queue state.
//
// Arguments:
// gpuUuidTable: (OUTPUT)
// The return value is an array of physical GPU UUIDs. The array index
// is the corresponding gpuIndex. There can be at max 32 GPUs
// associated with UVM, so array size is 32.
//
// validCount: (OUTPUT)
// The system doesn't normally contain 32 GPUs. This field gives the
// count of entries that are valid in the returned gpuUuidTable.
//
// Error codes:
// NV_ERR_BUSY_RETRY:
// internal resources are blocked by other threads.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventGetGpuUuidTable(NvProcessorUuid *gpuUuidTable,
unsigned *validCount);
//------------------------------------------------------------------------------
// UvmEventFetch
//
// This call is used to fetch the queue entries in a user buffer.
//
// This API updates the queue state. Hence simultaneous calls to fetch/skip
// events should be avoided as that might corrupt the queue state.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (INPUT)
// queue from where to fetch the events.
//
// pBuffer: (OUTPUT)
// Pointer to the buffer where the API will copy the events. User
// shall ensure the size is enough.
//
// nEntries: (INPUT/OUTPUT)
// It provides the maximum number of entries that will be fetched
// from the queue. If this number is larger than the size of the
// queue it will be internally capped to that value.
// As output it returns the actual number of entries copies to the
// buffer.
//
// Error codes:
// RM_ERR_NOT_PERMITTED:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
// NV_ERR_INVALID_INDEX:
// The indices of the queue have been corrupted.
//
// NV_ERR_BUFFER_TOO_SMALL:
// The event queue buffer provided by the caller was too small to
// contain all of the events that occurred during this run.
// Events were therefore dropped (not recorded).
// Please re-run with a larger buffer.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventFetch(UvmDebugSession sessionHandle,
UvmEventQueueHandle queueHandle,
UvmEventEntry *pBuffer,
NvU64 *nEntries);
//------------------------------------------------------------------------------
// UvmEventSkipAll
//
// This API drops all event entries from the queue.
//
// This API updates the queue state. Hence simultaneous calls to fetch/
// skip events should be avoided as that might corrupt the queue state.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (INPUT)
// target queue.
//
// Error codes:
// RM_ERR_NOT_PERMITTED:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventSkipAll(UvmDebugSession sessionHandle,
UvmEventQueueHandle queueHandle);
//------------------------------------------------------------------------------
// UvmEventQueryTimeStampType
//
// This API returns the type of time stamp used in an event entry for a given
// queue.
//
// This API reads constant data maintained in the queue state. Hence,
// the user doesn't need to acquire a lock to protect the queue state.
//
// Arguments:
// sessionHandle: (INPUT)
// Handle to the debugging session.
//
// queueHandle: (INPUT)
// target queue.
//
// timeStampType: (OUTPUT)
// type of time stamp used in event entry. See UvmEventTimestampType
// for supported types of time stamps.
//
// Error codes:
// RM_ERR_NOT_PERMITTED:
// Function fails the security check.
//
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
//------------------------------------------------------------------------------
NV_STATUS UvmEventQueryTimeStampType(UvmDebugSession sessionHandle,
UvmEventQueueHandle queueHandle,
UvmEventTimeStampType *timeStampType);
//------------------------------------------------------------------------------
// UvmDebugAccessMemory
//
// This call can be used by the debugger to read/write memory range. UVM driver
// may not be aware of all the pages in this range. A bit per page is set by the
// driver if it is read/written by UVM.
//
// Arguments:
// session: (INPUT)
// Handle to the debugging session.
//
// baseAddress: (INPUT)
// base address from where memory is to be accessed
//
// sizeInBytes: (INPUT)
// Number of bytes to be accessed
//
// accessType: (INPUT)
// Read or write access request
//
// buffer: (INPUT/OUTPUT)
// This buffer would be read or written to by the driver.
// User needs to allocate a big enough buffer to fit sizeInBytes.
//
// isBitmaskSet: (INPUT/OUTPUT)
// Set to 1, if any field in bitmask is set
// NULL(INPUT) if unused
//
// bitmask: (INPUT/OUTPUT)
// One bit per page is set if UVM reads or writes to it.
// User should allocate a bitmask big enough to fit one bit per page
// covered by baseAddress + sizeInBytes:
// (baseAlignmentBytes + sizeInBytes + pageSize - 1)/pageSize number
// of bits.
// NULL(IN) if unused.
//
// Error codes:
// NV_ERR_INVALID_ARGUMENT:
// One of the arguments is invalid.
//
//------------------------------------------------------------------------------
NV_STATUS UvmDebugAccessMemory(UvmDebugSession session,
void *baseAddress,
NvU64 sizeInBytes,
UvmDebugAccessType accessType,
void *buffer,
NvBool *isBitmaskSet,
NvU64 *bitmask);
//
// Uvm Tools uvm API
//
//------------------------------------------------------------------------------
// UvmToolsCreateSession
//