1 ============================================== 1 ============================================================================== 2 NUMA binding description. 2 NUMA binding description. 3 ============================================== 3 ============================================================================== 4 4 5 ============================================== 5 ============================================================================== 6 1 - Introduction 6 1 - Introduction 7 ============================================== 7 ============================================================================== 8 8 9 Systems employing a Non Uniform Memory Access 9 Systems employing a Non Uniform Memory Access (NUMA) architecture contain 10 collections of hardware resources including pr 10 collections of hardware resources including processors, memory, and I/O buses, 11 that comprise what is commonly known as a NUMA 11 that comprise what is commonly known as a NUMA node. 12 Processor accesses to memory within the local 12 Processor accesses to memory within the local NUMA node is generally faster 13 than processor accesses to memory outside of t 13 than processor accesses to memory outside of the local NUMA node. 14 DT defines interfaces that allow the platform 14 DT defines interfaces that allow the platform to convey NUMA node 15 topology information to OS. 15 topology information to OS. 16 16 17 ============================================== 17 ============================================================================== 18 2 - numa-node-id 18 2 - numa-node-id 19 ============================================== 19 ============================================================================== 20 20 21 For the purpose of identification, each NUMA n 21 For the purpose of identification, each NUMA node is associated with a unique 22 token known as a node id. For the purpose of t 22 token known as a node id. For the purpose of this binding 23 a node id is a 32-bit integer. 23 a node id is a 32-bit integer. 24 24 25 A device node is associated with a NUMA node b 25 A device node is associated with a NUMA node by the presence of a 26 numa-node-id property which contains the node 26 numa-node-id property which contains the node id of the device. 27 27 28 Example: 28 Example: 29 /* numa node 0 */ 29 /* numa node 0 */ 30 numa-node-id = <0>; 30 numa-node-id = <0>; 31 31 32 /* numa node 1 */ 32 /* numa node 1 */ 33 numa-node-id = <1>; 33 numa-node-id = <1>; 34 34 35 ============================================== 35 ============================================================================== 36 3 - distance-map 36 3 - distance-map 37 ============================================== 37 ============================================================================== 38 38 39 The optional device tree node distance-map des 39 The optional device tree node distance-map describes the relative 40 distance (memory latency) between all numa nod 40 distance (memory latency) between all numa nodes. 41 41 42 - compatible : Should at least contain "numa-d 42 - compatible : Should at least contain "numa-distance-map-v1". 43 43 44 - distance-matrix 44 - distance-matrix 45 This property defines a matrix to describe t 45 This property defines a matrix to describe the relative distances 46 between all numa nodes. 46 between all numa nodes. 47 It is represented as a list of node pairs an 47 It is represented as a list of node pairs and their relative distance. 48 48 49 Note: 49 Note: 50 1. Each entry represents distance from 50 1. Each entry represents distance from first node to second node. 51 The distances are equal in either dire 51 The distances are equal in either direction. 52 2. The distance from a node to self (l 52 2. The distance from a node to self (local distance) is represented 53 with value 10 and all internode distan 53 with value 10 and all internode distance should be represented with 54 a value greater than 10. 54 a value greater than 10. 55 3. distance-matrix should have entries 55 3. distance-matrix should have entries in lexicographical ascending 56 order of nodes. 56 order of nodes. 57 4. There must be only one device node 57 4. There must be only one device node distance-map which must 58 reside in the root node. 58 reside in the root node. 59 5. If the distance-map node is not pre 59 5. If the distance-map node is not present, a default 60 distance-matrix is used. 60 distance-matrix is used. 61 61 62 Example: 62 Example: 63 4 nodes connected in mesh/ring topolog 63 4 nodes connected in mesh/ring topology as below, 64 64 65 0_______20______1 65 0_______20______1 66 | | 66 | | 67 | | 67 | | 68 20 20 68 20 20 69 | | 69 | | 70 | | 70 | | 71 |_______________| 71 |_______________| 72 3 20 2 72 3 20 2 73 73 74 if relative distance for each hop is 2 74 if relative distance for each hop is 20, 75 then internode distance would be, 75 then internode distance would be, 76 0 -> 1 = 20 76 0 -> 1 = 20 77 1 -> 2 = 20 77 1 -> 2 = 20 78 2 -> 3 = 20 78 2 -> 3 = 20 79 3 -> 0 = 20 79 3 -> 0 = 20 80 0 -> 2 = 40 80 0 -> 2 = 40 81 1 -> 3 = 40 81 1 -> 3 = 40 82 82 83 and dt presentation for this distance mat 83 and dt presentation for this distance matrix is, 84 84 85 distance-map { 85 distance-map { 86 compatible = "numa-di 86 compatible = "numa-distance-map-v1"; 87 distance-matrix = <0 87 distance-matrix = <0 0 10>, 88 <0 88 <0 1 20>, 89 <0 89 <0 2 40>, 90 <0 90 <0 3 20>, 91 <1 91 <1 0 20>, 92 <1 92 <1 1 10>, 93 <1 93 <1 2 20>, 94 <1 94 <1 3 40>, 95 <2 95 <2 0 40>, 96 <2 96 <2 1 20>, 97 <2 97 <2 2 10>, 98 <2 98 <2 3 20>, 99 <3 99 <3 0 20>, 100 <3 100 <3 1 40>, 101 <3 101 <3 2 20>, 102 <3 102 <3 3 10>; 103 }; 103 }; 104 104 105 ============================================== 105 ============================================================================== 106 4 - Empty memory nodes 106 4 - Empty memory nodes 107 ============================================== 107 ============================================================================== 108 108 109 Empty memory nodes, which no memory resides in 109 Empty memory nodes, which no memory resides in, are allowed. There are no 110 device nodes for these empty memory nodes. How 110 device nodes for these empty memory nodes. However, the NUMA node IDs and 111 distance maps are still valid and memory may b 111 distance maps are still valid and memory may be added into them through 112 hotplug afterwards. 112 hotplug afterwards. 113 113 114 Example: 114 Example: 115 115 116 memory@0 { 116 memory@0 { 117 device_type = "memory"; 117 device_type = "memory"; 118 reg = <0x0 0x0 0x0 0x80000000> 118 reg = <0x0 0x0 0x0 0x80000000>; 119 numa-node-id = <0>; 119 numa-node-id = <0>; 120 }; 120 }; 121 121 122 memory@80000000 { 122 memory@80000000 { 123 device_type = "memory"; 123 device_type = "memory"; 124 reg = <0x0 0x80000000 0x0 0x80 124 reg = <0x0 0x80000000 0x0 0x80000000>; 125 numa-node-id = <1>; 125 numa-node-id = <1>; 126 }; 126 }; 127 127 128 /* Empty memory node 2 and 3 */ 128 /* Empty memory node 2 and 3 */ 129 distance-map { 129 distance-map { 130 compatible = "numa-distance-ma 130 compatible = "numa-distance-map-v1"; 131 distance-matrix = <0 0 10>, 131 distance-matrix = <0 0 10>, 132 <0 1 20>, 132 <0 1 20>, 133 <0 2 40>, 133 <0 2 40>, 134 <0 3 20>, 134 <0 3 20>, 135 <1 0 20>, 135 <1 0 20>, 136 <1 1 10>, 136 <1 1 10>, 137 <1 2 20>, 137 <1 2 20>, 138 <1 3 40>, 138 <1 3 40>, 139 <2 0 40>, 139 <2 0 40>, 140 <2 1 20>, 140 <2 1 20>, 141 <2 2 10>, 141 <2 2 10>, 142 <2 3 20>, 142 <2 3 20>, 143 <3 0 20>, 143 <3 0 20>, 144 <3 1 40>, 144 <3 1 40>, 145 <3 2 20>, 145 <3 2 20>, 146 <3 3 10>; 146 <3 3 10>; 147 }; 147 }; 148 148 149 ============================================== 149 ============================================================================== 150 5 - Example dts 150 5 - Example dts 151 ============================================== 151 ============================================================================== 152 152 153 Dual socket system consists of 2 boards connec 153 Dual socket system consists of 2 boards connected through ccn bus and 154 each board having one socket/soc of 8 cpus, me 154 each board having one socket/soc of 8 cpus, memory and pci bus. 155 155 156 memory@c00000 { 156 memory@c00000 { 157 device_type = "memory"; 157 device_type = "memory"; 158 reg = <0x0 0xc00000 0x0 0x8000 158 reg = <0x0 0xc00000 0x0 0x80000000>; 159 /* node 0 */ 159 /* node 0 */ 160 numa-node-id = <0>; 160 numa-node-id = <0>; 161 }; 161 }; 162 162 163 memory@10000000000 { 163 memory@10000000000 { 164 device_type = "memory"; 164 device_type = "memory"; 165 reg = <0x100 0x0 0x0 0x8000000 165 reg = <0x100 0x0 0x0 0x80000000>; 166 /* node 1 */ 166 /* node 1 */ 167 numa-node-id = <1>; 167 numa-node-id = <1>; 168 }; 168 }; 169 169 170 cpus { 170 cpus { 171 #address-cells = <2>; 171 #address-cells = <2>; 172 #size-cells = <0>; 172 #size-cells = <0>; 173 173 174 cpu@0 { 174 cpu@0 { 175 device_type = "cpu"; 175 device_type = "cpu"; 176 compatible = "arm,arm 176 compatible = "arm,armv8"; 177 reg = <0x0 0x0>; 177 reg = <0x0 0x0>; 178 enable-method = "psci" 178 enable-method = "psci"; 179 /* node 0 */ 179 /* node 0 */ 180 numa-node-id = <0>; 180 numa-node-id = <0>; 181 }; 181 }; 182 cpu@1 { 182 cpu@1 { 183 device_type = "cpu"; 183 device_type = "cpu"; 184 compatible = "arm,arm 184 compatible = "arm,armv8"; 185 reg = <0x0 0x1>; 185 reg = <0x0 0x1>; 186 enable-method = "psci" 186 enable-method = "psci"; 187 numa-node-id = <0>; 187 numa-node-id = <0>; 188 }; 188 }; 189 cpu@2 { 189 cpu@2 { 190 device_type = "cpu"; 190 device_type = "cpu"; 191 compatible = "arm,arm 191 compatible = "arm,armv8"; 192 reg = <0x0 0x2>; 192 reg = <0x0 0x2>; 193 enable-method = "psci" 193 enable-method = "psci"; 194 numa-node-id = <0>; 194 numa-node-id = <0>; 195 }; 195 }; 196 cpu@3 { 196 cpu@3 { 197 device_type = "cpu"; 197 device_type = "cpu"; 198 compatible = "arm,arm 198 compatible = "arm,armv8"; 199 reg = <0x0 0x3>; 199 reg = <0x0 0x3>; 200 enable-method = "psci" 200 enable-method = "psci"; 201 numa-node-id = <0>; 201 numa-node-id = <0>; 202 }; 202 }; 203 cpu@4 { 203 cpu@4 { 204 device_type = "cpu"; 204 device_type = "cpu"; 205 compatible = "arm,arm 205 compatible = "arm,armv8"; 206 reg = <0x0 0x4>; 206 reg = <0x0 0x4>; 207 enable-method = "psci" 207 enable-method = "psci"; 208 numa-node-id = <0>; 208 numa-node-id = <0>; 209 }; 209 }; 210 cpu@5 { 210 cpu@5 { 211 device_type = "cpu"; 211 device_type = "cpu"; 212 compatible = "arm,arm 212 compatible = "arm,armv8"; 213 reg = <0x0 0x5>; 213 reg = <0x0 0x5>; 214 enable-method = "psci" 214 enable-method = "psci"; 215 numa-node-id = <0>; 215 numa-node-id = <0>; 216 }; 216 }; 217 cpu@6 { 217 cpu@6 { 218 device_type = "cpu"; 218 device_type = "cpu"; 219 compatible = "arm,arm 219 compatible = "arm,armv8"; 220 reg = <0x0 0x6>; 220 reg = <0x0 0x6>; 221 enable-method = "psci" 221 enable-method = "psci"; 222 numa-node-id = <0>; 222 numa-node-id = <0>; 223 }; 223 }; 224 cpu@7 { 224 cpu@7 { 225 device_type = "cpu"; 225 device_type = "cpu"; 226 compatible = "arm,arm 226 compatible = "arm,armv8"; 227 reg = <0x0 0x7>; 227 reg = <0x0 0x7>; 228 enable-method = "psci" 228 enable-method = "psci"; 229 numa-node-id = <0>; 229 numa-node-id = <0>; 230 }; 230 }; 231 cpu@8 { 231 cpu@8 { 232 device_type = "cpu"; 232 device_type = "cpu"; 233 compatible = "arm,arm 233 compatible = "arm,armv8"; 234 reg = <0x0 0x8>; 234 reg = <0x0 0x8>; 235 enable-method = "psci" 235 enable-method = "psci"; 236 /* node 1 */ 236 /* node 1 */ 237 numa-node-id = <1>; 237 numa-node-id = <1>; 238 }; 238 }; 239 cpu@9 { 239 cpu@9 { 240 device_type = "cpu"; 240 device_type = "cpu"; 241 compatible = "arm,arm 241 compatible = "arm,armv8"; 242 reg = <0x0 0x9>; 242 reg = <0x0 0x9>; 243 enable-method = "psci" 243 enable-method = "psci"; 244 numa-node-id = <1>; 244 numa-node-id = <1>; 245 }; 245 }; 246 cpu@a { 246 cpu@a { 247 device_type = "cpu"; 247 device_type = "cpu"; 248 compatible = "arm,arm 248 compatible = "arm,armv8"; 249 reg = <0x0 0xa>; 249 reg = <0x0 0xa>; 250 enable-method = "psci" 250 enable-method = "psci"; 251 numa-node-id = <1>; 251 numa-node-id = <1>; 252 }; 252 }; 253 cpu@b { 253 cpu@b { 254 device_type = "cpu"; 254 device_type = "cpu"; 255 compatible = "arm,arm 255 compatible = "arm,armv8"; 256 reg = <0x0 0xb>; 256 reg = <0x0 0xb>; 257 enable-method = "psci" 257 enable-method = "psci"; 258 numa-node-id = <1>; 258 numa-node-id = <1>; 259 }; 259 }; 260 cpu@c { 260 cpu@c { 261 device_type = "cpu"; 261 device_type = "cpu"; 262 compatible = "arm,arm 262 compatible = "arm,armv8"; 263 reg = <0x0 0xc>; 263 reg = <0x0 0xc>; 264 enable-method = "psci" 264 enable-method = "psci"; 265 numa-node-id = <1>; 265 numa-node-id = <1>; 266 }; 266 }; 267 cpu@d { 267 cpu@d { 268 device_type = "cpu"; 268 device_type = "cpu"; 269 compatible = "arm,arm 269 compatible = "arm,armv8"; 270 reg = <0x0 0xd>; 270 reg = <0x0 0xd>; 271 enable-method = "psci" 271 enable-method = "psci"; 272 numa-node-id = <1>; 272 numa-node-id = <1>; 273 }; 273 }; 274 cpu@e { 274 cpu@e { 275 device_type = "cpu"; 275 device_type = "cpu"; 276 compatible = "arm,arm 276 compatible = "arm,armv8"; 277 reg = <0x0 0xe>; 277 reg = <0x0 0xe>; 278 enable-method = "psci" 278 enable-method = "psci"; 279 numa-node-id = <1>; 279 numa-node-id = <1>; 280 }; 280 }; 281 cpu@f { 281 cpu@f { 282 device_type = "cpu"; 282 device_type = "cpu"; 283 compatible = "arm,arm 283 compatible = "arm,armv8"; 284 reg = <0x0 0xf>; 284 reg = <0x0 0xf>; 285 enable-method = "psci" 285 enable-method = "psci"; 286 numa-node-id = <1>; 286 numa-node-id = <1>; 287 }; 287 }; 288 }; 288 }; 289 289 290 pcie0: pcie0@848000000000 { 290 pcie0: pcie0@848000000000 { 291 compatible = "arm,armv8"; 291 compatible = "arm,armv8"; 292 device_type = "pci"; 292 device_type = "pci"; 293 bus-range = <0 255>; 293 bus-range = <0 255>; 294 #size-cells = <2>; 294 #size-cells = <2>; 295 #address-cells = <3>; 295 #address-cells = <3>; 296 reg = <0x8480 0x00000000 0 0x1 296 reg = <0x8480 0x00000000 0 0x10000000>; /* Configuration space */ 297 ranges = <0x03000000 0x8010 0x 297 ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>; 298 /* node 0 */ 298 /* node 0 */ 299 numa-node-id = <0>; 299 numa-node-id = <0>; 300 }; 300 }; 301 301 302 pcie1: pcie1@948000000000 { 302 pcie1: pcie1@948000000000 { 303 compatible = "arm,armv8"; 303 compatible = "arm,armv8"; 304 device_type = "pci"; 304 device_type = "pci"; 305 bus-range = <0 255>; 305 bus-range = <0 255>; 306 #size-cells = <2>; 306 #size-cells = <2>; 307 #address-cells = <3>; 307 #address-cells = <3>; 308 reg = <0x9480 0x00000000 0 0x1 308 reg = <0x9480 0x00000000 0 0x10000000>; /* Configuration space */ 309 ranges = <0x03000000 0x9010 0x 309 ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>; 310 /* node 1 */ 310 /* node 1 */ 311 numa-node-id = <1>; 311 numa-node-id = <1>; 312 }; 312 }; 313 313 314 distance-map { 314 distance-map { 315 compatible = "numa-distance-ma 315 compatible = "numa-distance-map-v1"; 316 distance-matrix = <0 0 10>, 316 distance-matrix = <0 0 10>, 317 <0 1 20>, 317 <0 1 20>, 318 <1 1 10>; 318 <1 1 10>; 319 }; 319 };
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.