dr_reconconfig 系统调用

用途

确定该 DLPAR 请求的性质。

语法

#include <sys/dr.h>

int dr_reconfig (flags, dr_info)
int flags;
dr_info_t *dr_info;

描述

dr_reconconfig 系统调用由 DLPAR 感知应用程序使用,以调整其与 DLPAR 请求相关的资源使用情况。 通过 SIGRECONFIG 信号通知应用程序有关使用情况的信息,该信号针对每个 DLPAR 事件生成三次。

第一次是与应用程序一起检查 DLPAR 事件是否应该继续。 使用 DR_EVENT_FAIL 标志时,如果操作不是 DLPAR 安全的,并且它的操作被认为对系统至关重要,那么应用程序可以指示该操作应该异常终止。

在添加或移除资源之前第二次通知该应用程序,之后第三次通知该应用程序。 应用程序必须尝试控制其调度优先级和策略,以保证及时传递信号。 系统不保证发送的每一个信号都是在推进到算法的下一步之前传递出来的。

还可以使用 dr_reconconfig 系统调用向应用程序通知它们正在运行的对 工作负载分区 所作的更改。 应用程序会收到有关 CPU ,内存容量和资源集的更改的通知。

dr_reconconfig 接口是信号处理程序安全的,并且可以由多线程程序使用。

dr_info 结构是在应用程序的地址空间内声明的。 内核在此结构中填充与当前 DLPAR 请求相关的数据。 当使用 DR_RECONFIG_DONE 标志时,用户将标识当前 DLPAR 请求的此结构作为一个参数传递给内核。 应用程序使用 DR_RECONFIG_DONE 标志来通知内核,响应发送给它们的 SIGRECONFIG 信号,已执行必要的操作来调整它们对资源的使用。 预期与 SIGRECONFIG 信号关联的信号处理程序将使用 DR_QUERY 标志来调用接口以标识 DLPAR 事件的阶段,执行相应的操作,并使用 DR_RECONFIG_DONE 标志来调用接口以向内核指示已处理该信号。 在每个 DLPAR 阶段中,对内核的此类应答使 DLPAR 事件能够高效执行。

通过在dr_info结构中添加新字段,DR 感知应用程序可以支持Micro-Partitioning®功能。

仅当请求要除去 cpu 时,才会设置 宾德进程软交换硬设置 位。 如果设置了 宾德进程 ,那么该进程或其某个线程将具有 绑定处理器 连接,必须解析该连接。 如果设置了 软交换 位,那么进程具有工作负载管理器 (WLM) 连接,可以通过调用相应的 WLM 接口或调用相应的 WLM 命令来更改此连接。 如果设置了 硬设置 位,那么必须使用相应的 普塞 API。
注: 布普卢普 字段标识要移除的 cpu ,并且不一定指示进程具有必须解析的依赖关系。 提供 宾德进程软交换硬设置 位是为了实现此目的。

仅当请求要除去内存,并且进程具有 普洛克 内存或连接到固定共享内存段时,才会设置 普洛克普什姆 位。 如果设置了 普洛克 位,那么进程将调用普洛克 以取消置顶自身。 如果设置了 普什姆 位,那么应用程序已锁定共享内存段,可能需要将这些段拆离。 在任何情况下,如果系统中有足够的可锁定内存,那么内存移除请求都可以成功,因此在此情况下不一定需要执行操作。 字段 sys_pinnable_frames 提供此信息,但是,此值和其他统计值仅为近似值。 它们反映了系统在请求时的状态。 在请求期间不会更新这些文件。 物理内存的当前大小可以通过引用 _system_configuration.physmem 字段来确定。

为了提供对与虚拟实内存相关的 DR 操作的支持,已将新字段 dr_op添加到 dr_info 结构中。 dr_op 字段提供有关当前 DR 操作的信息。 此外,所有将来的 DR 操作都使用此字段,并且先前使用的资源位将不再扩展。

dr_wlm_info 结构

typedef struct dr_wlm_info {
		unsigned int cpu_add : 1; // cpu wlm resource add for the WPAR
		unsigned int cpu_rem : 1; // cpu wlm resource remove for the WPAR
		unsigned int mem_add : 1; // memory wlm resource add for the WPAR
		unsigned int mem_rem : 1; // memory wlm resource remove for the WPAR
		unsigned int rs_cpu  : 1; // wlm cpu rset change for the WPAR
		unsigned int rs_mem  : 1; // wlm memory rset change for the WPAR
		unsigned int pad1    : 2; // un-used 
		unsigned int cpu_cap : 8; // percentage of cpu capacity of the WPAR
		unsigned int mem_cap : 8; // percentage of the memory capacity of the WPAR
		unsigned int pad2    : 8; // un-used 
} dr_wlm_info_t;

dr_info 结构

typedef struct dr_info {
	 unsigned int add : 1;	// add request
	              rem : 1;	// remove request
	              cpu : 1;	// target resource is a cpu
	              mem : 1;	// target resource is memory
	            check : 1;	// check phase in effect
	              pre : 1;	// pre phase in effect
	             post : 1;	// post phase in effect
	        posterror : 1;	// post error phase in effect
	            force : 1;	// force option is in effect
	         bindproc : 1;	// process has bindprocessor dependency
	         softpset : 1;	// process has WLM software partition dependency
	         hardpset : 1;	// process has processor set API dependency
	            plock : 1;	// process has plock'd memory
	             pshm : 1;	// process has pinned shared memory
	          ent_cap : 1;	// target resource:entitled capacity
	          var_wgt : 1;	// target resource:variable weight
	   splpar_capable : 1;	// 1/0 partition is/not splpar capable
	    splpar_shared : 1;	// 1/0 partition shared/dedicated mode
	    splpar_capped : 1;	// 1/0 partition capped/uncapped mode
       splpar_constrained : 1;  // Set to 1 if requested capacity
	                           update is constrained by PHYP to
	                           be within partition capacity bounds.
	                        // 

    unsigned int migrate : 1;    // migration operation
    unsigned int hibernate : 1;    // hibernation operation
    unsigned int partition : 1;    // resource is partition
    unsigned int topology_update : 1;	// topology update

    // The following fields are filled out for cpu based requests
    int lcpu;			// logical cpu ID being added or removed
    int bcpu;			// bind cpu ID being added or removed

    // The following fields are filled out for memory based requests
    size64_t  req_memsz_change;     // User request size in bytes            
    size64_t  sys_memsz;            // System Memory size at time of request 
    rpn64_t   sys_free_frames;      // Number of free frames in the system
    rpn64_t   sys_pinnable_frames;  // Number of pinnable frames in system
    rpn64_t   sys_total_frames;     // Total number of frames in system 


    // SPLPAR parameters.
    uint64_t  capacity;			// partition current entitled capacity
                                           if ent_cap bit is set, partition's
                                           current variable capacity weight
                                           if var_wgt bit is set.
                                        // 

    int	  delta_cap;		   	// delta capacity added/removed to
                                           current value depending on add/rem
                                           bit flag value above
                                        // 
    dr_wlm_info_t   dr_wlm;     // DR info for the WPAR    
    ushort	    dr_op;	 // type of DR operation

    ushort	    dr_pad;     // reserved pad field
    size64_t	    mem_capacity; // partition’s entitled 
I/O memory or variable capacity.
    ssize64_t   delta_mem_capacity; // amount of I/O being added/removed

    int  reserved[2];

} dr_info_t;

参数

描述
标志 支持下列值:
DR_QUERY
标识当前 DLPAR 请求以及应用程序为符合当前 DLPAR 请求而必须执行的操作。 此信息将以 dr_info 参数所标识的结构返回给调用者。
DR_EVENT_FAIL
使当前 DLPAR 事件失败。 根权限是必需的。
DR_RECONFIG_DONE
此标志与 DR_QUERY 标志一起使用。 应用程序通知内核,它为了符合当前 DLPAR 请求而执行的操作现在已完成。 标识返回的 DLPAR 请求的 dr_info 结构将作为输入参数进行传递。
dr_info 包含 dr_info 结构的地址,此结构是使用应用程序的地址空间声明的。

返回值

成功后, dr_reconconfig 系统调用将返回零。 如果不成功,它将返回负变量,并将 错误号 变量设置为适当的错误值。

错误代码

描述
EINVAL 标志无效。
ENXIO 没有正在进行的 DLPAR 事件。
EPERM DR_EVENT_FAIL 需要 root 用户权限。
EINPROGRESS 可能只有在检查阶段才会取消 DLPAR 事件。