powerpc/pseries: Use a kmem cache for DTL buffers

PAPR specifies that DTL buffers can not cross AMS environments (aka CMO
in the PAPR) and can not cross a memory entitlement granule boundary
(4k). This is found in section 14.11.3.2 H_REGISTER_VPA of the PAPR.
kmalloc does not guarantee an alignment of the allocation, though,
beyond 8 bytes (at least in my understanding). Create a special kmem
cache for DTL buffers with the alignment requirement.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by Nishanth Aravamudan and committed by Benjamin Herrenschmidt 127493d5 7c7a81b5

+10 -2
+10 -2
arch/powerpc/platforms/pseries/setup.c
··· 287 int cpu, ret; 288 struct paca_struct *pp; 289 struct dtl_entry *dtl; 290 291 if (!firmware_has_feature(FW_FEATURE_SPLPAR)) 292 return 0; 293 294 for_each_possible_cpu(cpu) { 295 pp = &paca[cpu]; 296 - dtl = kmalloc_node(DISPATCH_LOG_BYTES, GFP_KERNEL, 297 - cpu_to_node(cpu)); 298 if (!dtl) { 299 pr_warn("Failed to allocate dispatch trace log for cpu %d\n", 300 cpu);
··· 287 int cpu, ret; 288 struct paca_struct *pp; 289 struct dtl_entry *dtl; 290 + struct kmem_cache *dtl_cache; 291 292 if (!firmware_has_feature(FW_FEATURE_SPLPAR)) 293 return 0; 294 295 + dtl_cache = kmem_cache_create("dtl", DISPATCH_LOG_BYTES, 296 + DISPATCH_LOG_BYTES, 0, NULL); 297 + if (!dtl_cache) { 298 + pr_warn("Failed to create dispatch trace log buffer cache\n"); 299 + pr_warn("Stolen time statistics will be unreliable\n"); 300 + return 0; 301 + } 302 + 303 for_each_possible_cpu(cpu) { 304 pp = &paca[cpu]; 305 + dtl = kmem_cache_alloc(dtl_cache, GFP_KERNEL); 306 if (!dtl) { 307 pr_warn("Failed to allocate dispatch trace log for cpu %d\n", 308 cpu);