• A
    mm: Define coherent device memory (CDM) node · 4cda25d3
    Anshuman Khandual 提交于
    ascend inclusion
    category: feature
    bugzilla: https://gitee.com/openeuler/kernel/issues/I4JMLR
    CVE: NA
    -------------------
    
    There are certain devices like specialized accelerator, GPU cards, network
    cards, FPGA cards etc which might contain onboard memory which is coherent
    along with the existing system RAM while being accessed either from the CPU
    or from the device. They share some similar properties with that of normal
    system RAM but at the same time can also be different with respect to
    system RAM.
    
    User applications might be interested in using this kind of coherent device
    memory explicitly or implicitly along side the system RAM utilizing all
    possible core memory functions like anon mapping (LRU), file mapping (LRU),
    page cache (LRU), driver managed (non LRU), HW poisoning, NUMA migrations
    etc. To achieve this kind of tight integration with core memory subsystem,
    the device onboard coherent memory must be represented as a memory only
    NUMA node. At the same time arch must export some kind of a function to
    identify of this node as a coherent device memory not any other regular
    cpu less memory only NUMA node.
    
    After achieving the integration with core memory subsystem coherent device
    memory might still need some special consideration inside the kernel. There
    can be a variety of coherent memory nodes with different expectations from
    the core kernel memory. But right now only one kind of special treatment is
    considered which requires certain isolation.
    
    Now consider the case of a coherent device memory node type which requires
    isolation. This kind of coherent memory is onboard an external device
    attached to the system through a link where there is always a chance of a
    link failure taking down the entire memory node with it. More over the
    memory might also have higher chance of ECC failure as compared to the
    system RAM. Hence allocation into this kind of coherent memory node should
    be regulated. Kernel allocations must not come here. Normal user space
    allocations too should not come here implicitly (without user application
    knowing about it). This summarizes isolation requirement of certain kind of
    coherent device memory node as an example. There can be different kinds of
    isolation requirement also.
    
    Some coherent memory devices might not require isolation altogether after
    all. Then there might be other coherent memory devices which might require
    some other special treatment after being part of core memory representation
    . For now, will look into isolation seeking coherent device memory node not
    the other ones.
    
    To implement the integration as well as isolation, the coherent memory node
    must be present in N_MEMORY and a new N_COHERENT_DEVICE node mask inside
    the node_states[] array. During memory hotplug operations, the new nodemask
    N_COHERENT_DEVICE is updated along with N_MEMORY for these coherent device
    memory nodes. This also creates the following new sysfs based interface to
    list down all the coherent memory nodes of the system.
    
    	/sys/devices/system/node/is_cdm_node
    
    Architectures must export function arch_check_node_cdm() which identifies
    any coherent device memory node in case they enable CONFIG_COHERENT_DEVICE.
    Signed-off-by: NAnshuman Khandual <khandual@linux.vnet.ibm.com>
    Signed-off-by: NLijun Fang <fanglijun3@huawei.com>
    Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    4cda25d3
Kconfig 30.1 KB