Commit 3269b3cc authored by Cédric Dufour's avatar Cédric Dufour

New upstream version 410.93

parent a68f1cba
......@@ -73,10 +73,6 @@ COMMON_UTILS_DIR ?= common-utils
# include the list of source files; defines SRC
include dist-files.mk
# $(STAMP_C) defines the version string generated by utils.mk, containing
# information about the build environment.
SRC += $(STAMP_C)
include $(COMMON_UTILS_DIR)/src.mk
SRC += $(addprefix $(COMMON_UTILS_DIR)/,$(COMMON_UTILS_SRC))
......@@ -129,12 +125,8 @@ $(NVIDIA_PERSISTENCED).unstripped: $(OBJS)
# define the rule to build each object file
$(foreach src, $(SRC), $(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
# define the rule to generate $(STAMP_C)
$(eval $(call DEFINE_STAMP_C_RULE, \
$(OBJS),$(NVIDIA_PERSISTENCED_PROGRAM_NAME)))
clean clobber:
$(RM) -rf $(NVIDIA_PERSISTENCED) $(MANPAGE) *~ $(STAMP_C) \
$(RM) -rf $(NVIDIA_PERSISTENCED) $(MANPAGE) *~ \
$(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d \
$(GEN_MANPAGE_OPTS) $(OPTIONS_1_INC)
......
......@@ -68,3 +68,41 @@ GetPersistenceModeRes* nvpdgetpersistencemode_1_svc(GetPersistenceModeArgs *args
return &result;
}
/*!
* nvpdsetpersistencemodeonly_2_svc() - This service is an RPC function
* implementation to set the persistence mode of a specific device
* without affecting the NUMA status of the device.
*/
NvPdStatus* nvpdsetpersistencemodeonly_2_svc(SetPersistenceModeArgs *args,
struct svc_req *req)
{
static NvPdStatus result;
result = nvPdSetDevicePersistenceModeOnly(args->device.domain,
args->device.bus,
args->device.slot,
args->device.function,
args->mode);
return &result;
}
/*!
* nvpdsetnumastatus_2_svc() - This service is an RPC function
* implementation to set the NUMA status of the device.
*/
NvPdStatus* nvpdsetnumastatus_2_svc(SetNumaStatusArgs *args,
struct svc_req *req)
{
static NvPdStatus result;
result = nvPdSetDeviceNumaStatus(args->device.domain,
args->device.bus,
args->device.slot,
args->device.function,
args->status);
return &result;
}
......@@ -132,4 +132,6 @@ typedef enum {
NV_OPTIONAL_BOOL_TRUE = TRUE
} NVOptionalBool;
#define NV_ID_STRING PROGRAM_NAME ": version " NVIDIA_VERSION
#endif /* __COMMON_UTILS_H__ */
......@@ -36,6 +36,7 @@ RPC_SRC += $(RPC_DIR)/nvpd_rpc_xdr.c
SRC += command_server.c
SRC += nvidia-persistenced.c
SRC += options.c
SRC += nvidia-syslog-utils.c
SRC += $(RPC_SRC)
SRC += $(NVIDIA_NUMA_DIR)/nvidia-numa.c
......@@ -53,6 +54,7 @@ DIST_FILES += README
DIST_FILES += dist-files.mk
DIST_FILES += nvpd_defs.h
DIST_FILES += nvidia-persistenced.h
DIST_FILES += nvidia-syslog-utils.h
DIST_FILES += option-table.h
DIST_FILES += nvidia-persistenced.1.m4
DIST_FILES += gen-manpage-opts.c
......
......@@ -380,6 +380,9 @@ NvCfgBool nvCfgIsPrimaryDevice(NvCfgDeviceHandle handle,
* responsibility to free the returned array of strings. On success,
* NVCFG_TRUE will be returned and serials will be assigned. On failure,
* NVCFG_FALSE will be returned.
*
* Note that this function is deprecated and will always return an empty array
* on recent drivers, since QuadroPlex devices are no longer supported.
*/
NvCfgBool nvCfgGetTeslaSerialNumbers(char ***serials);
......@@ -442,4 +445,12 @@ NvCfgBool nvCfgFlashGSyncDevice(NvCfgGSyncHandle handle, int format,
const unsigned char *newFirmwareImage,
int size);
/*
* nvCfgDumpDisplayPortAuxLog() - dump the DisplayPort AUX channel log to the
* system log. On success, NVCFG_TRUE will be returned. On failure, NVCFG_FALSE
* will be returned.
*/
NvCfgBool nvCfgDumpDisplayPortAuxLog(NvCfgDeviceHandle handle);
#endif /* __NVIDIA_CFG__ */
This diff is collapsed.
......@@ -24,8 +24,11 @@
#define _NV_GPU_NUMA_H_
#include "nvpd_rpc.h"
#include "nvidia-syslog-utils.h"
typedef enum
#define NV_IOCTL_NUMA_INFO_MAX_BLACKLIST_ADDRESSES 64
typedef enum
{
NV_IOCTL_NUMA_STATUS_DISABLED = 0,
NV_IOCTL_NUMA_STATUS_OFFLINE = 1,
......@@ -42,6 +45,13 @@ typedef struct nv_ioctl_sys_params
uint64_t memblock_size;
} nv_ioctl_sys_params_t;
/* list of device blacklisted addresses */
typedef struct blacklist_addresses
{
uint64_t addresses[NV_IOCTL_NUMA_INFO_MAX_BLACKLIST_ADDRESSES];
uint32_t numEntries;
} nv_blacklist_addresses_t;
/* per-device NUMA memory info as assigned by the system */
typedef struct nv_ioctl_numa_info
{
......@@ -50,6 +60,7 @@ typedef struct nv_ioctl_numa_info
uint64_t memblock_size;
uint64_t numa_mem_addr;
uint64_t numa_mem_size;
nv_blacklist_addresses_t blacklist_addresses;
} nv_ioctl_numa_info_t;
/* set the status of the device NUMA memory */
......@@ -58,8 +69,15 @@ typedef struct nv_ioctl_set_numa_status
int status;
} nv_ioctl_set_numa_status_t;
NvPdStatus nvNumaOnlineMemory(int domain, int bus, int slot, int function);
/* per-device NUMA context */
typedef struct
{
int fd;
NvCfgPciDevice *pci_info;
} NvNumaDevice;
NvPdStatus nvNumaOnlineMemory(NvNumaDevice *numa_info);
NvPdStatus nvNumaOfflineMemory(int domain, int bus, int slot, int function);
NvPdStatus nvNumaOfflineMemory(NvNumaDevice *numa_info);
#endif
This diff is collapsed.
......@@ -47,9 +47,15 @@ NvPdStatus nvPdSetDevicePersistenceMode(int domain, int bus, int slot,
NvPdStatus nvPdGetDevicePersistenceMode(int domain, int bus, int slot,
int function,
NvPersistenceMode *mode);
NvPdStatus nvPdSetDevicePersistenceModeOnly(int domain, int bus, int slot,
int function,
NvPersistenceMode mode);
NvPdStatus nvPdSetDeviceNumaStatus(int domain, int bus, int slot,
int function, NvNumaStatus status);
/* RPC Service Routine */
/* RPC Service Routines */
extern void nvpd_prog_1(struct svc_req *rqstp, register SVCXPRT *transp);
extern void nvpd_prog_2(struct svc_req *rqstp, register SVCXPRT *transp);
/* Commandline Parsing */
extern void parse_options(int argc, char *argv[], NvPdOptions *);
......
/*
* Copyright (c) 2017, NVIDIA CORPORATION.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file provides utility functions for logging messages through
* syslog
*/
#include "nvidia-syslog-utils.h"
int verbose = 0;
int log_mask = 0;
/*
* syslog_device() - This function prints the device info along with the
* specified message to syslog. If there is a failure to allocate memory along
* the way, it will simply fail with an error to syslog().
*/
void syslog_device(NvCfgPciDevice *device_pci_info, int priority,
const char *format, ...)
{
char *device_str = NULL;
char *str = NULL;
/* First check if this message will even show up. */
if ((log_mask & priority) == 0) {
return;
}
/* First fill in the format string as usual. */
NV_VSNPRINTF(str, format);
if (str == NULL) {
syslog(LOG_ERR, "Failed to create formatted message.");
return;
}
/* Then prefix it with the device info. */
device_str = nvasprintf("device %04x:%02x:%02x.%x - %s",
device_pci_info->domain, device_pci_info->bus,
device_pci_info->slot, device_pci_info->function,
str);
nvfree(str);
if (device_str == NULL) {
syslog(LOG_ERR, "Failed to create device message.");
return;
}
syslog(priority, "%s", device_str);
nvfree(device_str);
}
/*
* Copyright (c) 2017, NVIDIA CORPORATION.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* This file provides utility functions for logging messages through
* syslog
*/
#ifndef _NVIDIA_SYSLOG_UTILS_H_
#define _NVIDIA_SYSLOG_UTILS_H_
#include <syslog.h>
#include "common-utils.h"
#include "nvidia-cfg.h"
extern int verbose;
extern int log_mask;
void syslog_device(NvCfgPciDevice *device_pci_info, int priority,
const char *format, ...);
#define SYSLOG_DEVICE_VERBOSE(device, priority, format, ...) do { \
if (verbose) \
syslog_device(device, priority, format, ##__VA_ARGS__); \
} while(0)
#define SYSLOG_VERBOSE(priority, format, ...) do { \
if (verbose) \
syslog(priority, format, ##__VA_ARGS__); \
} while(0)
#endif /* _NVIDIA_SYSLOG_UTILS_H_ */
......@@ -63,6 +63,18 @@ struct GetPersistenceModeRes {
};
typedef struct GetPersistenceModeRes GetPersistenceModeRes;
enum NvNumaStatus {
NV_NUMA_STATUS_OFFLINE = 0,
NV_NUMA_STATUS_ONLINE = 1,
};
typedef enum NvNumaStatus NvNumaStatus;
struct SetNumaStatusArgs {
NvPciDevice device;
NvNumaStatus status;
};
typedef struct SetNumaStatusArgs SetNumaStatusArgs;
#define NVPD_PROG 35006
#define VersionOne 1
......@@ -84,6 +96,26 @@ extern GetPersistenceModeRes * nvpdgetpersistencemode_1();
extern GetPersistenceModeRes * nvpdgetpersistencemode_1_svc();
extern int nvpd_prog_1_freeresult ();
#endif /* K&R C */
#define VersionTwo 2
#if defined(__STDC__) || defined(__cplusplus)
#define nvPdSetPersistenceModeOnly 1
extern NvPdStatus * nvpdsetpersistencemodeonly_2(SetPersistenceModeArgs *, CLIENT *);
extern NvPdStatus * nvpdsetpersistencemodeonly_2_svc(SetPersistenceModeArgs *, struct svc_req *);
#define nvPdSetNumaStatus 2
extern NvPdStatus * nvpdsetnumastatus_2(SetNumaStatusArgs *, CLIENT *);
extern NvPdStatus * nvpdsetnumastatus_2_svc(SetNumaStatusArgs *, struct svc_req *);
extern int nvpd_prog_2_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
#else /* K&R C */
#define nvPdSetPersistenceModeOnly 1
extern NvPdStatus * nvpdsetpersistencemodeonly_2();
extern NvPdStatus * nvpdsetpersistencemodeonly_2_svc();
#define nvPdSetNumaStatus 2
extern NvPdStatus * nvpdsetnumastatus_2();
extern NvPdStatus * nvpdsetnumastatus_2_svc();
extern int nvpd_prog_2_freeresult ();
#endif /* K&R C */
/* the xdr functions */
......@@ -94,6 +126,8 @@ extern bool_t xdr_NvPersistenceMode (XDR *, NvPersistenceMode*);
extern bool_t xdr_SetPersistenceModeArgs (XDR *, SetPersistenceModeArgs*);
extern bool_t xdr_GetPersistenceModeArgs (XDR *, GetPersistenceModeArgs*);
extern bool_t xdr_GetPersistenceModeRes (XDR *, GetPersistenceModeRes*);
extern bool_t xdr_NvNumaStatus (XDR *, NvNumaStatus*);
extern bool_t xdr_SetNumaStatusArgs (XDR *, SetNumaStatusArgs*);
#else /* K&R C */
extern bool_t xdr_NvPdStatus ();
......@@ -102,6 +136,8 @@ extern bool_t xdr_NvPersistenceMode ();
extern bool_t xdr_SetPersistenceModeArgs ();
extern bool_t xdr_GetPersistenceModeArgs ();
extern bool_t xdr_GetPersistenceModeRes ();
extern bool_t xdr_NvNumaStatus ();
extern bool_t xdr_SetNumaStatusArgs ();
#endif /* K&R C */
......
......@@ -66,3 +66,51 @@ nvpd_prog_1(struct svc_req *rqstp, register SVCXPRT *transp)
}
return;
}
void
nvpd_prog_2(struct svc_req *rqstp, register SVCXPRT *transp)
{
union {
SetPersistenceModeArgs nvpdsetpersistencemodeonly_2_arg;
SetNumaStatusArgs nvpdsetnumastatus_2_arg;
} argument;
char *result;
xdrproc_t _xdr_argument, _xdr_result;
char *(*local)(char *, struct svc_req *);
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
return;
case nvPdSetPersistenceModeOnly:
_xdr_argument = (xdrproc_t) xdr_SetPersistenceModeArgs;
_xdr_result = (xdrproc_t) xdr_NvPdStatus;
local = (char *(*)(char *, struct svc_req *)) nvpdsetpersistencemodeonly_2_svc;
break;
case nvPdSetNumaStatus:
_xdr_argument = (xdrproc_t) xdr_SetNumaStatusArgs;
_xdr_result = (xdrproc_t) xdr_NvPdStatus;
local = (char *(*)(char *, struct svc_req *)) nvpdsetnumastatus_2_svc;
break;
default:
svcerr_noproc (transp);
return;
}
memset ((char *)&argument, 0, sizeof (argument));
if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
svcerr_decode (transp);
return;
}
result = (*local)((char *)&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
svcerr_systemerr (transp);
}
if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
syslog (LOG_ERR, "%s", "unable to free arguments");
exit (1);
}
return;
}
......@@ -68,3 +68,21 @@ xdr_GetPersistenceModeRes (XDR *xdrs, GetPersistenceModeRes *objp)
}
return TRUE;
}
bool_t
xdr_NvNumaStatus (XDR *xdrs, NvNumaStatus *objp)
{
if (!xdr_enum (xdrs, (enum_t *) objp))
return FALSE;
return TRUE;
}
bool_t
xdr_SetNumaStatusArgs (XDR *xdrs, SetNumaStatusArgs *objp)
{
if (!xdr_NvPciDevice (xdrs, &objp->device))
return FALSE;
if (!xdr_NvNumaStatus (xdrs, &objp->status))
return FALSE;
return TRUE;
}
......@@ -66,7 +66,22 @@ static const NVGetoptOption __options[] = {
"specified by the &USERNAME& argument. This user must have write access "
"to the /var/run/nvidia-persistenced directory. If this directory does "
"not exist, nvidia-persistenced will attempt to create it prior to "
"changing the process user and group IDs." },
"changing the process user and group IDs. "
"If this option is not given, nvidia-persistenced will not attempt "
"to change the process user ID." },
{ "group",
'g',
NVGETOPT_STRING_ARGUMENT | NVGETOPT_HELP_ALWAYS,
"GROUPNAME",
"Runs nvidia-persistenced with the group permissions of the group "
"specified by the &GROUPNAME& argument. "
"If both this option and the --user option are given, this option "
"will take precedence when determining the group ID to use. "
"If this option is not given, nvidia-persistenced will use the "
"primary group ID of the user specified by the --user option argument. "
"If the --user option is also not given, nvidia-persistenced will not "
"attempt to change the process group ID." },
{ "persistence-mode",
PERSISTENCE_MODE_OPTION,
......
......@@ -2,7 +2,7 @@
* nvidia-persistenced: A daemon for maintaining persistent driver state,
* specifically for use by the NVIDIA Linux driver.
*
* Copyright (C) 2013-2016 NVIDIA Corporation
* Copyright (C) 2013-2018 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
......@@ -26,6 +26,7 @@
*/
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
......@@ -42,22 +43,20 @@
#define TAB " "
#define BIGTAB " "
extern const char *pNV_ID;
/*
* print_version() - print basic version information about the utility.
*/
static void print_version(void)
{
nv_info_msg(NULL, "");
nv_info_msg(NULL, "%s", pNV_ID);
nv_info_msg(NULL, "%s", NV_ID_STRING);
nv_info_msg(NULL, "");
nv_info_msg(TAB, "The NVIDIA Persistence Daemon.");
nv_info_msg(NULL, "");
nv_info_msg(TAB, "A tool for maintaining persistent driver state, "
"specifically for use by the NVIDIA Linux driver.");
nv_info_msg(NULL, "");
nv_info_msg(TAB, "Copyright (C) 2013-2016 NVIDIA Corporation.");
nv_info_msg(TAB, "Copyright (C) 2013-2018 NVIDIA Corporation.");
nv_info_msg(NULL, "");
}
......@@ -115,6 +114,8 @@ void parse_options(int argc, char *argv[], NvPdOptions *options)
int boolval;
char *strval;
struct passwd *pw_entry;
struct group *gr_entry;
int group_specified = 0;
setup_option_defaults(options);
......@@ -145,12 +146,25 @@ void parse_options(int argc, char *argv[], NvPdOptions *options)
case 'u':
pw_entry = getpwnam(strval);
if (pw_entry == NULL) {
nv_error_msg("Failed to find user ID of user '%s': %s", strval,
strerror(errno));
nv_error_msg("Failed to find user ID of user '%s': %s",
strval, strerror(errno));
exit(EXIT_FAILURE);
}
options->uid = pw_entry->pw_uid;
options->gid = pw_entry->pw_gid;
if (!group_specified) {
options->gid = pw_entry->pw_gid;
}
break;
case 'g':
gr_entry = getgrnam(strval);
if (gr_entry == NULL) {
nv_error_msg("Failed to find group ID of group '%s': %s",
strval, strerror(errno));
exit(EXIT_FAILURE);
}
/* overrides the gid from the -u option, if already given */
options->gid = gr_entry->gr_gid;
group_specified = 1;
break;
case PERSISTENCE_MODE_OPTION:
if (boolval) {
......
......@@ -74,9 +74,7 @@ PRINTF ?= printf
MKDIR ?= mkdir -p
RM ?= rm -f
TOUCH ?= touch
WHOAMI ?= whoami
HARDLINK ?= ln -f
HOSTNAME_CMD ?= hostname
DATE ?= date
GZIP_CMD ?= gzip
CHMOD ?= chmod
......@@ -214,6 +212,8 @@ ifndef NVIDIA_VERSION
$(error NVIDIA_VERSION undefined)
endif
CFLAGS += -DNVIDIA_VERSION=\"$(NVIDIA_VERSION)\"
##############################################################################
# Several of the functions below take an argument that indicates if
......@@ -424,37 +424,6 @@ define DEBUG_INFO_RULES
endif
endef
##############################################################################
# STAMP_C - this is a source file that is generated during the build
# to capture information about the build environment for the utility.
#
# The DEFINE_STAMP_C_RULE function is used to define the rule for
# generating STAMP_C. First argument is a list of dependencies for
# STAMP_C (g_stamp.o is filtered out of the list); second argument is
# the name of the program being built.
#
# The includer of utils.mk should add $(STAMP_C) to its list of source
# files
##############################################################################
STAMP_C = $(OUTPUTDIR)/g_stamp.c
define DEFINE_STAMP_C_RULE
$$(STAMP_C): $$(filter-out \
$$(call BUILD_OBJECT_LIST,$$(STAMP_C)),$(1)) \
$$(VERSION_MK)
@ $$(RM) $$@
@ $$(PRINTF) "%s" "const char NV_ID[] = \"nvidia id: " >> $$@
@ $$(PRINTF) "%s" "$(2): " >> $$@
@ $$(PRINTF) "%s" "version $$(NVIDIA_VERSION) " >> $$@
@ $$(PRINTF) "%s" "($$(shell $$(WHOAMI))" >> $$@
@ $$(PRINTF) "%s" "@$$(shell $$(HOSTNAME_CMD))) " >> $$@
@ $$(PRINTF) "%s\n" "$$(shell $(DATE))\";" >> $$@
@ $$(PRINTF) "%s\n" "const char *pNV_ID = NV_ID + 11;" >> $$@
endef
##############################################################################
# Define rules that can be used for embedding a file into an ELF object that
# contains the raw contents of that file and symbols pointing to the embedded
......
NVIDIA_VERSION = 390.25
NVIDIA_VERSION = 410.93
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment