powerpc/mm: Update page table format for book3s 64
v5 cover powerpc/mm: Update page table format for book3s 64
Hi All,
This patch series attempt to update book3s 64 linux page table format to make it more flexible. Our current pte format is very restrictive and we overload multiple pte bits. This is due to the non-availability of free bits in pte_t. We use pte_t to track the validity of 4K subpages. This patch series free up pte_t of 11 bits by moving 4K subpage tracking to the lower half of PTE page. The pte format is updated such that we have a better method for identifying a pte entry at pmd level. This will also enable us to implement hugetlb migration(not yet done in this series).
Before making the changes to the pte format, I am splitting the pte header definition such that we now have the below layout for headers
book3s
32
hash.h pgtable.h
64
hash.h pgtable.h hash-4k.h hash-64k.h
booke
32
pgtable.h pte-40x.h pte-44x.h pte-8xx.h pte-fsl-booke.h
64
pgtable-4k.h pgtable-64k.h pgtable.h
I have done the header split such that booke headers and modified to the minimum so as to avoid causing breakage in booke.
The patch series can also be found at
https://github.com/kvaneesh/linux.git book3s-pte-format
https://github.com/kvaneesh/linux/commits/book3s-pte-format
Performance numbers with and without patch series.
Path length __hash_page_4k
with patch: 196
without patch: 142
Path length __hash_page_64k
with patch: 219
without patch: 154
But even if we have a path lengh increase of around 50 instructions. We don't see the impact when running workload. I tried the kernelbuild test.
With THP enabled (which is default) we see an improvement. I haven't fully looked at the reason. This could be due to reduced contention of ptl lock. __hash_thp_page is already a C code.
make -j64 vmlinux modules
With fix:
---------
real 1m35.509s user 56m8.565s sys 4m34.973s
real 1m32.174s user 57m2.336s sys 4m39.142s
Without fix:
---------------
real 1m37.703s user 58m50.783s sys 7m52.440s
real 1m37.890s user 57m55.445s sys 7m50.501s
THP disabled:
make -j64 vmlinux modules
With fix:
---------
real 1m37.197s user 58m28.672s sys 7m58.188s
real 1m44.638s user 58m37.551s sys 7m53.960s
Without fix:
------------
real 1m41.224s user 58m46.944s sys 7m49.714s
real 1m42.585s user 59m14.019s sys 7m52.714s
I also ran mmtest configs/config-global-dhp__pagealloc-performance config with changes including this series. (ie, the changes tested include two patch series, one which change the pte format and this series). I am attaching the results below. I removed the pagealloc performance numbers from that because it was giving me all 00 which I assume is due to systemtap script issue.
We don't see any performance impact with the series and some of the performance change is withing the variance of test run as indicated by the numbers below. We do find less page fault and in some case better autonuma numbers
aim9
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7a p1-3754c8187ca17
Min page_test 2233460.00 ( 0.00%) 2231193.33 ( -0.10%)
Min brk_test 4129380.41 ( 0.00%) 4075466.67 ( -1.31%)
Min exec_test 1703.00 ( 0.00%) 1694.87 ( -0.48%)
Min fork_test 4790.14 ( 0.00%) 4723.52 ( -1.39%)
Hmean page_test 2259304.39 ( 0.00%) 2245792.45 ( -0.60%)
Hmean brk_test 4177072.87 ( 0.00%) 4109747.37 ( -1.61%)
Hmean exec_test 1742.55 ( 0.00%) 1734.06 ( -0.49%)
Hmean fork_test 4827.06 ( 0.00%) 4762.24 ( -1.34%)
Stddev page_test 19396.37 ( 0.00%) 10206.24 ( 47.38%)
Stddev brk_test 62453.11 ( 0.00%) 38772.18 ( 37.92%)
Stddev exec_test 14.49 ( 0.00%) 18.28 (-26.14%)
Stddev fork_test 15.42 ( 0.00%) 20.78 (-34.74%)
CoeffVar page_test 0.86 ( 0.00%) 0.45 ( 47.06%)
CoeffVar brk_test 1.49 ( 0.00%) 0.94 ( 36.89%)
CoeffVar exec_test 0.83 ( 0.00%) 1.05 (-26.76%)
CoeffVar fork_test 0.32 ( 0.00%) 0.44 (-36.58%)
Max page_test 2295226.67 ( 0.00%) 2270180.00 ( -1.09%)
Max brk_test 4284000.00 ( 0.00%) 4223933.33 ( -1.40%)
Max exec_test 1766.33 ( 0.00%) 1780.00 ( 0.77%)
Max fork_test 4860.19 ( 0.00%) 4803.46 ( -1.17%) ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17
User 0.10 0.10
System 0.13 0.13Elapsed 723.11 722.38
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17
Minor Faults 83717865 82883370
Major Faults 515 24
Swap Ins 0 0
Swap Outs 0 0
Allocation stalls 0 0
DMA allocs 38205119 37853837
DMA32 allocs 0 0
Normal allocs 0 0
Movable allocs 0 0
Direct pages scanned 0 0
Kswapd pages scanned 0 0
Kswapd pages reclaimed 0 0
Direct pages reclaimed 0 0Kswapd efficiency 100% 100%
Kswapd velocity 0.000 0.000
Direct efficiency 100% 100%
Direct velocity 0.000 0.000
Percentage direct scans 0% 0%
Zone normal velocity 0.000 0.000 Zone dma32 velocity 0.000 0.000 Zone dma velocity 0.000 0.000 Page writes by reclaim 0.000 0.000 Page writes file 0 0 Page writes anon 0 0 Page reclaim immediate 0 0 Sector Reads 202140 5240 Sector Writes 251812 70376 Page rescued immediate 0 0 Slabs scanned 0 0 Direct inode steals 0 0 Kswapd inode steals 0 0 Kswapd skipped wait 0 0 THP fault alloc 2 0 THP collapse alloc 0 0 THP splits 0 0 THP fault fallback 0 0 THP collapse fail 0 0 Compaction stalls 0 0 Compaction success 0 0 Compaction failures 0 0 Page migrate success 0 0 Page migrate failure 0 0 Compaction pages isolated 256 0 Compaction migrate scanned 1 0 Compaction free scanned 1 0 Compaction cost 0 0 NUMA alloc hit 38196832 37845473 NUMA alloc miss 0 0 NUMA interleave hit 0 0
NUMA alloc local 36493228 36049411
NUMA base PTE updates 2145 635
NUMA huge PMD updates 2 0
NUMA page range updates 3169 635
NUMA hint faults 1792212 1741239 NUMA hint local faults 1791770 1741024
NUMA hint local percent 99 99
NUMA pages migrated 0 0
AutoNUMA cost 8961% 8706%
vmr-stream
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17
User 0.03 0.03
System 0.04 0.04
Elapsed 1.83 0.99 ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17
Minor Faults 11412 11418
Major Faults 7 7
Swap Ins 0 0
Swap Outs 0 0
Allocation stalls 0 0
DMA allocs 2234 2217
DMA32 allocs 0 0
Normal allocs 0 0
Movable allocs 0 0
Direct pages scanned 0 0
Kswapd pages scanned 0 0
Kswapd pages reclaimed 0 0
Direct pages reclaimed 0 0Kswapd efficiency 100% 100%
Kswapd velocity 0.000 0.000
Direct efficiency 100% 100%
Direct velocity 0.000 0.000
Percentage direct scans 0% 0%
Zone normal velocity 0.000 0.000 Zone dma32 velocity 0.000 0.000 Zone dma velocity 0.000 0.000 Page writes by reclaim 0.000 0.000 Page writes file 0 0 Page writes anon 0 0 Page reclaim immediate 0 0 Sector Reads 1252 1252 Sector Writes 0 0 Page rescued immediate 0 0 Slabs scanned 0 0 Direct inode steals 0 0 Kswapd inode steals 0 0 Kswapd skipped wait 0 0 THP fault alloc 0 0 THP collapse alloc 0 0 THP splits 0 0 THP fault fallback 0 0 THP collapse fail 0 0 Compaction stalls 0 0 Compaction success 0 0 Compaction failures 0 0 Page migrate success 0 0 Page migrate failure 0 0 Compaction pages isolated 0 0 Compaction migrate scanned 0 0 Compaction free scanned 0 0 Compaction cost 0 0 NUMA alloc hit 2120 2024 NUMA alloc miss 0 0 NUMA interleave hit 0 0 NUMA alloc local 2095 2024 NUMA base PTE updates 0 0 NUMA huge PMD updates 0 0 NUMA page range updates 0 0 NUMA hint faults 0 0 NUMA hint local faults 0 0
NUMA hint local percent 100 100
NUMA pages migrated 0 0
AutoNUMA cost 0% 0%
pagealloc:
Summary only: Actual numbers where zero looks like systemtap issue
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17User 3677.27 169.81
System 42032.42 4152.07
Elapsed 1467.95 1646.51
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17
Minor Faults 372547509 368074849
Major Faults 52 37
Swap Ins 0 0
Swap Outs 0 0
Allocation stalls 0 0
DMA allocs 369188137 367723176
DMA32 allocs 0 0
Normal allocs 0 0
Movable allocs 0 0
Direct pages scanned 0 0
Kswapd pages scanned 0 0
Kswapd pages reclaimed 0 0
Direct pages reclaimed 0 0Kswapd efficiency 100% 100%
Kswapd velocity 0.000 0.000
Direct efficiency 100% 100%
Direct velocity 0.000 0.000
Percentage direct scans 0% 0%
Zone normal velocity 0.000 0.000 Zone dma32 velocity 0.000 0.000 Zone dma velocity 0.000 0.000 Page writes by reclaim 0.000 0.000 Page writes file 0 0 Page writes anon 0 0 Page reclaim immediate 0 0 Sector Reads 72628 6404 Sector Writes 1020234 7752 Page rescued immediate 0 0 Slabs scanned 0 0 Direct inode steals 0 0 Kswapd inode steals 0 0 Kswapd skipped wait 0 0 THP fault alloc 0 0 THP collapse alloc 0 0 THP splits 0 0 THP fault fallback 0 0 THP collapse fail 0 0 Compaction stalls 0 0 Compaction success 0 0 Compaction failures 0 0 Page migrate success 1662 151 Page migrate failure 0 0 Compaction pages isolated 0 768 Compaction migrate scanned 0 3 Compaction free scanned 0 3 Compaction cost 1 0 NUMA alloc hit 369124470 367723093 NUMA alloc miss 0 0 NUMA interleave hit 0 0
NUMA alloc local 264649252 301731875
NUMA base PTE updates 25680332 61617492
NUMA huge PMD updates 0 0
NUMA page range updates 25680332 61617492
NUMA hint faults 48887 6331 NUMA hint local faults 33608 4385
NUMA hint local percent 68 69
NUMA pages migrated 1662 151
AutoNUMA cost 424% 462%
ebizzy Overall Throughput
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7a p1-3754c8187ca17
Min Rsec-1 59019.00 ( 0.00%) 59026.00 ( 0.01%)
Min Rsec-4 235973.00 ( 0.00%) 238172.00 ( 0.93%)
Min Rsec-7 413325.00 ( 0.00%) 417364.00 ( 0.98%)
Min Rsec-12 694883.00 ( 0.00%) 715217.00 ( 2.93%)
Min Rsec-21 989740.00 ( 0.00%) 1156059.00 ( 16.80%)
Min Rsec-30 1086557.00 ( 0.00%) 1185236.00 ( 9.08%)
Min Rsec-48 1378069.00 ( 0.00%) 1194562.00 (-13.32%)
Min Rsec-79 1368744.00 ( 0.00%) 1192618.00 (-12.87%)
Min Rsec-110 1378436.00 ( 0.00%) 1193344.00 (-13.43%)
Min Rsec-141 1342970.00 ( 0.00%) 1192966.00 (-11.17%)
Min Rsec-172 1347378.00 ( 0.00%) 1189860.00 (-11.69%)
Min Rsec-203 1335339.00 ( 0.00%) 1188446.00 (-11.00%)
Min Rsec-234 1334070.00 ( 0.00%) 1185668.00 (-11.12%)
Min Rsec-265 1330046.00 ( 0.00%) 1179494.00 (-11.32%)
Min Rsec-296 1308191.00 ( 0.00%) 1173641.00 (-10.29%)
Min Rsec-327 1308551.00 ( 0.00%) 1170249.00 (-10.57%)
Min Rsec-358 1245558.00 ( 0.00%) 1164313.00 ( -6.52%)
Min Rsec-389 1272398.00 ( 0.00%) 1160014.00 ( -8.83%)
Min Rsec-420 1215291.00 ( 0.00%) 1158521.00 ( -4.67%)
Min Rsec-451 1213763.00 ( 0.00%) 1155647.00 ( -4.79%)
Min Rsec-482 1229500.00 ( 0.00%) 1150865.00 ( -6.40%)
Min Rsec-513 1221127.00 ( 0.00%) 1147681.00 ( -6.01%)
Min Rsec-544 1221782.00 ( 0.00%) 1149971.00 ( -5.88%)
Min Rsec-575 1184374.00 ( 0.00%) 1153082.00 ( -2.64%)
Min Rsec-606 1135188.00 ( 0.00%) 1152674.00 ( 1.54%)
Min Rsec-637 1185181.00 ( 0.00%) 1153444.00 ( -2.68%)
Min Rsec-640 1183162.00 ( 0.00%) 1147895.00 ( -2.98%)
Hmean Rsec-1 59299.22 ( 0.00%) 59220.51 ( -0.13%)
Hmean Rsec-4 237803.45 ( 0.00%) 238861.28 ( 0.44%)
Hmean Rsec-7 415181.57 ( 0.00%) 418361.55 ( 0.77%)
Hmean Rsec-12 702605.63 ( 0.00%) 715778.79 ( 1.87%)
Hmean Rsec-21 1013323.29 ( 0.00%) 1165423.41 ( 15.01%)
Hmean Rsec-30 1220002.31 ( 0.00%) 1191467.30 ( -2.34%)
Hmean Rsec-48 1409923.63 ( 0.00%) 1195532.99 (-15.21%)
Hmean Rsec-79 1408296.65 ( 0.00%) 1194610.06 (-15.17%)
Hmean Rsec-110 1388818.63 ( 0.00%) 1195059.90 (-13.95%)
Hmean Rsec-141 1354828.14 ( 0.00%) 1194087.34 (-11.86%)
Hmean Rsec-172 1358682.97 ( 0.00%) 1192507.85 (-12.23%)
Hmean Rsec-203 1357334.86 ( 0.00%) 1189685.81 (-12.35%)
Hmean Rsec-234 1359017.91 ( 0.00%) 1186369.03 (-12.70%)
Hmean Rsec-265 1347971.12 ( 0.00%) 1181722.72 (-12.33%)
Hmean Rsec-296 1329838.20 ( 0.00%) 1176027.12 (-11.57%)
Hmean Rsec-327 1328480.53 ( 0.00%) 1172182.97 (-11.77%)
Hmean Rsec-358 1285729.51 ( 0.00%) 1166150.72 ( -9.30%)
Hmean Rsec-389 1291378.08 ( 0.00%) 1164117.83 ( -9.85%)
Hmean Rsec-420 1246949.71 ( 0.00%) 1160737.23 ( -6.91%)
Hmean Rsec-451 1248264.03 ( 0.00%) 1158153.34 ( -7.22%)
Hmean Rsec-482 1249315.65 ( 0.00%) 1157326.39 ( -7.36%)
Hmean Rsec-513 1240804.63 ( 0.00%) 1155363.84 ( -6.89%)
Hmean Rsec-544 1248735.27 ( 0.00%) 1153443.82 ( -7.63%)
Hmean Rsec-575 1220099.81 ( 0.00%) 1154863.48 ( -5.35%)
Hmean Rsec-606 1190318.14 ( 0.00%) 1155167.38 ( -2.95%)
Hmean Rsec-637 1229362.35 ( 0.00%) 1154825.20 ( -6.06%)
Hmean Rsec-640 1219838.36 ( 0.00%) 1149766.28 ( -5.74%)
Stddev Rsec-1 214.65 ( 0.00%) 202.13 ( 5.83%)
Stddev Rsec-4 1105.14 ( 0.00%) 468.39 ( 57.62%)
Stddev Rsec-7 1083.26 ( 0.00%) 663.11 ( 38.79%)
Stddev Rsec-12 6049.49 ( 0.00%) 391.93 ( 93.52%)
Stddev Rsec-21 15780.08 ( 0.00%) 6197.16 ( 60.73%)
Stddev Rsec-30 69652.18 ( 0.00%) 3395.62 ( 95.12%)
Stddev Rsec-48 20425.18 ( 0.00%) 702.85 ( 96.56%)
Stddev Rsec-79 21298.32 ( 0.00%) 1056.40 ( 95.04%)
Stddev Rsec-110 7580.56 ( 0.00%) 1036.36 ( 86.33%)
Stddev Rsec-141 7537.24 ( 0.00%) 743.20 ( 90.14%)
Stddev Rsec-172 9407.43 ( 0.00%) 1356.65 ( 85.58%)
Stddev Rsec-203 12249.70 ( 0.00%) 1087.02 ( 91.13%)
Stddev Rsec-234 13864.68 ( 0.00%) 451.98 ( 96.74%)
Stddev Rsec-265 9281.71 ( 0.00%) 1323.11 ( 85.74%)
Stddev Rsec-296 15608.62 ( 0.00%) 1405.19 ( 91.00%)
Stddev Rsec-327 11437.94 ( 0.00%) 1381.67 ( 87.92%)
Stddev Rsec-358 30749.96 ( 0.00%) 1399.78 ( 95.45%)
Stddev Rsec-389 17644.83 ( 0.00%) 2636.34 ( 85.06%)
Stddev Rsec-420 21707.57 ( 0.00%) 1856.06 ( 91.45%)
Stddev Rsec-451 26977.14 ( 0.00%) 2002.56 ( 92.58%)
Stddev Rsec-482 14564.28 ( 0.00%) 3327.88 ( 77.15%)
Stddev Rsec-513 14453.01 ( 0.00%) 4177.19 ( 71.10%)
Stddev Rsec-544 26548.39 ( 0.00%) 2491.44 ( 90.62%)
Stddev Rsec-575 33561.49 ( 0.00%) 1488.00 ( 95.57%)
Stddev Rsec-606 30111.56 ( 0.00%) 1528.70 ( 94.92%)
Stddev Rsec-637 28212.69 ( 0.00%) 1076.03 ( 96.19%)
Stddev Rsec-640 33645.73 ( 0.00%) 1485.91 ( 95.58%)
CoeffVar Rsec-1 0.36 ( 0.00%) 0.34 ( 5.71%)
CoeffVar Rsec-4 0.46 ( 0.00%) 0.20 ( 57.80%)
CoeffVar Rsec-7 0.26 ( 0.00%) 0.16 ( 39.25%)
CoeffVar Rsec-12 0.86 ( 0.00%) 0.05 ( 93.64%)
CoeffVar Rsec-21 1.56 ( 0.00%) 0.53 ( 65.85%)
CoeffVar Rsec-30 5.69 ( 0.00%) 0.28 ( 94.99%)
CoeffVar Rsec-48 1.45 ( 0.00%) 0.06 ( 95.94%)
CoeffVar Rsec-79 1.51 ( 0.00%) 0.09 ( 94.15%)
CoeffVar Rsec-110 0.55 ( 0.00%) 0.09 ( 84.11%)
CoeffVar Rsec-141 0.56 ( 0.00%) 0.06 ( 88.81%)
CoeffVar Rsec-172 0.69 ( 0.00%) 0.11 ( 83.57%)
CoeffVar Rsec-203 0.90 ( 0.00%) 0.09 ( 89.87%)
CoeffVar Rsec-234 1.02 ( 0.00%) 0.04 ( 96.27%)
CoeffVar Rsec-265 0.69 ( 0.00%) 0.11 ( 83.74%)
CoeffVar Rsec-296 1.17 ( 0.00%) 0.12 ( 89.82%)
CoeffVar Rsec-327 0.86 ( 0.00%) 0.12 ( 86.31%)
CoeffVar Rsec-358 2.39 ( 0.00%) 0.12 ( 94.98%)
CoeffVar Rsec-389 1.37 ( 0.00%) 0.23 ( 83.42%)
CoeffVar Rsec-420 1.74 ( 0.00%) 0.16 ( 90.81%)
CoeffVar Rsec-451 2.16 ( 0.00%) 0.17 ( 92.00%)
CoeffVar Rsec-482 1.17 ( 0.00%) 0.29 ( 75.33%)
CoeffVar Rsec-513 1.16 ( 0.00%) 0.36 ( 68.96%)
CoeffVar Rsec-544 2.13 ( 0.00%) 0.22 ( 89.84%)
CoeffVar Rsec-575 2.75 ( 0.00%) 0.13 ( 95.31%)
CoeffVar Rsec-606 2.53 ( 0.00%) 0.13 ( 94.77%)
CoeffVar Rsec-637 2.29 ( 0.00%) 0.09 ( 95.94%)
CoeffVar Rsec-640 2.76 ( 0.00%) 0.13 ( 95.31%)
Max Rsec-1 59477.00 ( 0.00%) 59547.00 ( 0.12%)
Max Rsec-4 239279.00 ( 0.00%) 239413.00 ( 0.06%)
Max Rsec-7 416467.00 ( 0.00%) 419267.00 ( 0.67%)
Max Rsec-12 711538.00 ( 0.00%) 716354.00 ( 0.68%)
Max Rsec-21 1034993.00 ( 0.00%) 1173890.00 ( 13.42%)
Max Rsec-30 1271755.00 ( 0.00%) 1194865.00 ( -6.05%)
Max Rsec-48 1431735.00 ( 0.00%) 1196503.00 (-16.43%)
Max Rsec-79 1425144.00 ( 0.00%) 1195467.00 (-16.12%)
Max Rsec-110 1398698.00 ( 0.00%) 1196259.00 (-14.47%)
Max Rsec-141 1362060.00 ( 0.00%) 1194837.00 (-12.28%)
Max Rsec-172 1371670.00 ( 0.00%) 1193678.00 (-12.98%)
Max Rsec-203 1372548.00 ( 0.00%) 1191462.00 (-13.19%)
Max Rsec-234 1373918.00 ( 0.00%) 1186881.00 (-13.61%)
Max Rsec-265 1355405.00 ( 0.00%) 1183302.00 (-12.70%)
Max Rsec-296 1350576.00 ( 0.00%) 1177724.00 (-12.80%)
Max Rsec-327 1340526.00 ( 0.00%) 1173891.00 (-12.43%)
Max Rsec-358 1318225.00 ( 0.00%) 1168442.00 (-11.36%)
Max Rsec-389 1313419.00 ( 0.00%) 1167070.00 (-11.14%)
Max Rsec-420 1272361.00 ( 0.00%) 1163315.00 ( -8.57%)
Max Rsec-451 1287748.00 ( 0.00%) 1161601.00 ( -9.80%)
Max Rsec-482 1266893.00 ( 0.00%) 1160102.00 ( -8.43%)
Max Rsec-513 1265236.00 ( 0.00%) 1159734.00 ( -8.34%)
Max Rsec-544 1286777.00 ( 0.00%) 1156780.00 (-10.10%)
Max Rsec-575 1274216.00 ( 0.00%) 1156878.00 ( -9.21%)
Max Rsec-606 1225411.00 ( 0.00%) 1156891.00 ( -5.59%)
Max Rsec-637 1260667.00 ( 0.00%) 1156004.00 ( -8.30%)
Max Rsec-640 1265580.00 ( 0.00%) 1151746.00 ( -8.99%)ebizzy Per-thread
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7a p1-3754c8187ca17
Min Rsec-1 59019.00 ( 0.00%) 59026.00 ( 0.01%)
Min Rsec-4 58043.00 ( 0.00%) 59093.00 ( 1.81%)
Min Rsec-7 58235.00 ( 0.00%) 59056.00 ( 1.41%)
Min Rsec-12 56196.00 ( 0.00%) 58710.00 ( 4.47%)
Min Rsec-21 27616.00 ( 0.00%) 43185.00 ( 56.38%)
Min Rsec-30 18107.00 ( 0.00%) 35089.00 ( 93.79%)
Min Rsec-48 13880.00 ( 0.00%) 20565.00 ( 48.16%)
Min Rsec-79 10748.00 ( 0.00%) 12743.00 ( 18.56%)
Min Rsec-110 8584.00 ( 0.00%) 8354.00 ( -2.68%)
Min Rsec-141 8383.00 ( 0.00%) 6601.00 (-21.26%)
Min Rsec-172 6591.00 ( 0.00%) 5455.00 (-17.24%)
Min Rsec-203 5218.00 ( 0.00%) 4542.00 (-12.96%)
Min Rsec-234 4297.00 ( 0.00%) 3878.00 ( -9.75%)
Min Rsec-265 3564.00 ( 0.00%) 3601.00 ( 1.04%)
Min Rsec-296 3006.00 ( 0.00%) 3207.00 ( 6.69%)
Min Rsec-327 2566.00 ( 0.00%) 2986.00 ( 16.37%)
Min Rsec-358 1957.00 ( 0.00%) 2633.00 ( 34.54%)
Min Rsec-389 1934.00 ( 0.00%) 2469.00 ( 27.66%)
Min Rsec-420 1621.00 ( 0.00%) 2113.00 ( 30.35%)
Min Rsec-451 1332.00 ( 0.00%) 1940.00 ( 45.65%)
Min Rsec-482 1216.00 ( 0.00%) 1967.00 ( 61.76%)
Min Rsec-513 1086.00 ( 0.00%) 1775.00 ( 63.44%)
Min Rsec-544 1059.00 ( 0.00%) 1625.00 ( 53.45%)
Min Rsec-575 931.00 ( 0.00%) 1608.00 ( 72.72%)
Min Rsec-606 854.00 ( 0.00%) 1514.00 ( 77.28%)
Min Rsec-637 785.00 ( 0.00%) 1461.00 ( 86.11%)
Min Rsec-640 769.00 ( 0.00%) 1457.00 ( 89.47%)
Hmean Rsec-1 59299.22 ( 0.00%) 59220.51 ( -0.13%)
Hmean Rsec-4 59448.27 ( 0.00%) 59713.55 ( 0.45%)
Hmean Rsec-7 59308.87 ( 0.00%) 59764.26 ( 0.77%)
Hmean Rsec-12 58544.65 ( 0.00%) 59646.29 ( 1.88%)
Hmean Rsec-21 46566.67 ( 0.00%) 55040.62 ( 18.20%)
Hmean Rsec-30 38129.87 ( 0.00%) 39635.40 ( 3.95%)
Hmean Rsec-48 26068.69 ( 0.00%) 24727.22 ( -5.15%)
Hmean Rsec-79 16414.30 ( 0.00%) 15054.40 ( -8.28%)
Hmean Rsec-110 12194.60 ( 0.00%) 10748.15 (-11.86%)
Hmean Rsec-141 9554.89 ( 0.00%) 8382.53 (-12.27%)
Hmean Rsec-172 7874.33 ( 0.00%) 6864.12 (-12.83%)
Hmean Rsec-203 6642.05 ( 0.00%) 5805.13 (-12.60%)
Hmean Rsec-234 5754.57 ( 0.00%) 5016.33 (-12.83%)
Hmean Rsec-265 5033.39 ( 0.00%) 4425.33 (-12.08%)
Hmean Rsec-296 4430.79 ( 0.00%) 3930.34 (-11.29%)
Hmean Rsec-327 3987.30 ( 0.00%) 3551.38 (-10.93%)
Hmean Rsec-358 3497.80 ( 0.00%) 3231.49 ( -7.61%)
Hmean Rsec-389 3224.77 ( 0.00%) 2967.51 ( -7.98%)
Hmean Rsec-420 2864.26 ( 0.00%) 2724.67 ( -4.87%)
Hmean Rsec-451 2654.30 ( 0.00%) 2539.20 ( -4.34%)
Hmean Rsec-482 2474.43 ( 0.00%) 2372.93 ( -4.10%)
Hmean Rsec-513 2303.30 ( 0.00%) 2228.18 ( -3.26%)
Hmean Rsec-544 2179.61 ( 0.00%) 2089.91 ( -4.12%)
Hmean Rsec-575 2004.37 ( 0.00%) 1990.74 ( -0.68%)
Hmean Rsec-606 1835.71 ( 0.00%) 1886.48 ( 2.77%)
Hmean Rsec-637 1799.26 ( 0.00%) 1791.23 ( -0.45%)
Hmean Rsec-640 1769.47 ( 0.00%) 1776.84 ( 0.42%)
Stddev Rsec-1 214.65 ( 0.00%) 202.13 ( -5.83%)
Stddev Rsec-4 452.36 ( 0.00%) 303.68 (-32.87%)
Stddev Rsec-7 407.54 ( 0.00%) 279.43 (-31.44%)
Stddev Rsec-12 749.25 ( 0.00%) 298.44 (-60.17%)
Stddev Rsec-21 8269.02 ( 0.00%) 4821.85 (-41.69%)
Stddev Rsec-30 9740.83 ( 0.00%) 1781.85 (-81.71%)
Stddev Rsec-48 8940.54 ( 0.00%) 2140.32 (-76.06%)
Stddev Rsec-79 4763.58 ( 0.00%) 1019.77 (-78.59%)
Stddev Rsec-110 2404.10 ( 0.00%) 1106.16 (-53.99%)
Stddev Rsec-141 748.05 ( 0.00%) 861.90 ( 15.22%)
Stddev Rsec-172 443.52 ( 0.00%) 706.09 ( 59.20%)
Stddev Rsec-203 545.22 ( 0.00%) 596.05 ( 9.32%)
Stddev Rsec-234 560.10 ( 0.00%) 520.38 ( -7.09%)
Stddev Rsec-265 523.60 ( 0.00%) 398.13 (-23.96%)
Stddev Rsec-296 529.15 ( 0.00%) 422.22 (-20.21%)
Stddev Rsec-327 555.34 ( 0.00%) 357.59 (-35.61%)
Stddev Rsec-358 587.05 ( 0.00%) 297.70 (-49.29%)
Stddev Rsec-389 567.67 ( 0.00%) 283.17 (-50.12%)
Stddev Rsec-420 561.80 ( 0.00%) 334.94 (-40.38%)
Stddev Rsec-451 568.80 ( 0.00%) 283.43 (-50.17%)
Stddev Rsec-482 561.95 ( 0.00%) 280.07 (-50.16%)
Stddev Rsec-513 536.11 ( 0.00%) 237.82 (-55.64%)
Stddev Rsec-544 530.79 ( 0.00%) 265.20 (-50.04%)
Stddev Rsec-575 511.25 ( 0.00%) 194.66 (-61.92%)
Stddev Rsec-606 513.16 ( 0.00%) 208.21 (-59.43%)
Stddev Rsec-637 523.96 ( 0.00%) 214.40 (-59.08%)
Stddev Rsec-640 524.37 ( 0.00%) 198.46 (-62.15%)
CoeffVar Rsec-1 0.36 ( 0.00%) 0.34 ( 5.71%)
CoeffVar Rsec-4 0.76 ( 0.00%) 0.51 ( 33.16%)
CoeffVar Rsec-7 0.69 ( 0.00%) 0.47 ( 31.96%)
CoeffVar Rsec-12 1.28 ( 0.00%) 0.50 ( 60.90%)
CoeffVar Rsec-21 17.13 ( 0.00%) 8.69 ( 49.29%)
CoeffVar Rsec-30 23.87 ( 0.00%) 4.49 ( 81.20%)
CoeffVar Rsec-48 30.43 ( 0.00%) 8.59 ( 71.76%)
CoeffVar Rsec-79 26.72 ( 0.00%) 6.74 ( 74.76%)
CoeffVar Rsec-110 19.04 ( 0.00%) 10.18 ( 46.53%)
CoeffVar Rsec-141 7.79 ( 0.00%) 10.18 (-30.74%)
CoeffVar Rsec-172 5.61 ( 0.00%) 10.18 (-81.39%)
CoeffVar Rsec-203 8.15 ( 0.00%) 10.17 (-24.74%)
CoeffVar Rsec-234 9.64 ( 0.00%) 10.27 ( -6.44%)
CoeffVar Rsec-265 10.29 ( 0.00%) 8.93 ( 13.26%)
CoeffVar Rsec-296 11.78 ( 0.00%) 10.63 ( 9.76%)
CoeffVar Rsec-327 13.67 ( 0.00%) 9.98 ( 27.02%)
CoeffVar Rsec-358 16.34 ( 0.00%) 9.14 ( 44.06%)
CoeffVar Rsec-389 17.10 ( 0.00%) 9.46 ( 44.65%)
CoeffVar Rsec-420 18.92 ( 0.00%) 12.12 ( 35.93%)
CoeffVar Rsec-451 20.54 ( 0.00%) 11.04 ( 46.27%)
CoeffVar Rsec-482 21.68 ( 0.00%) 11.67 ( 46.19%)
CoeffVar Rsec-513 22.17 ( 0.00%) 10.56 ( 52.35%)
CoeffVar Rsec-544 23.12 ( 0.00%) 12.51 ( 45.88%)
CoeffVar Rsec-575 24.08 ( 0.00%) 9.69 ( 59.74%)
CoeffVar Rsec-606 26.11 ( 0.00%) 10.93 ( 58.16%)
CoeffVar Rsec-637 27.14 ( 0.00%) 11.83 ( 56.42%)
CoeffVar Rsec-640 27.50 ( 0.00%) 11.05 ( 59.81%)
Max Rsec-1 59477.00 ( 0.00%) 59547.00 ( 0.12%)
Max Rsec-4 60099.00 ( 0.00%) 60109.00 ( 0.02%)
Max Rsec-7 59947.00 ( 0.00%) 60146.00 ( 0.33%)
Max Rsec-12 59660.00 ( 0.00%) 60095.00 ( 0.73%)
Max Rsec-21 59737.00 ( 0.00%) 60052.00 ( 0.53%)
Max Rsec-30 59385.00 ( 0.00%) 44024.00 (-25.87%)
Max Rsec-48 43898.00 ( 0.00%) 30457.00 (-30.62%)
Max Rsec-79 27525.00 ( 0.00%) 18652.00 (-32.24%)
Max Rsec-110 26278.00 ( 0.00%) 13760.00 (-47.64%)
Max Rsec-141 13849.00 ( 0.00%) 11322.00 (-18.25%)
Max Rsec-172 10026.00 ( 0.00%) 9901.00 ( -1.25%)
Max Rsec-203 8790.00 ( 0.00%) 10312.00 ( 17.32%)
Max Rsec-234 8078.00 ( 0.00%) 6947.00 (-14.00%)
Max Rsec-265 7296.00 ( 0.00%) 6885.00 ( -5.63%)
Max Rsec-296 6743.00 ( 0.00%) 6186.00 ( -8.26%)
Max Rsec-327 6036.00 ( 0.00%) 5037.00 (-16.55%)
Max Rsec-358 5615.00 ( 0.00%) 4615.00 (-17.81%)
Max Rsec-389 5728.00 ( 0.00%) 4797.00 (-16.25%)
Max Rsec-420 5548.00 ( 0.00%) 4311.00 (-22.30%)
Max Rsec-451 4887.00 ( 0.00%) 4188.00 (-14.30%)
Max Rsec-482 5382.00 ( 0.00%) 4152.00 (-22.85%)
Max Rsec-513 4493.00 ( 0.00%) 3543.00 (-21.14%)
Max Rsec-544 8204.00 ( 0.00%) 3878.00 (-52.73%)
Max Rsec-575 4884.00 ( 0.00%) 3410.00 (-30.18%)
Max Rsec-606 4399.00 ( 0.00%) 3441.00 (-21.78%)
Max Rsec-637 4630.00 ( 0.00%) 3772.00 (-18.53%)
Max Rsec-640 4303.00 ( 0.00%) 3449.00 (-19.85%)ebizzy Thread spread
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7a p1-3754c8187ca17
Min spread-1 0.00 ( 0.00%) 0.00 ( 0.00%)
Min spread-4 642.00 ( 0.00%) 184.00 ( 71.34%)
Min spread-7 520.00 ( 0.00%) 516.00 ( 0.77%)
Min spread-12 854.00 ( 0.00%) 662.00 ( 22.48%)
Min spread-21 17941.00 ( 0.00%) 9358.00 ( 47.84%)
Min spread-30 29196.00 ( 0.00%) 6511.00 ( 77.70%)
Min spread-48 25290.00 ( 0.00%) 6198.00 ( 75.49%)
Min spread-79 14675.00 ( 0.00%) 3515.00 ( 76.05%)
Min spread-110 8494.00 ( 0.00%) 2761.00 ( 67.49%)
Min spread-141 2849.00 ( 0.00%) 2543.00 ( 10.74%)
Min spread-172 1663.00 ( 0.00%) 2473.00 (-48.71%)
Min spread-203 2675.00 ( 0.00%) 1788.00 ( 33.16%)
Min spread-234 2564.00 ( 0.00%) 1730.00 ( 32.53%)
Min spread-265 2787.00 ( 0.00%) 1452.00 ( 47.90%)
Min spread-296 2661.00 ( 0.00%) 1780.00 ( 33.11%)
Min spread-327 2818.00 ( 0.00%) 1697.00 ( 39.78%)
Min spread-358 2762.00 ( 0.00%) 1389.00 ( 49.71%)
Min spread-389 2965.00 ( 0.00%) 1535.00 ( 48.23%)
Min spread-420 2975.00 ( 0.00%) 1446.00 ( 51.39%)
Min spread-451 2688.00 ( 0.00%) 1384.00 ( 48.51%)
Min spread-482 2951.00 ( 0.00%) 1557.00 ( 47.24%)
Min spread-513 2720.00 ( 0.00%) 772.00 ( 71.62%)
Min spread-544 2802.00 ( 0.00%) 1458.00 ( 47.97%)
Min spread-575 2913.00 ( 0.00%) 948.00 ( 67.46%)
Min spread-606 2668.00 ( 0.00%) 978.00 ( 63.34%)
Min spread-637 2772.00 ( 0.00%) 870.00 ( 68.61%)
Min spread-640 2673.00 ( 0.00%) 1279.00 ( 52.15%)
Hmean spread-1 0.00 ( 0.00%) 0.00 ( 0.00%)
Hmean spread-4 801.43 ( 0.00%) 470.50 ( 41.29%)
Hmean spread-7 965.88 ( 0.00%) 725.33 ( 24.90%)
Hmean spread-12 1474.71 ( 0.00%) 911.49 ( 38.19%)
Hmean spread-21 25214.17 ( 0.00%) 13345.33 ( 47.07%)
Hmean spread-30 33264.37 ( 0.00%) 7229.77 ( 78.27%)
Hmean spread-48 27289.38 ( 0.00%) 7524.92 ( 72.43%)
Hmean spread-79 15540.65 ( 0.00%) 4016.42 ( 74.16%)
Hmean spread-110 10173.90 ( 0.00%) 3569.92 ( 64.91%)
Hmean spread-141 3739.06 ( 0.00%) 3327.24 ( 11.01%)
Hmean spread-172 2131.19 ( 0.00%) 2925.95 (-37.29%)
Hmean spread-203 2997.71 ( 0.00%) 2828.64 ( 5.64%)
Hmean spread-234 2956.73 ( 0.00%) 2256.26 ( 23.69%)
Hmean spread-265 3055.75 ( 0.00%) 2130.75 ( 30.27%)
Hmean spread-296 3072.62 ( 0.00%) 2311.81 ( 24.76%)
Hmean spread-327 2966.20 ( 0.00%) 1870.37 ( 36.94%)
Hmean spread-358 3126.03 ( 0.00%) 1648.81 ( 47.26%)
Hmean spread-389 3180.41 ( 0.00%) 1772.25 ( 44.28%)
Hmean spread-420 3314.92 ( 0.00%) 1732.26 ( 47.74%)
Hmean spread-451 3192.62 ( 0.00%) 1769.23 ( 44.58%)
Hmean spread-482 3319.77 ( 0.00%) 1817.95 ( 45.24%)
Hmean spread-513 3056.14 ( 0.00%) 1231.55 ( 59.70%)
Hmean spread-544 3450.15 ( 0.00%) 1732.02 ( 49.80%)
Hmean spread-575 3223.94 ( 0.00%) 1366.10 ( 57.63%)
Hmean spread-606 3016.24 ( 0.00%) 1410.86 ( 53.22%)
Hmean spread-637 3369.59 ( 0.00%) 1267.08 ( 62.40%)
Hmean spread-640 3108.32 ( 0.00%) 1501.63 ( 51.69%)
Stddev spread-1 0.00 ( 0.00%) 0.00 ( 0.00%)
Stddev spread-4 284.37 ( 0.00%) 271.81 ( 4.42%)
Stddev spread-7 383.83 ( 0.00%) 195.72 ( 49.01%)
Stddev spread-12 685.16 ( 0.00%) 247.70 ( 63.85%)
Stddev spread-21 4571.79 ( 0.00%) 2516.53 ( 44.96%)
Stddev spread-30 2741.29 ( 0.00%) 539.47 ( 80.32%)
Stddev spread-48 1571.52 ( 0.00%) 1212.36 ( 22.85%)
Stddev spread-79 572.87 ( 0.00%) 885.42 (-54.56%)
Stddev spread-110 3348.16 ( 0.00%) 942.23 ( 71.86%)
Stddev spread-141 827.46 ( 0.00%) 574.75 ( 30.54%)
Stddev spread-172 570.10 ( 0.00%) 709.11 (-24.38%)
Stddev spread-203 292.68 ( 0.00%) 1223.27 (-317.96%)
Stddev spread-234 379.33 ( 0.00%) 398.56 ( -5.07%)
Stddev spread-265 274.53 ( 0.00%) 650.83 (-137.07%)
Stddev spread-296 240.56 ( 0.00%) 502.41 (-108.85%)
Stddev spread-327 108.69 ( 0.00%) 98.61 ( 9.28%)
Stddev spread-358 252.78 ( 0.00%) 195.68 ( 22.59%)
Stddev spread-389 293.21 ( 0.00%) 244.61 ( 16.57%)
Stddev spread-420 303.05 ( 0.00%) 297.58 ( 1.81%)
Stddev spread-451 276.28 ( 0.00%) 237.67 ( 13.97%)
Stddev spread-482 352.94 ( 0.00%) 228.32 ( 35.31%)
Stddev spread-513 212.64 ( 0.00%) 322.39 (-51.61%)
Stddev spread-544 1571.63 ( 0.00%) 213.04 ( 86.44%)
Stddev spread-575 352.77 ( 0.00%) 277.26 ( 21.40%)
Stddev spread-606 322.88 ( 0.00%) 350.63 ( -8.59%)
Stddev spread-637 332.26 ( 0.00%) 485.17 (-46.02%)
Stddev spread-640 311.30 ( 0.00%) 249.49 ( 19.86%)
CoeffVar spread-1 0.00 ( 0.00%) 0.00 ( 0.00%)
CoeffVar spread-4 32.65 ( 0.00%) 40.50 ( 24.04%)
CoeffVar spread-7 34.11 ( 0.00%) 25.27 (-25.90%)
CoeffVar spread-12 39.21 ( 0.00%) 25.44 (-35.12%)
CoeffVar spread-21 17.47 ( 0.00%) 18.11 ( 3.67%)
CoeffVar spread-30 8.18 ( 0.00%) 7.42 ( -9.34%)
CoeffVar spread-48 5.74 ( 0.00%) 15.75 (174.34%)
CoeffVar spread-79 3.68 ( 0.00%) 21.27 (477.84%)
CoeffVar spread-110 30.70 ( 0.00%) 24.92 (-18.82%)
CoeffVar spread-141 21.18 ( 0.00%) 16.76 (-20.89%)
CoeffVar spread-172 25.34 ( 0.00%) 23.23 ( -8.32%)
CoeffVar spread-203 9.67 ( 0.00%) 37.85 (291.37%)
CoeffVar spread-234 12.63 ( 0.00%) 17.10 ( 35.38%)
CoeffVar spread-265 8.92 ( 0.00%) 28.09 (215.03%)
CoeffVar spread-296 7.78 ( 0.00%) 20.74 (166.59%)
CoeffVar spread-327 3.66 ( 0.00%) 5.26 ( 43.65%)
CoeffVar spread-358 8.03 ( 0.00%) 11.71 ( 45.74%)
CoeffVar spread-389 9.15 ( 0.00%) 13.57 ( 48.33%)
CoeffVar spread-420 9.07 ( 0.00%) 16.71 ( 84.25%)
CoeffVar spread-451 8.58 ( 0.00%) 13.17 ( 53.46%)
CoeffVar spread-482 10.52 ( 0.00%) 12.37 ( 17.55%)
CoeffVar spread-513 6.92 ( 0.00%) 24.25 (250.23%)
CoeffVar spread-544 40.77 ( 0.00%) 12.12 (-70.28%)
CoeffVar spread-575 10.83 ( 0.00%) 19.38 ( 79.06%)
CoeffVar spread-606 10.58 ( 0.00%) 23.34 (120.53%)
CoeffVar spread-637 9.75 ( 0.00%) 34.41 (252.77%)
CoeffVar spread-640 9.91 ( 0.00%) 16.23 ( 63.65%)
Max spread-1 0.00 ( 0.00%) 0.00 ( 0.00%)
Max spread-4 1410.00 ( 0.00%) 983.00 ( 30.28%)
Max spread-7 1707.00 ( 0.00%) 1040.00 ( 39.07%)
Max spread-12 2849.00 ( 0.00%) 1353.00 ( 52.51%)
Max spread-21 30767.00 ( 0.00%) 16839.00 ( 45.27%)
Max spread-30 36695.00 ( 0.00%) 7837.00 ( 78.64%)
Max spread-48 30018.00 ( 0.00%) 9892.00 ( 67.05%)
Max spread-79 16436.00 ( 0.00%) 5909.00 ( 64.05%)
Max spread-110 17489.00 ( 0.00%) 5324.00 ( 69.56%)
Max spread-141 5237.00 ( 0.00%) 4102.00 ( 21.67%)
Max spread-172 3312.00 ( 0.00%) 4446.00 (-34.24%)
Max spread-203 3371.00 ( 0.00%) 5389.00 (-59.86%)
Max spread-234 3586.00 ( 0.00%) 2732.00 ( 23.81%)
Max spread-265 3511.00 ( 0.00%) 3106.00 ( 11.54%)
Max spread-296 3397.00 ( 0.00%) 2979.00 ( 12.30%)
Max spread-327 3115.00 ( 0.00%) 1993.00 ( 36.02%)
Max spread-358 3458.00 ( 0.00%) 1982.00 ( 42.68%)
Max spread-389 3768.00 ( 0.00%) 2244.00 ( 40.45%)
Max spread-420 3829.00 ( 0.00%) 2177.00 ( 43.14%)
Max spread-451 3441.00 ( 0.00%) 2052.00 ( 40.37%)
Max spread-482 3966.00 ( 0.00%) 2166.00 ( 45.39%)
Max spread-513 3347.00 ( 0.00%) 1689.00 ( 49.54%)
Max spread-544 6983.00 ( 0.00%) 2064.00 ( 70.44%)
Max spread-575 3899.00 ( 0.00%) 1707.00 ( 56.22%)
Max spread-606 3420.00 ( 0.00%) 1871.00 ( 45.29%)
Max spread-637 3687.00 ( 0.00%) 2275.00 ( 38.30%)
Max spread-640 3520.00 ( 0.00%) 1992.00 ( 43.41%) ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17User 449857.75 72187.34
System 2638.18 105.00
Elapsed 4054.44 4053.38
ltctulc6a ltctulc6a
p1-0c526e14410c98f0ebc7ap1-3754c8187ca17
Minor Faults 2765118 1514804
Major Faults 408 1
Swap Ins 0 0
Swap Outs 0 0
Allocation stalls 0 0
DMA allocs 1167862 1071627
DMA32 allocs 0 0
Normal allocs 0 0
Movable allocs 0 0
Direct pages scanned 0 0
Kswapd pages scanned 0 0
Kswapd pages reclaimed 0 0
Direct pages reclaimed 0 0Kswapd efficiency 100% 100%
Kswapd velocity 0.000 0.000
Direct efficiency 100% 100%
Direct velocity 0.000 0.000
Percentage direct scans 0% 0%
Zone normal velocity 0.000 0.000 Zone dma32 velocity 0.000 0.000 Zone dma velocity 0.000 0.000 Page writes by reclaim 0.000 0.000 Page writes file 0 0 Page writes anon 0 0 Page reclaim immediate 0 0 Sector Reads 1444141 172 Sector Writes 91684 13168 Page rescued immediate 0 0 Slabs scanned 0 0 Direct inode steals 0 0 Kswapd inode steals 0 0 Kswapd skipped wait 0 0
THP fault alloc 51 190
THP collapse alloc 2 2
THP splits 51 170
THP fault fallback 135 380
THP collapse fail 0 0 Compaction stalls 0 0 Compaction success 0 0 Compaction failures 0 0 Page migrate success 65321 66111 Page migrate failure 0 0 Compaction pages isolated 0 1024 Compaction migrate scanned 0 4 Compaction free scanned 0 4 Compaction cost 67 68 NUMA alloc hit 1090456 890448 NUMA alloc miss 0 0 NUMA interleave hit 0 0 NUMA alloc local 945985 514745 NUMA base PTE updates 864898 601053 NUMA huge PMD updates 0 0 NUMA page range updates 864898 601053 NUMA hint faults 851929 593151 NUMA hint local faults 335015 217196 NUMA hint local percent 39 36 NUMA pages migrated 65321 66111 AutoNUMA cost 4266% 2971%
Changes from V4:
* rebase to latest linus
* Add mmtest numbers
Changes from V3:
* Add missing #define pgprot_*
* Add Acked-by
Changes from V2:
* rebase to -next for powerpc tree
Changes from V1:
1) Build fix with STRICT_MM_TYPES enabled
2) pte_mkwrite fix for nohash
3) rebase to latest linus tree.
Aneesh Kumar K.V (31):
powerpc/mm: move pte headers to book3s directory powerpc/mm: move pte headers to book3s directory (part 2) powerpc/mm: make a separate copy for book3s
powerpc/mm: make a separate copy for book3s (part 2) powerpc/mm: Move hash specific pte width and other defines to book3s powerpc/mm: Delete booke bits from book3s
powerpc/mm: Don't have generic headers introduce functions touching
pte bits
powerpc/mm: Drop pte-common.h from BOOK3S 64
powerpc/mm: Don't use pte_val as lvalue
powerpc/mm: Don't use pmd_val,pud_val and pgd_val as lvalue powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h powerpc/mm: Move PTE bits from generic functions to hash64 functions. powerpc/booke: Move nohash headers (part 1)
powerpc/booke: Move nohash headers (part 2)
powerpc/booke: Move nohash headers (part 3)
powerpc/booke: Move nohash headers (part 4)
powerpc/booke: Move nohash headers (part 5)
powerpc/mm: Increase the pte frag size.
powerpc/mm: Convert 4k hash insert to C
powerpc/mm: update __real_pte to take address as argument powerpc/mm: make pte page hash index slot 8 bits powerpc/mm: Don't track subpage valid bit in pte_t powerpc/mm: Increase the width of #define
powerpc/mm: Convert __hash_page_64K to C
powerpc/mm: Convert 4k insert from asm to C
powerpc/mm: Remove the dependency on pte bit position in asm code powerpc/mm: Add helper for converting pte bit to hpte bits powerpc/mm: Move WIMG update to helper.
powerpc/mm: Move hugetlb related headers
powerpc/mm: Move THP headers around
powerpc/mm: Add a _PAGE_PTE bit
.../include/asm/{pte-hash32.h => book3s/32/hash.h} | 6 +-
arch/powerpc/include/asm/book3s/32/pgtable.h | 482 ++++++++++
arch/powerpc/include/asm/book3s/64/hash-4k.h | 132 +++
arch/powerpc/include/asm/book3s/64/hash-64k.h | 296 ++++++
arch/powerpc/include/asm/book3s/64/hash.h | 528 +++++++++++
arch/powerpc/include/asm/book3s/64/pgtable.h | 266 ++++++
arch/powerpc/include/asm/book3s/pgtable.h | 29 +
arch/powerpc/include/asm/mmu-hash64.h | 2 +-
.../asm/{pgtable-ppc32.h => nohash/32/pgtable.h} | 25 +-
arch/powerpc/include/asm/{ => nohash/32}/pte-40x.h | 6 +-
arch/powerpc/include/asm/{ => nohash/32}/pte-44x.h | 6 +-
arch/powerpc/include/asm/{ => nohash/32}/pte-8xx.h | 6 +-
.../include/asm/{ => nohash/32}/pte-fsl-booke.h | 6 +-
.../{pgtable-ppc64-4k.h => nohash/64/pgtable-4k.h} | 12 +-
.../64/pgtable-64k.h} | 6 +-
.../asm/{pgtable-ppc64.h => nohash/64/pgtable.h} | 307 +-----
arch/powerpc/include/asm/nohash/pgtable.h | 252 +++++
arch/powerpc/include/asm/{ => nohash}/pte-book3e.h | 6 +-
arch/powerpc/include/asm/page.h | 90 +-
arch/powerpc/include/asm/pgalloc-32.h | 34 +-
arch/powerpc/include/asm/pgalloc-64.h | 29 +-
arch/powerpc/include/asm/pgtable.h | 200 +---
arch/powerpc/include/asm/pte-common.h | 5 +
arch/powerpc/include/asm/pte-hash64-4k.h | 17 -
arch/powerpc/include/asm/pte-hash64-64k.h | 102 --
arch/powerpc/include/asm/pte-hash64.h | 54 --
arch/powerpc/kernel/exceptions-64s.S | 16 +-
arch/powerpc/mm/40x_mmu.c | 10 +-
arch/powerpc/mm/Makefile | 9 +-
arch/powerpc/mm/hash64_4k.c | 123 +++
arch/powerpc/mm/hash64_64k.c | 313 ++++++
arch/powerpc/mm/hash_low_64.S | 1003 --------------------
arch/powerpc/mm/hash_native_64.c | 10 +
arch/powerpc/mm/hash_utils_64.c | 105 +-
arch/powerpc/mm/hugepage-hash64.c | 20 +-
arch/powerpc/mm/hugetlbpage-hash64.c | 33 +-
arch/powerpc/mm/hugetlbpage.c | 76 +-
arch/powerpc/mm/pgtable.c | 4 +
arch/powerpc/mm/pgtable_64.c | 28 +-
arch/powerpc/mm/tlb_hash64.c | 2 +-
arch/powerpc/platforms/pseries/lpar.c | 10 +
41 files changed, 2725 insertions(+), 1941 deletions(-)
rename arch/powerpc/include/asm/{pte-hash32.h => book3s/32/hash.h} (93%)
create mode 100644 arch/powerpc/include/asm/book3s/32/pgtable.h
create mode 100644 arch/powerpc/include/asm/book3s/64/hash-4k.h
create mode 100644 arch/powerpc/include/asm/book3s/64/hash-64k.h
create mode 100644 arch/powerpc/include/asm/book3s/64/hash.h
create mode 100644 arch/powerpc/include/asm/book3s/64/pgtable.h
create mode 100644 arch/powerpc/include/asm/book3s/pgtable.h
rename arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} (96%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-40x.h (95%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-44x.h (96%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-8xx.h (95%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-fsl-booke.h (88%)
rename arch/powerpc/include/asm/{pgtable-ppc64-4k.h => nohash/64/pgtable-4k.h} (92%)
rename arch/powerpc/include/asm/{pgtable-ppc64-64k.h => nohash/64/pgtable-64k.h} (90%)
rename arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} (56%)
create mode 100644 arch/powerpc/include/asm/nohash/pgtable.h
rename arch/powerpc/include/asm/{ => nohash}/pte-book3e.h (95%)
delete mode 100644 arch/powerpc/include/asm/pte-hash64-4k.h
delete mode 100644 arch/powerpc/include/asm/pte-hash64-64k.h
delete mode 100644 arch/powerpc/include/asm/pte-hash64.h
create mode 100644 arch/powerpc/mm/hash64_4k.c
create mode 100644 arch/powerpc/mm/hash64_64k.c
delete mode 100644 arch/powerpc/mm/hash_low_64.SSignature · 1 line
2.5.0
PATCH v5 1/31 powerpc/mm: move pte headers to book3s directory
---
arch/powerpc/include/asm/{pte-hash32.h => book3s/32/hash.h} | 0
arch/powerpc/include/asm/{pte-hash64.h => book3s/64/hash.h} | 0
arch/powerpc/include/asm/pgtable-ppc32.h | 2 +-
arch/powerpc/include/asm/pgtable-ppc64.h | 2 +-
4 files changed, 2 insertions(+), 2 deletions(-)
rename arch/powerpc/include/asm/{pte-hash32.h => book3s/32/hash.h} (100%)
rename arch/powerpc/include/asm/{pte-hash64.h => book3s/64/hash.h} (100%)arch/powerpc/include/asm/book3s/32/hash.h renamed from arch/powerpc/include/asm/pte-hash32.h +0 -0
arch/powerpc/include/asm/book3s/64/hash.h renamed from arch/powerpc/include/asm/pte-hash64.h +0 -0
arch/powerpc/include/asm/pgtable-ppc32.h +1 -1
@@ -116,7 +116,7 @@ extern int icache_44x_need_flush;#elif defined(CONFIG_8xx)#include <asm/pte-8xx.h> #else /* CONFIG_6xx */ -#include <asm/pte-hash32.h> +#include <asm/book3s/32/hash.h> #endif /* And here we include common definitions */
arch/powerpc/include/asm/pgtable-ppc64.h +1 -1
@@ -98,7 +98,7 @@* Include the PTE bits definitions */ #ifdef CONFIG_PPC_BOOK3S -#include <asm/pte-hash64.h> +#include <asm/book3s/64/hash.h> #else #include <asm/pte-book3e.h> #endif
Signature · 1 line
2.5.0
PATCH v5 2/31 powerpc/mm: move pte headers to book3s directory (part 2)
In reply to Aneesh Kumar K.VSplitting this so that rename can track changes to file. Before merging we will fold this
---
arch/powerpc/include/asm/book3s/32/hash.h | 6 +++---
.../include/asm/{pte-hash64-4k.h => book3s/64/hash-4k.h} | 1 -
.../include/asm/{pte-hash64-64k.h => book3s/64/hash-64k.h} | 0
arch/powerpc/include/asm/book3s/64/hash.h | 10 +++++-----
4 files changed, 8 insertions(+), 9 deletions(-)
rename arch/powerpc/include/asm/{pte-hash64-4k.h => book3s/64/hash-4k.h} (99%)
rename arch/powerpc/include/asm/{pte-hash64-64k.h => book3s/64/hash-64k.h} (100%)arch/powerpc/include/asm/book3s/32/hash.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_HASH32_H -#define _ASM_POWERPC_PTE_HASH32_H +#ifndef _ASM_POWERPC_BOOK3S_32_HASH_H +#define _ASM_POWERPC_BOOK3S_32_HASH_H#ifdef __KERNEL__/*
@@ -43,4 +43,4 @@#define PTE_ATOMIC_UPDATES 1#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_HASH32_H */ +#endif /* _ASM_POWERPC_BOOK3S_32_HASH_H */
arch/powerpc/include/asm/book3s/64/hash-4k.h renamed from arch/powerpc/include/asm/pte-hash64-4k.h +0 -1
@@ -14,4 +14,3 @@/* shift to put page number into pte */ #define PTE_RPN_SHIFT (17) -
arch/powerpc/include/asm/book3s/64/hash-64k.h renamed from arch/powerpc/include/asm/pte-hash64-64k.h +0 -0
arch/powerpc/include/asm/book3s/64/hash.h +5 -5
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_HASH64_H -#define _ASM_POWERPC_PTE_HASH64_H +#ifndef _ASM_POWERPC_BOOK3S_64_HASH_H +#define _ASM_POWERPC_BOOK3S_64_HASH_H#ifdef __KERNEL__/*
@@ -45,10 +45,10 @@#define PTE_ATOMIC_UPDATES 1#ifdef CONFIG_PPC_64K_PAGES -#include <asm/pte-hash64-64k.h> +#include <asm/book3s/64/hash-64k.h> #else -#include <asm/pte-hash64-4k.h> +#include <asm/book3s/64/hash-4k.h> #endif #endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_HASH64_H */ +#endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
Signature · 1 line
2.5.0
Re: [PATCH V5 02/31] powerpc/mm: move pte headers to book3s directory (part 2)
arch/powerpc/include/asm/book3s/64/hash-4k.h line 17
Quoted 12 lines · Aneesh Kumar K.V
arch/powerpc/include/asm/book3s/64/hash-4k.h renamed from arch/powerpc/include/asm/pte-hash64-4k.h +0
-1@@ -14,4 +14,3 @@/* shift to put page number into pte */ #define PTE_RPN_SHIFT (17) -
Is there any specific reason to remove this one line while renaming & moving the header file ? It will be cleaner not to make any changes to the header while moving it around.
PATCH v5 3/31 powerpc/mm: make a separate copy for book3s
In reply to Aneesh Kumar K.VIn this patch we do:
cp pgtable-ppc32.h book3s/32/pgtable.h
cp pgtable-ppc64.h book3s/64/pgtable.h
This enable us to do further changes to hash specific config. We will change the page table format for 64bit hash in later patches.
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 340 +++++++++++++++ arch/powerpc/include/asm/book3s/64/pgtable.h | 626 +++++++++++++++++++++++++++ arch/powerpc/include/asm/book3s/pgtable.h | 10 + arch/powerpc/include/asm/mmu-hash64.h | 2 +- arch/powerpc/include/asm/pgtable.h | 4 + 5 files changed, 981 insertions(+), 1 deletion(-) create mode 100644 arch/powerpc/include/asm/book3s/32/pgtable.h create mode 100644 arch/powerpc/include/asm/book3s/64/pgtable.h create mode 100644 arch/powerpc/include/asm/book3s/pgtable.h
arch/powerpc/include/asm/book3s/32/pgtable.h new file +340 -0
@@ -0,0 +1,340 @@ +#ifndef _ASM_POWERPC_PGTABLE_PPC32_H +#define _ASM_POWERPC_PGTABLE_PPC32_H + +#include <asm-generic/pgtable-nopmd.h> + +#ifndef __ASSEMBLY__ +#include <linux/sched.h> +#include <linux/threads.h> +#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */ + +extern unsigned long ioremap_bot; + +#ifdef CONFIG_44x +extern int icache_44x_need_flush; +#endif + +#endif /* __ASSEMBLY__ */ + +/* +* The normal case is that PTEs are 32-bits and we have a 1-page +* 1024-entry pgdir pointing to 1-page 1024-entry PTE pages. -- paulus +* +* For any >32-bit physical address platform, we can use the following +* two level page table layout where the pgdir is 8KB and the MS 13 bits +* are an index to the second level table. The combined pgdir/pmd first +* level has 2048 entries and the second level has 512 64-bit PTE entries. +* -Matt +*/ +/* PGDIR_SHIFT determines what a top-level page table entry can map */ +#define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) +#define PGDIR_MASK (~(PGDIR_SIZE-1)) + +/* +* entries per page directory level: our page-table tree is two-level, so +* we don't really have any PMD directory. +*/ +#ifndef __ASSEMBLY__ +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT)) +#endif /* __ASSEMBLY__ */ + +#define PTRS_PER_PTE (1 << PTE_SHIFT) +#define PTRS_PER_PMD 1 +#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT)) + +#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) +#define FIRST_USER_ADDRESS 0UL + +#define pte_ERROR (e) \ + pr_err("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \ + (unsigned long long)pte_val(e)) +#define pgd_ERROR (e) \ + pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) + +/* +* This is the bottom of the PKMAP area with HIGHMEM or an arbitrary +* value (for now) on others, from where we can start layout kernel +* virtual space that goes below PKMAP and FIXMAP +*/ +#ifdef CONFIG_HIGHMEM +#define KVIRT_TOP PKMAP_BASE +#else +#define KVIRT_TOP (0xfe000000UL)/* for now, could be FIXMAP_BASE ? */ +#endif + +/* +* ioremap_bot starts at that address. Early ioremaps move down from there, +* until mem_init() at which point this becomes the top of the vmalloc +* and ioremap space +*/ +#ifdef CONFIG_NOT_COHERENT_CACHE +#define IOREMAP_TOP ((KVIRT_TOP - CONFIG_CONSISTENT_SIZE) & PAGE_MASK) +#else +#define IOREMAP_TOP KVIRT_TOP +#endif + +/* +* Just any arbitrary offset to the start of the vmalloc VM area: the +* current 16MB value just means that there will be a 64MB "hole" after the +* physical memory until the kernel virtual memory starts. That means that +* any out-of-bounds memory accesses will hopefully be caught. +* The vmalloc() routines leaves a hole of 4kB between each vmalloced +* area for the same reason. ;) +* +* We no longer map larger than phys RAM with the BATs so we don't have +* to worry about the VMALLOC_OFFSET causing problems. We do have to worry +* about clashes between our early calls to ioremap() that start growing down +* from ioremap_base being run into the VM area allocations (growing upwards +* from VMALLOC_START). For this reason we have ioremap_bot to check when +* we actually run into our mappings setup in the early boot with the VM +* system. This really does become a problem for machines with good amounts +* of RAM. -- Cort +*/ +#define VMALLOC_OFFSET (0x1000000)/* 16M */ +#ifdef PPC_PIN_SIZE +#define VMALLOC_START (((_ALIGN((long)high_memory, PPC_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) +#else +#define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) +#endif +#define VMALLOC_END ioremap_bot + +/* +* Bits in a linux-style PTE. These match the bits in the +* (hardware-defined) PowerPC PTE as closely as possible. +*/ + +#if defined(CONFIG_40x) +#include <asm/pte-40x.h> +#elif defined(CONFIG_44x) +#include <asm/pte-44x.h> +#elif defined(CONFIG_FSL_BOOKE ) && defined(CONFIG_PTE_64BIT ) +#include <asm/pte-book3e.h> +#elif defined(CONFIG_FSL_BOOKE ) +#include <asm/pte-fsl-booke.h> +#elif defined(CONFIG_8xx) +#include <asm/pte-8xx.h> +#else /* CONFIG_6xx */ +#include <asm/book3s/32/hash.h> +#endif + +/* And here we include common definitions */ +#include <asm/pte-common.h> + +#ifndef __ASSEMBLY__ + +#define pte_clear (mm, addr, ptep) \ + do { pte_update(ptep, ~_PAGE_HASHPTE, 0); } while (0) + +#define pmd_none (pmd) (!pmd_val(pmd)) +#define pmd_bad (pmd) (pmd_val(pmd) & _PMD_BAD) +#define pmd_present (pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK) +#define pmd_clear (pmdp) do { pmd_val(*(pmdp)) = 0; } while (0) + +/* +* When flushing the tlb entry for a page, we also need to flush the hash +* table entry. flush_hash_pages is assembler (for speed) in hashtable.S. +*/ +extern int flush_hash_pages (unsigned context,unsigned long va, +unsigned long pmdval,int count); + +/* Add an HPTE to the hash table */ +extern void add_hash_page (unsigned context,unsigned long va, +unsigned long pmdval); + +/* Flush an entry from the TLB/hash table */ +extern void flush_hash_entry (struct mm_struct *mm,pte_t *ptep, +unsigned long address); + +/* +* PTE updates. This function is called whenever an existing +* valid PTE is updated. This does -not- include set_pte_at() +* which nowadays only sets a new PTE. +* +* Depending on the type of MMU, we may need to use atomic updates +* and the PTE may be either 32 or 64 bit wide. In the later case, +* when using atomic updates, only the low part of the PTE is +* accessed atomically. +* +* In addition, on 44x, we also maintain a global flag indicating +* that an executable user mapping was modified, which is needed +* to properly flush the virtually tagged instruction cache of +* those implementations. +*/ +#ifndef CONFIG_PTE_64BIT +static inline unsigned long pte_update (pte_t *p, +unsigned long clr, +unsigned long set) +{ +#ifdef PTE_ATOMIC_UPDATES +unsigned long old, tmp; + + __asm__ __volatile__("\ +1: lwarx %0,0,%3\n\ +andc %1,%0,%4\n\ +or %1,%1,%5\n" + PPC405_ERR77(0,%3) +" stwcx. %1,0,%3\n\ + bne- 1b" + : "=&r" (old), "=&r" (tmp), "=m" (*p) + : "r" (p), "r" (clr), "r" (set), "m" (*p) + : "cc" ); +#else /* PTE_ATOMIC_UPDATES */ +unsigned long old =pte_val (*p); + *p =__pte ((old & ~clr) | set); +#endif /* !PTE_ATOMIC_UPDATES */ + +#ifdef CONFIG_44x +if ((old & _PAGE_USER) && (old & _PAGE_EXEC)) + icache_44x_need_flush =1 ; +#endif +return old; +} +#else /* CONFIG_PTE_64BIT */ +static inline unsigned long long pte_update (pte_t *p, +unsigned long clr, +unsigned long set) +{ +#ifdef PTE_ATOMIC_UPDATES +unsigned long long old; +unsigned long tmp; + + __asm__ __volatile__("\ +1: lwarx %L0,0,%4\n\ +lwzx %0,0,%3\n\ +andc %1,%L0,%5\n\ +or %1,%1,%6\n" + PPC405_ERR77(0,%3) +" stwcx. %1,0,%4\n\ + bne- 1b" + : "=&r" (old), "=&r" (tmp), "=m" (*p) + : "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p) + : "cc" ); +#else /* PTE_ATOMIC_UPDATES */ +unsigned long long old =pte_val (*p); + *p =__pte ((old & ~(unsigned long long )clr) | set); +#endif /* !PTE_ATOMIC_UPDATES */ + +#ifdef CONFIG_44x +if ((old & _PAGE_USER) && (old & _PAGE_EXEC)) + icache_44x_need_flush =1 ; +#endif +return old; +} +#endif /* CONFIG_PTE_64BIT */ + +/* +* 2.6 calls this without flushing the TLB entry; this is wrong +* for our hash-based implementation, we fix that up here. +*/ +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +static inline int __ptep_test_and_clear_young (unsigned int context,unsigned long addr,pte_t *ptep) +{ +unsigned long old; + old =pte_update (ptep, _PAGE_ACCESSED,0 ); +#if _PAGE_HASHPTE !=0 +if (old & _PAGE_HASHPTE) { +unsigned long ptephys =__pa (ptep) &PAGE_MASK ; +flush_hash_pages (context, addr, ptephys,1 ); + } +#endif +return (old & _PAGE_ACCESSED) !=0 ; +} +#define ptep_test_and_clear_young (__vma, __addr, __ptep) \ + __ptep_test_and_clear_young((__vma)->vm_mm->context.id, __addr, __ptep) + +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR +static inline pte_t ptep_get_and_clear (struct mm_struct *mm,unsigned long addr, +pte_t *ptep) +{ +return __pte (pte_update (ptep, ~_PAGE_HASHPTE,0 )); +} + +#define __HAVE_ARCH_PTEP_SET_WRPROTECT +static inline void ptep_set_wrprotect (struct mm_struct *mm,unsigned long addr, +pte_t *ptep) +{ +pte_update (ptep, (_PAGE_RW | _PAGE_HWWRITE), _PAGE_RO); +} +static inline void huge_ptep_set_wrprotect (struct mm_struct *mm, +unsigned long addr,pte_t *ptep) +{ +ptep_set_wrprotect (mm, addr, ptep); +} + + +static inline void __ptep_set_access_flags (pte_t *ptep,pte_t entry) +{ +unsigned long set =pte_val (entry) & + (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); +unsigned long clr = ~pte_val (entry) & _PAGE_RO; + +pte_update (ptep, clr, set); +} + +#define __HAVE_ARCH_PTE_SAME +#define pte_same (A ,B ) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0) + +/* +* Note that on Book E processors, the pmd contains the kernel virtual +* (lowmem) address of the pte page. The physical address is less useful +* because everything runs with translation enabled (even the TLB miss +* handler). On everything else the pmd contains the physical address +* of the pte page. -- paulus +*/ +#ifndef CONFIG_BOOKE +#define pmd_page_vaddr (pmd) \ + ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) +#define pmd_page (pmd) \ + pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT) +#else +#define pmd_page_vaddr (pmd) \ + ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) +#define pmd_page (pmd) \ + pfn_to_page((__pa(pmd_val(pmd)) >> PAGE_SHIFT)) +#endif + +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k (address) pgd_offset(&init_mm, address) + +/* to find an entry in a page-table-directory */ +#define pgd_index (address) ((address) >> PGDIR_SHIFT) +#define pgd_offset (mm, address) ((mm)->pgd + pgd_index(address)) + +/* Find an entry in the third-level page table.. */ +#define pte_index (address) \ + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_offset_kernel (dir, addr) \ + ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) +#define pte_offset_map (dir, addr) \ + ((pte_t *) kmap_atomic(pmd_page(*(dir))) + pte_index(addr)) +#define pte_unmap (pte) kunmap_atomic(pte) + +/* +* Encode and decode a swap entry. +* Note that the bits we use in a PTE for representing a swap entry +* must not include the _PAGE_PRESENT bit or the _PAGE_HASHPTE bit (if used). +* -- paulus +*/ +#define __swp_type (entry) ((entry).val & 0x1f) +#define __swp_offset (entry) ((entry).val >> 5) +#define __swp_entry (type, offset) ((swp_entry_t) { (type) | ((offset) << 5) }) +#define __pte_to_swp_entry (pte) ((swp_entry_t) { pte_val(pte) >> 3 }) +#define __swp_entry_to_pte (x) ((pte_t) { (x).val << 3 }) + +#ifndef CONFIG_PPC_4K_PAGES +void pgtable_cache_init (void ); +#else +/* +* No page table caches to initialise +*/ +#define pgtable_cache_init () do { } while (0) +#endif + +extern int get_pteptr (struct mm_struct *mm,unsigned long addr,pte_t **ptep, +pmd_t **pmdp); + +#endif /* !__ASSEMBLY__ */ + +#endif /* _ASM_POWERPC_PGTABLE_PPC32_H */
arch/powerpc/include/asm/book3s/64/pgtable.h new file +626 -0
626 lines not on this page · raw message
arch/powerpc/include/asm/book3s/pgtable.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _ASM_POWERPC_BOOK3S_PGTABLE_H +#define _ASM_POWERPC_BOOK3S_PGTABLE_H + +#ifdef CONFIG_PPC64 +#include <asm/book3s/64/pgtable.h> +#else +#include <asm/book3s/32/pgtable.h> +#endif + +#endif
arch/powerpc/include/asm/mmu-hash64.h +1 -1
@@ -21,7 +21,7 @@* need for various slices related matters. Note that this isn't the * complete pgtable.h but only a portion of it. */ -#include <asm/pgtable-ppc64.h> +#include <asm/book3s/64/pgtable.h> #include <asm/bug.h> #include <asm/processor.h>
arch/powerpc/include/asm/pgtable.h +4 -0
@@ -13,11 +13,15 @@ struct mm_struct;#endif /* !__ASSEMBLY__ */ +#ifdef CONFIG_PPC_BOOK3S +#include <asm/book3s/pgtable.h> +#else #if defined(CONFIG_PPC64 )# include <asm/pgtable-ppc64.h> #else # include <asm/pgtable-ppc32.h> #endif +#endif /* !CONFIG_PPC_BOOK3S */ /* * We save the slot number & secondary bit in the second half of the
Signature · 1 line
2.5.0
Re: [PATCH V5 03/31] powerpc/mm: make a separate copy for book3s
arch/powerpc/include/asm/book3s/pgtable.h line 10
Quoted 12 lines · Aneesh Kumar K.V
+++
b/arch/powerpc/include/asm/book3s/pgtable.harch/powerpc/include/asm/book3s/pgtable.h new file +10
-0@@ -0,0 +1,10 @@ +#ifndef _ASM_POWERPC_BOOK3S_PGTABLE_H +#define _ASM_POWERPC_BOOK3S_PGTABLE_H + +#ifdef CONFIG_PPC64 +#include <asm/book3s/64/pgtable.h> +#else +#include <asm/book3s/32/pgtable.h> +#endif + +#endif
Just as other headers, you may want to change the last line as the following.
#endif /* _ASM_POWERPC_BOOK3S_PGTABLE_H */
PATCH v5 4/31 powerpc/mm: make a separate copy for book3s (part 2)
In reply to Aneesh Kumar K.VKeep it seperate to make rebasing easier
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++-- arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +++--- arch/powerpc/include/asm/pgtable-ppc32.h | 2 -- arch/powerpc/include/asm/pgtable-ppc64.h | 4 ---- 4 files changed, 5 insertions(+), 11 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC32_H -#define _ASM_POWERPC_PGTABLE_PPC32_H +#ifndef _ASM_POWERPC_BOOK3S_32_PGTABLE_H +#define _ASM_POWERPC_BOOK3S_32_PGTABLE_H#include <asm-generic/pgtable-nopmd.h>
arch/powerpc/include/asm/book3s/64/pgtable.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC64_H_ -#define _ASM_POWERPC_PGTABLE_PPC64_H_ +#ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ +#define _ASM_POWERPC_BOOK3S_64_PGTABLE_H_/* * This file contains the functions and defines necessary to modify and use * the ppc64 hashed page table.
@@ -623,4 +623,4 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,return true; }#endif /* __ASSEMBLY__ */ -#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ +#endif /* _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ */
arch/powerpc/include/asm/pgtable-ppc32.h +0 -2
@@ -115,8 +115,6 @@ extern int icache_44x_need_flush;#include <asm/pte-fsl-booke.h> #elif defined(CONFIG_8xx)#include <asm/pte-8xx.h> -#else /* CONFIG_6xx */ -#include <asm/book3s/32/hash.h> #endif /* And here we include common definitions */
arch/powerpc/include/asm/pgtable-ppc64.h +0 -4
@@ -97,11 +97,7 @@/* * Include the PTE bits definitions */ -#ifdef CONFIG_PPC_BOOK3S -#include <asm/book3s/64/hash.h> -#else #include <asm/pte-book3e.h> -#endif #include <asm/pte-common.h> #ifdef CONFIG_PPC_MM_SLICES
Signature · 1 line
2.5.0
Re: [PATCH V5 04/31] powerpc/mm: make a separate copy for book3s (part 2)
Quoted 1 line · Aneesh Kumar K.V
Keep it seperate to make rebasing easier
This is confusing considering the fact that we are in between some renaming/moving of header files, changing the references they had before and so on. Could you please elaborate a bit about what kind of changes this patch has and their purpose.
Also if the movement involves multiple parts (like this one), it will be better to have detailed descriptions about each step in the commit message of the first patch itself to see how its being organized in the subsequent patches.
Quoted 15 lines
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++-- arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +++--- arch/powerpc/include/asm/pgtable-ppc32.h | 2 -- arch/powerpc/include/asm/pgtable-ppc64.h | 4 ---- 4 files changed, 5 insertions(+), 11 deletions(-)arch/powerpc/include/asm/book3s/32/pgtable.h +0
-0
arch/powerpc/include/asm/book3s/32/pgtable.h line 2
Quoted 4 lines
arch/powerpc/include/asm/book3s/32/pgtable.h +2
-2@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC32_H -#define _ASM_POWERPC_PGTABLE_PPC32_H +#ifndef _ASM_POWERPC_BOOK3S_32_PGTABLE_H +#define _ASM_POWERPC_BOOK3S_32_PGTABLE_H
I guess this is missing here.
-#endif /* _ASM_POWERPC_PGTABLE_PPC32_H */
+#endif /* _ASM_POWERPC_BOOK3S_32_PGTABLE_H */
PATCH v5 5/31 powerpc/mm: Move hash specific pte width and other defines to book3s
In reply to Aneesh Kumar K.VThis further make a copy of pte defines to book3s/64/hash*.h. This remove the dependency on ppc64-4k.h and ppc64-64k.h
--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 87 ++++++++++++++++++++++++++- arch/powerpc/include/asm/book3s/64/hash-64k.h | 46 +++++++++++++- arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +- 3 files changed, 130 insertions(+), 9 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-4k.h +86 -1
@@ -1,4 +1,51 @@ -/* To be include by pgtable-hash64.h only */ +#ifndef _ASM_POWERPC_BOOK3S_64_HASH_4K_H +#define _ASM_POWERPC_BOOK3S_64_HASH_4K_H +/* +* Entries per page directory level. The PTE level must use a 64b record +* for each page table entry. The PMD and PGD level use a 32b record for +* each entry by assuming that each entry is page aligned. +*/ +#define PTE_INDEX_SIZE 9 +#define PMD_INDEX_SIZE 7 +#define PUD_INDEX_SIZE 9 +#define PGD_INDEX_SIZE 9 + +#ifndef __ASSEMBLY__ +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) +#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) +#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) +#endif /* __ASSEMBLY__ */ + +#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) +#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) +#define PTRS_PER_PUD (1 << PUD_INDEX_SIZE) +#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) + +/* PMD_SHIFT determines what a second-level page table entry can map */ +#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE) +#define PMD_SIZE (1UL << PMD_SHIFT) +#define PMD_MASK (~(PMD_SIZE-1)) + +/* With 4k base page size, hugepage PTEs go at the PMD level */ +#define MIN_HUGEPTE_SHIFT PMD_SHIFT + +/* PUD_SHIFT determines what a third-level page table entry can map */ +#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) +#define PUD_SIZE (1UL << PUD_SHIFT) +#define PUD_MASK (~(PUD_SIZE-1)) + +/* PGDIR_SHIFT determines what a fourth-level page table entry can map */ +#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE) +#define PGDIR_SIZE (1UL << PGDIR_SHIFT) +#define PGDIR_MASK (~(PGDIR_SIZE-1)) + +/* Bits to mask out from a PMD to get to the PTE page */ +#define PMD_MASKED_BITS 0 +/* Bits to mask out from a PUD to get to the PMD page */ +#define PUD_MASKED_BITS 0 +/* Bits to mask out from a PGD to get to the PUD page */ +#define PGD_MASKED_BITS 0/* PTE bits */ #define _PAGE_HASHPTE 0x0400/* software: pte has an associated HPTE */
@@ -14,3 +61,41 @@/* shift to put page number into pte */ #define PTE_RPN_SHIFT (17) + +#ifndef __ASSEMBLY__ +/* +* 4-level page tables related bits +*/ + +#define pgd_none (pgd) (!pgd_val(pgd)) +#define pgd_bad (pgd) (pgd_val(pgd) == 0) +#define pgd_present (pgd) (pgd_val(pgd) != 0) +#define pgd_clear (pgdp) (pgd_val(*(pgdp)) = 0) +#define pgd_page_vaddr (pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) + +static inline pte_t pgd_pte (pgd_t pgd) +{ +return __pte (pgd_val (pgd)); +} + +static inline pgd_t pte_pgd (pte_t pte) +{ +return __pgd (pte_val (pte)); +} +extern struct page *pgd_page (pgd_t pgd); + +#define pud_offset (pgdp, addr) \ + (((pud_t *) pgd_page_vaddr(*(pgdp))) + \ + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) + +#define pud_ERROR (e) \ + pr_err("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e)) + +/* +* On all 4K setups, remap_4k_pfn() equates to remap_pfn_range() */ +#define remap_4k_pfn (vma, addr, pfn, prot) \ + remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot)) + +#endif /* !__ASSEMBLY__ */ + +#endif /* _ASM_POWERPC_BOOK3S_64_HASH_4K_H */
arch/powerpc/include/asm/book3s/64/hash-64k.h +43 -3
59 lines not on this page · raw message
arch/powerpc/include/asm/book3s/64/pgtable.h +1 -5
@@ -5,11 +5,7 @@* the ppc64 hashed page table. */ -#ifdef CONFIG_PPC_64K_PAGES -#include <asm/pgtable-ppc64-64k.h> -#else -#include <asm/pgtable-ppc64-4k.h> -#endif +#include <asm/book3s/64/hash.h> #include <asm/barrier.h> #define FIRST_USER_ADDRESS 0UL
Signature · 1 line
2.5.0
Re: [PATCH V5 05/31] powerpc/mm: Move hash specific pte width and other defines to book3s
Quoted 3 lines · Aneesh Kumar K.V
This further make a copy of pte defines to
book3s/64/hash*.h. This remove the dependency onppc64-4k.handppc64-64k.h
These files are pgtable-ppc64-4k.h and pgtable-ppc64-64k.h instead.
arch/powerpc/include/asm/book3s/64/hash-64k.h static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index) · line 109
Quoted 13 lines
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>/* Additional PTE bits (don't change without checking asm in
hash_low.S) */
#define_PAGE_SPECIAL0x00000400/* software: special page */arch/powerpc/include/asm/book3s/64/hash-64k.h +2
-2@@ -74,8 +105,8 @@ static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index)#define __rpte_to_pte (r) ((r).pte)#define __rpte_sub_valid (rpte, index) \ (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) - -/* Trick: we set __end to va + 64k, which happens works for +/* +* Trick: we set __end to va + 64k, which happens works for
The above change can be avoided in this patch and should be part of a separate cleanup patch.
PATCH v5 6/31 powerpc/mm: Delete booke bits from book3s
In reply to Aneesh Kumar K.VWe also move __ASSEMBLY__ towards the end of header. This avoid having #ifndef __ASSEMBLY___ all over the header
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 93 +++++++--------------------- arch/powerpc/include/asm/book3s/64/pgtable.h | 86 +++++++------------------ arch/powerpc/include/asm/book3s/pgtable.h | 1 + 3 files changed, 49 insertions(+), 131 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +24 -69
@@ -3,18 +3,10 @@#include <asm-generic/pgtable-nopmd.h> -#ifndef __ASSEMBLY__ -#include <linux/sched.h> -#include <linux/threads.h> -#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */ - -extern unsigned long ioremap_bot; - -#ifdef CONFIG_44x -extern int icache_44x_need_flush; -#endif +#include <asm/book3s/32/hash.h> -#endif /* __ASSEMBLY__ */ +/* And here we include common definitions */ +#include <asm/pte-common.h> /* * The normal case is that PTEs are 32-bits and we have a 1-page
@@ -31,28 +23,11 @@ extern int icache_44x_need_flush;#define PGDIR_SIZE (1UL << PGDIR_SHIFT)#define PGDIR_MASK (~(PGDIR_SIZE-1)) -/* -* entries per page directory level: our page-table tree is two-level, so -* we don't really have any PMD directory. -*/ -#ifndef __ASSEMBLY__ -#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT) -#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT)) -#endif /* __ASSEMBLY__ */ -#define PTRS_PER_PTE (1 << PTE_SHIFT)#define PTRS_PER_PMD 1#define PTRS_PER_PGD (1 << (32 - PGDIR_SHIFT))#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) -#define FIRST_USER_ADDRESS 0UL - -#define pte_ERROR (e) \ - pr_err("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \ - (unsigned long long)pte_val(e)) -#define pgd_ERROR (e) \ - pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) -/* * This is the bottom of the PKMAP area with HIGHMEM or an arbitrary * value (for now) on others, from where we can start layout kernel
@@ -100,30 +75,30 @@ extern int icache_44x_need_flush;#endif #define VMALLOC_END ioremap_bot +#ifndef __ASSEMBLY__ +#include <linux/sched.h> +#include <linux/threads.h> +#include <asm/io.h> /* For sub-arch specific PPC_PIN_SIZE */ + +extern unsigned long ioremap_bot; + +/* +* entries per page directory level: our page-table tree is two-level, so +* we don't really have any PMD directory. +*/ +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_SHIFT) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << (32 - PGDIR_SHIFT)) + +#define pte_ERROR (e) \ + pr_err("%s:%d: bad pte %llx.\n", __FILE__, __LINE__, \ + (unsigned long long)pte_val(e)) +#define pgd_ERROR (e) \ + pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))/* * Bits in a linux-style PTE. These match the bits in the * (hardware-defined) PowerPC PTE as closely as possible. */ -#if defined(CONFIG_40x) -#include <asm/pte-40x.h> -#elif defined(CONFIG_44x) -#include <asm/pte-44x.h> -#elif defined(CONFIG_FSL_BOOKE ) && defined(CONFIG_PTE_64BIT ) -#include <asm/pte-book3e.h> -#elif defined(CONFIG_FSL_BOOKE ) -#include <asm/pte-fsl-booke.h> -#elif defined(CONFIG_8xx) -#include <asm/pte-8xx.h> -#else /* CONFIG_6xx */ -#include <asm/book3s/32/hash.h> -#endif - -/* And here we include common definitions */ -#include <asm/pte-common.h> - -#ifndef __ASSEMBLY__ -#define pte_clear (mm, addr, ptep) \ do { pte_update(ptep, ~_PAGE_HASHPTE, 0); } while (0)
@@ -167,7 +142,6 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr, unsigned long set) { -#ifdef PTE_ATOMIC_UPDATES unsigned long old, tmp; __asm__ __volatile__("\
@@ -180,15 +154,7 @@ static inline unsigned long pte_update(pte_t *p, : "=&r" (old), "=&r" (tmp), "=m" (*p) : "r" (p), "r" (clr), "r" (set), "m" (*p) : "cc" ); -#else /* PTE_ATOMIC_UPDATES */ -unsigned long old =pte_val (*p); - *p =__pte ((old & ~clr) | set); -#endif /* !PTE_ATOMIC_UPDATES */ - -#ifdef CONFIG_44x -if ((old & _PAGE_USER) && (old & _PAGE_EXEC)) - icache_44x_need_flush =1 ; -#endif + return old; }#else /* CONFIG_PTE_64BIT */
@@ -196,7 +162,6 @@ static inline unsigned long long pte_update(pte_t *p, unsigned long clr, unsigned long set) { -#ifdef PTE_ATOMIC_UPDATES unsigned long long old;unsigned long tmp;
@@ -211,15 +176,7 @@ static inline unsigned long long pte_update(pte_t *p, : "=&r" (old), "=&r" (tmp), "=m" (*p) : "r" (p), "r" ((unsigned long)(p) + 4), "r" (clr), "r" (set), "m" (*p) : "cc" ); -#else /* PTE_ATOMIC_UPDATES */ -unsigned long long old =pte_val (*p); - *p =__pte ((old & ~(unsigned long long )clr) | set); -#endif /* !PTE_ATOMIC_UPDATES */ - -#ifdef CONFIG_44x -if ((old & _PAGE_USER) && (old & _PAGE_EXEC)) - icache_44x_need_flush =1 ; -#endif + return old; }#endif /* CONFIG_PTE_64BIT */
@@ -233,12 +190,10 @@ static inline int __ptep_test_and_clear_young(unsigned int context, unsigned lon {unsigned long old; old =pte_update (ptep, _PAGE_ACCESSED,0 ); -#if _PAGE_HASHPTE !=0 if (old & _PAGE_HASHPTE) {unsigned long ptephys =__pa (ptep) &PAGE_MASK ;flush_hash_pages (context, addr, ptephys,1 ); } -#endif return (old & _PAGE_ACCESSED) !=0 ; }#define ptep_test_and_clear_young (__vma, __addr, __ptep) \
arch/powerpc/include/asm/book3s/64/pgtable.h +24 -62
174 lines not on this page · raw message
arch/powerpc/include/asm/book3s/pgtable.h +1 -0
@@ -7,4 +7,5 @@#include <asm/book3s/32/pgtable.h> #endif +#define FIRST_USER_ADDRESS 0UL#endif
Signature · 1 line
2.5.0
PATCH v5 7/31 powerpc/mm: Don't have generic headers introduce functions touching pte bits
In reply to Aneesh Kumar K.VWe are going to drop pte_common.h in the later patch. The idea is to enable hash code not require to define all PTE bits. Having PTE bits defined in pte_common.h made the code unnecessarily complex.
--- arch/powerpc/include/asm/book3s/pgtable.h | 176 ++++++++++++++++++++++++++ arch/powerpc/include/asm/pgtable-book3e.h | 199 ++++++++++++++++++++++++++++++ arch/powerpc/include/asm/pgtable.h | 192 +--------------------------- 3 files changed, 376 insertions(+), 191 deletions(-) create mode 100644 arch/powerpc/include/asm/pgtable-book3e.h
arch/powerpc/include/asm/book3s/pgtable.h +176 -0
@@ -8,4 +8,180 @@#endif #define FIRST_USER_ADDRESS 0UL +#ifndef __ASSEMBLY__ + +/* Generic accessors to PTE bits */ +static inline int pte_write (pte_t pte) +{ +return (pte_val (pte) & (_PAGE_RW | _PAGE_RO)) != _PAGE_RO; +} +static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; } +static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; } +static inline int pte_special (pte_t pte) {return pte_val (pte) & _PAGE_SPECIAL; } +static inline int pte_none (pte_t pte) {return (pte_val (pte) & ~_PTE_NONE_MASK) ==0 ; } +static inline pgprot_t pte_pgprot (pte_t pte) {return __pgprot (pte_val (pte) &PAGE_PROT_BITS ); } + +#ifdef CONFIG_NUMA_BALANCING +/* +* These work without NUMA balancing but the kernel does not care. See the +* comment in include/asm-generic/pgtable.h . On powerpc, this will only +* work for user pages and always return true for kernel pages. +*/ +static inline int pte_protnone (pte_t pte) +{ +return (pte_val (pte) & + (_PAGE_PRESENT | _PAGE_USER)) == _PAGE_PRESENT; +} + +static inline int pmd_protnone (pmd_t pmd) +{ +return pte_protnone (pmd_pte (pmd)); +} +#endif /* CONFIG_NUMA_BALANCING */ + +static inline int pte_present (pte_t pte) +{ +return pte_val (pte) & _PAGE_PRESENT; +} + +/* Conversion functions: convert a page and protection to a page entry, +* and a page entry and page directory to the page they refer to. +* +* Even if PTEs can be unsigned long long, a PFN is always an unsigned +* long for now. +*/ +static inline pte_t pfn_pte (unsigned long pfn,pgprot_t pgprot) { +return __pte (((pte_basic_t)(pfn) <<PTE_RPN_SHIFT ) | +pgprot_val (pgprot)); } +static inline unsigned long pte_pfn (pte_t pte) { +return pte_val (pte) >>PTE_RPN_SHIFT ; } + +/* Generic modifiers for PTE bits */ +static inline pte_t pte_wrprotect (pte_t pte) { +pte_val (pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); +pte_val (pte) |= _PAGE_RO;return pte; } +static inline pte_t pte_mkclean (pte_t pte) { +pte_val (pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE);return pte; } +static inline pte_t pte_mkold (pte_t pte) { +pte_val (pte) &= ~_PAGE_ACCESSED;return pte; } +static inline pte_t pte_mkwrite (pte_t pte) { +pte_val (pte) &= ~_PAGE_RO; +pte_val (pte) |= _PAGE_RW;return pte; } +static inline pte_t pte_mkdirty (pte_t pte) { +pte_val (pte) |= _PAGE_DIRTY;return pte; } +static inline pte_t pte_mkyoung (pte_t pte) { +pte_val (pte) |= _PAGE_ACCESSED;return pte; } +static inline pte_t pte_mkspecial (pte_t pte) { +pte_val (pte) |= _PAGE_SPECIAL;return pte; } +static inline pte_t pte_mkhuge (pte_t pte) { +return pte; } +static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) +{ +pte_val (pte) = (pte_val (pte) & _PAGE_CHG_MASK) |pgprot_val (newprot); +return pte; +} + + +/* Insert a PTE, top-level function is out of line. It uses an inline +* low level function in the respective pgtable-* files +*/ +extern void set_pte_at (struct mm_struct *mm,unsigned long addr,pte_t *ptep, +pte_t pte); + +/* This low level function performs the actual PTE insertion +* Setting the PTE depends on the MMU type and other factors. It's +* an horrible mess that I'm not going to try to clean up now but +* I'm keeping it in one place rather than spread around +*/ +static inline void __set_pte_at (struct mm_struct *mm,unsigned long addr, +pte_t *ptep,pte_t pte,int percpu) +{ +#if defined(CONFIG_PPC_STD_MMU_32 ) && defined(CONFIG_SMP ) && !defined(CONFIG_PTE_64BIT ) +/* First case is 32-bit Hash MMU in SMP mode with 32-bit PTEs. We use the +* helper pte_update() which does an atomic update. We need to do that +* because a concurrent invalidation can clear _PAGE_HASHPTE. If it's a +* per-CPU PTE such as a kmap_atomic, we do a simple update preserving +* the hash bits instead (ie, same as the non-SMP case) +*/ +if (percpu) + *ptep =__pte ((pte_val (*ptep) & _PAGE_HASHPTE) + | (pte_val (pte) & ~_PAGE_HASHPTE)); +else +pte_update (ptep, ~_PAGE_HASHPTE,pte_val (pte)); + +#elif defined(CONFIG_PPC32 ) && defined(CONFIG_PTE_64BIT ) +/* Second case is 32-bit with 64-bit PTE. In this case, we +* can just store as long as we do the two halves in the right order +* with a barrier in between. This is possible because we take care, +* in the hash code, to pre-invalidate if the PTE was already hashed, +* which synchronizes us with any concurrent invalidation. +* In the percpu case, we also fallback to the simple update preserving +* the hash bits +*/ +if (percpu) { + *ptep =__pte ((pte_val (*ptep) & _PAGE_HASHPTE) + | (pte_val (pte) & ~_PAGE_HASHPTE)); +return ; + } +if (pte_val (*ptep) & _PAGE_HASHPTE) +flush_hash_entry (mm, ptep, addr); + __asm__ __volatile__("\ +stw%U0%X0 %2,%0\n\ +eieio\n\ +stw%U0%X0 %L2,%1" + :"=m" (*ptep),"=m" (*((unsigned char *)ptep+4 )) + :"r" (pte) :"memory" ); + +#elif defined(CONFIG_PPC_STD_MMU_32 ) +/* Third case is 32-bit hash table in UP mode, we need to preserve +* the _PAGE_HASHPTE bit since we may not have invalidated the previous +* translation in the hash yet (done in a subsequent flush_tlb_xxx()) +* and see we need to keep track that this PTE needs invalidating +*/ + *ptep =__pte ((pte_val (*ptep) & _PAGE_HASHPTE) + | (pte_val (pte) & ~_PAGE_HASHPTE)); + +#else +/* Anything else just stores the PTE normally. That covers all 64-bit +* cases, and 32-bit non-hash with 32-bit PTEs. +*/ + *ptep = pte; +#endif +} + + +#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS +extern int ptep_set_access_flags (struct vm_area_struct *vma,unsigned long address, +pte_t *ptep,pte_t entry,int dirty); + +/* +* Macro to mark a page protection value as "uncacheable". +*/ + +#define _PAGE_CACHE_CTL (_PAGE_COHERENT | _PAGE_GUARDED | _PAGE_NO_CACHE | \ + _PAGE_WRITETHRU) + +#define pgprot_noncached (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ + _PAGE_NO_CACHE | _PAGE_GUARDED)) + +#define pgprot_noncached_wc (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ + _PAGE_NO_CACHE)) + +#define pgprot_cached (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ + _PAGE_COHERENT)) + +#define pgprot_cached_wthru (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ + _PAGE_COHERENT | _PAGE_WRITETHRU)) + +#define pgprot_cached_noncoherent (prot) \ + (__pgprot(pgprot_val(prot) & ~_PAGE_CACHE_CTL)) + +#define pgprot_writecombine pgprot_noncached_wc + +struct file ; +extern pgprot_t phys_mem_access_prot (struct file *file,unsigned long pfn, +unsigned long size,pgprot_t vma_prot); +#define __HAVE_PHYS_MEM_ACCESS_PROT + +#endif /* __ASSEMBLY__ */ #endif
arch/powerpc/include/asm/pgtable-book3e.h new file +199 -0
199 lines not on this page · raw message
arch/powerpc/include/asm/pgtable.h +1 -191
217 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v5 8/31 powerpc/mm: Drop pte-common.h from BOOK3S 64
In reply to Aneesh Kumar K.VWe copy only needed PTE bits define from pte-common.h to respective hash related header. This should greatly simply later patches in which we are going to change the pte format for hash config
--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 1 + arch/powerpc/include/asm/book3s/64/hash.h | 2 + arch/powerpc/include/asm/book3s/64/pgtable.h | 106 ++++++++++++++++++++++++++- arch/powerpc/include/asm/book3s/pgtable.h | 16 ++-- 4 files changed, 113 insertions(+), 12 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-4k.h +1 -0
@@ -62,6 +62,7 @@/* shift to put page number into pte */ #define PTE_RPN_SHIFT (17) +#define _PAGE_4K_PFN 0#ifndef __ASSEMBLY__/* * 4-level page tables related bits
arch/powerpc/include/asm/book3s/64/hash.h +2 -0
@@ -20,6 +20,7 @@#define _PAGE_EXEC 0x0004/* No execute on POWER4 and newer (we invert) */ #define _PAGE_GUARDED 0x0008/* We can derive Memory coherence from _PAGE_NO_CACHE */ +#define _PAGE_COHERENT 0x0#define _PAGE_NO_CACHE 0x0020/* I: cache inhibit */ #define _PAGE_WRITETHRU 0x0040/* W: cache write-through */ #define _PAGE_DIRTY 0x0080/* C: page changed */
@@ -30,6 +31,7 @@/* No separate kernel read-only */ #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY)/* user access blocked by key */ #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW +#define _PAGE_KERNEL_RWX (_PAGE_DIRTY | _PAGE_RW | _PAGE_EXEC)/* Strong Access Ordering */ #define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT)
arch/powerpc/include/asm/book3s/64/pgtable.h +103 -3
114 lines not on this page · raw message
arch/powerpc/include/asm/book3s/pgtable.h +7 -9
@@ -11,10 +11,7 @@#ifndef __ASSEMBLY__/* Generic accessors to PTE bits */ -static inline int pte_write (pte_t pte) -{ -return (pte_val (pte) & (_PAGE_RW | _PAGE_RO)) != _PAGE_RO; -} +static inline int pte_write (pte_t pte) {return !!(pte_val (pte) & _PAGE_RW);}static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; }static inline int pte_special (pte_t pte) {return pte_val (pte) & _PAGE_SPECIAL; }
@@ -57,15 +54,16 @@ static inline unsigned long pte_pfn(pte_t pte) {return pte_val (pte) >>PTE_RPN_SHIFT ; }/* Generic modifiers for PTE bits */ -static inline pte_t pte_wrprotect (pte_t pte) { -pte_val (pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); -pte_val (pte) |= _PAGE_RO;return pte; } +static inline pte_t pte_wrprotect (pte_t pte) +{ +pte_val (pte) &= ~_PAGE_RW; +return pte; +}static inline pte_t pte_mkclean (pte_t pte) { -pte_val (pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE);return pte; } +pte_val (pte) &= ~_PAGE_DIRTY;return pte; }static inline pte_t pte_mkold (pte_t pte) {pte_val (pte) &= ~_PAGE_ACCESSED;return pte; }static inline pte_t pte_mkwrite (pte_t pte) { -pte_val (pte) &= ~_PAGE_RO;pte_val (pte) |= _PAGE_RW;return pte; }static inline pte_t pte_mkdirty (pte_t pte) {pte_val (pte) |= _PAGE_DIRTY;return pte; }
Signature · 1 line
2.5.0
Re: [PATCH V5 08/31] powerpc/mm: Drop pte-common.h from BOOK3S 64
Quoted 2 lines · Aneesh Kumar K.V
We copy only needed PTE bits define from
pte-common.hto respective hash related header. This should greatly simply later patches in which
Will it be simplify ^^^^^^^^
Quoted 51 lines
we are going to change the pte format for hash config
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 1 + arch/powerpc/include/asm/book3s/64/hash.h | 2 + arch/powerpc/include/asm/book3s/64/pgtable.h | 106 ++++++++++++++++++++++++++- arch/powerpc/include/asm/book3s/pgtable.h | 16 ++-- 4 files changed, 113 insertions(+), 12 deletions(-)arch/powerpc/include/asm/book3s/64/hash-4k.h +1
-0@@ -62,6 +62,7 @@/* shift to put page number into pte */ #define PTE_RPN_SHIFT (17) +#define _PAGE_4K_PFN 0#ifndef __ASSEMBLY__/* * 4-level page tables related bits arch/powerpc/include/asm/book3s/64/hash.h +2
-0@@ -20,6 +20,7 @@#define _PAGE_EXEC 0x0004/* No execute on POWER4 and newer (we invert) */ #define _PAGE_GUARDED 0x0008/* We can derive Memory coherence from _PAGE_NO_CACHE */ +#define _PAGE_COHERENT 0x0#define _PAGE_NO_CACHE 0x0020/* I: cache inhibit */ #define _PAGE_WRITETHRU 0x0040/* W: cache write-through */ #define _PAGE_DIRTY 0x0080/* C: page changed */ @@ -30,6 +31,7 @@/* No separate kernel read-only */ #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY)/* user access blocked by key */ #define _PAGE_KERNEL_RO _PAGE_KERNEL_RW +#define _PAGE_KERNEL_RWX (_PAGE_DIRTY | _PAGE_RW | _PAGE_EXEC)/* Strong Access Ordering */ #define _PAGE_SAO (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT)arch/powerpc/include/asm/book3s/64/pgtable.h +0
-0@@ -94,11 +94,111 @@#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ _PAGE_THP_HUGE)
arch/powerpc/include/asm/book3s/64/pgtable.h line 103
Quoted 10 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +5
-3+#define _PTE_NONE_MASK _PAGE_HPTEFLAGS/* -* Default defines for things which we don't use. -* We should get this removed. +* The mask convered by the RPN must be a ULL on 32-bit platforms with +* 64-bit PTEs +* FIXME!! double check the RPN_MAX May be not used */ -#include <asm/pte-common.h> +//#define PTE_RPN_MAX (1UL << (32 - PTE_RPN_SHIFT))
Why this commented definition, this was not part of original PTE definitions in pte-common.h
Quoted 18 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +0
-0/* arch/powerpc/include/asm/book3s/pgtable.h +1
-5@@ -11,10 +11,7 @@#ifndef __ASSEMBLY__/* Generic accessors to PTE bits */ -static inline int pte_write (pte_t pte) -{ -return (pte_val (pte) & (_PAGE_RW | _PAGE_RO)) != _PAGE_RO; -} +static inline int pte_write (pte_t pte) {return !!(pte_val (pte) & _PAGE_RW);}/* Generic modifiers for PTE bits */ -static inline pte_t pte_wrprotect (pte_t pte) {
arch/powerpc/include/asm/book3s/pgtable.h
Quoted 10 lines
arch/powerpc/include/asm/book3s/pgtable.h +6
-3-pte_val (pte) &= ~(_PAGE_RW | _PAGE_HWWRITE); -pte_val (pte) |= _PAGE_RO;return pte; } +static inline pte_t pte_wrprotect (pte_t pte) +{ +pte_val (pte) &= ~_PAGE_RW; +return pte; +}static inline pte_t pte_mkclean (pte_t pte) { -pte_val (pte) &= ~(_PAGE_DIRTY | _PAGE_HWWRITE);return pte; } +pte_val (pte) &= ~_PAGE_DIRTY;return pte; }
Should not these changes in function definitions happen in a separate patch. The commit message here does not speak about these changes happening.
PATCH v5 9/31 powerpc/mm: Don't use pte_val as lvalue
In reply to Aneesh Kumar K.VWe also convert few #define to static inline in this patch for better type checking
--- arch/powerpc/include/asm/book3s/pgtable.h | 118 +++++++++++++++++++++--------- arch/powerpc/include/asm/page.h | 10 ++- arch/powerpc/include/asm/pgtable-book3e.h | 68 ++++++++++++----- 3 files changed, 139 insertions(+), 57 deletions(-)
arch/powerpc/include/asm/book3s/pgtable.h +83 -35
@@ -12,9 +12,9 @@/* Generic accessors to PTE bits */ static inline int pte_write (pte_t pte) {return !!(pte_val (pte) & _PAGE_RW);} -static inline int pte_dirty (pte_t pte) {return pte_val (pte) & _PAGE_DIRTY; } -static inline int pte_young (pte_t pte) {return pte_val (pte) & _PAGE_ACCESSED; } -static inline int pte_special (pte_t pte) {return pte_val (pte) & _PAGE_SPECIAL; } +static inline int pte_dirty (pte_t pte) {return !!(pte_val (pte) & _PAGE_DIRTY); } +static inline int pte_young (pte_t pte) {return !!(pte_val (pte) & _PAGE_ACCESSED); } +static inline int pte_special (pte_t pte) {return !!(pte_val (pte) & _PAGE_SPECIAL); }static inline int pte_none (pte_t pte) {return (pte_val (pte) & ~_PTE_NONE_MASK) ==0 ; }static inline pgprot_t pte_pgprot (pte_t pte) {return __pgprot (pte_val (pte) &PAGE_PROT_BITS ); }
@@ -47,36 +47,61 @@ static inline int pte_present(pte_t pte)* Even if PTEs can be unsigned long long, a PFN is always an unsigned * long for now. */ -static inline pte_t pfn_pte (unsigned long pfn,pgprot_t pgprot) { +static inline pte_t pfn_pte (unsigned long pfn,pgprot_t pgprot) +{return __pte (((pte_basic_t)(pfn) <<PTE_RPN_SHIFT ) | -pgprot_val (pgprot)); } -static inline unsigned long pte_pfn (pte_t pte) { -return pte_val (pte) >>PTE_RPN_SHIFT ; } +pgprot_val (pgprot)); +} + +static inline unsigned long pte_pfn (pte_t pte) +{ +return pte_val (pte) >>PTE_RPN_SHIFT ; +}/* Generic modifiers for PTE bits */ static inline pte_t pte_wrprotect (pte_t pte) { -pte_val (pte) &= ~_PAGE_RW; +return __pte (pte_val (pte) & ~_PAGE_RW); +} + +static inline pte_t pte_mkclean (pte_t pte) +{ +return __pte (pte_val (pte) & ~_PAGE_DIRTY); +} + +static inline pte_t pte_mkold (pte_t pte) +{ +return __pte (pte_val (pte) & ~_PAGE_ACCESSED); +} + +static inline pte_t pte_mkwrite (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_RW); +} + +static inline pte_t pte_mkdirty (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_DIRTY); +} + +static inline pte_t pte_mkyoung (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_ACCESSED); +} + +static inline pte_t pte_mkspecial (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_SPECIAL); +} + +static inline pte_t pte_mkhuge (pte_t pte) +{return pte; } -static inline pte_t pte_mkclean (pte_t pte) { -pte_val (pte) &= ~_PAGE_DIRTY;return pte; } -static inline pte_t pte_mkold (pte_t pte) { -pte_val (pte) &= ~_PAGE_ACCESSED;return pte; } -static inline pte_t pte_mkwrite (pte_t pte) { -pte_val (pte) |= _PAGE_RW;return pte; } -static inline pte_t pte_mkdirty (pte_t pte) { -pte_val (pte) |= _PAGE_DIRTY;return pte; } -static inline pte_t pte_mkyoung (pte_t pte) { -pte_val (pte) |= _PAGE_ACCESSED;return pte; } -static inline pte_t pte_mkspecial (pte_t pte) { -pte_val (pte) |= _PAGE_SPECIAL;return pte; } -static inline pte_t pte_mkhuge (pte_t pte) { -return pte; } +static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) { -pte_val (pte) = (pte_val (pte) & _PAGE_CHG_MASK) |pgprot_val (newprot); -return pte; +return __pte ((pte_val (pte) & _PAGE_CHG_MASK) |pgprot_val (newprot)); }
@@ -159,22 +184,45 @@ extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addre#define _PAGE_CACHE_CTL (_PAGE_COHERENT | _PAGE_GUARDED | _PAGE_NO_CACHE | \ _PAGE_WRITETHRU) -#define pgprot_noncached (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ - _PAGE_NO_CACHE | _PAGE_GUARDED)) +#define pgprot_noncached pgprot_noncached +static inline pgprot_t pgprot_noncached (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_NO_CACHE | _PAGE_GUARDED); +} -#define pgprot_noncached_wc (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ - _PAGE_NO_CACHE)) +#define pgprot_noncached_wc pgprot_noncached_wc +static inline pgprot_t pgprot_noncached_wc (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_NO_CACHE); +} -#define pgprot_cached (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ - _PAGE_COHERENT)) +#define pgprot_cached pgprot_cached +static inline pgprot_t pgprot_cached (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_COHERENT); +} -#define pgprot_cached_wthru (prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \ - _PAGE_COHERENT | _PAGE_WRITETHRU)) +#define pgprot_cached_wthru pgprot_cached_wthru +static inline pgprot_t pgprot_cached_wthru (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_COHERENT | _PAGE_WRITETHRU); +} -#define pgprot_cached_noncoherent (prot) \ - (__pgprot(pgprot_val(prot) & ~_PAGE_CACHE_CTL)) +#define pgprot_cached_noncoherent pgprot_cached_noncoherent +static inline pgprot_t pgprot_cached_noncoherent (pgprot_t prot) +{ +return __pgprot (pgprot_val (prot) & ~_PAGE_CACHE_CTL); +} -#define pgprot_writecombine pgprot_noncached_wc +#define pgprot_writecombine pgprot_writecombine +static inline pgprot_t pgprot_writecombine (pgprot_t prot) +{ +return pgprot_noncached_wc (prot); +}struct file ; extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
arch/powerpc/include/asm/page.h +8 -2
@@ -285,8 +285,11 @@ extern long long virt_phys_offset;/* PTE level */ typedef struct {pte_basic_t pte; }pte_t ; -#define pte_val (x) ((x).pte)#define __pte (x) ((pte_t) { (x) }) +static inline pte_basic_t pte_val (pte_t x) +{ +return x.pte; +}/* 64k pages additionally define a bigger "real PTE" type that gathers * the "second half" part of the PTE for pseudo 64k pages
@@ -328,8 +331,11 @@ typedef struct { unsigned long pgprot; } pgprot_t;*/ typedef pte_basic_t pte_t ; -#define pte_val (x) (x)#define __pte (x) (x) +static inline pte_basic_t pte_val (pte_t pte) +{ +return pte; +}#if defined(CONFIG_PPC_64K_PAGES ) && defined(CONFIG_PPC_STD_MMU_64 )typedef struct {pte_t pte;unsigned long hidx; }real_pte_t ;
arch/powerpc/include/asm/pgtable-book3e.h +48 -20
78 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v5 10/31 powerpc/mm: Don't use pmd_val, pud_val and pgd_val as lvalue
In reply to Aneesh Kumar K.VWe convert them static inline function here as we did with pte_val in the previous patch
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 6 ++++- arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 ++++- arch/powerpc/include/asm/book3s/64/pgtable.h | 36 +++++++++++++++++++++------- arch/powerpc/include/asm/page.h | 34 +++++++++++++++++++------- arch/powerpc/include/asm/pgalloc-32.h | 34 +++++++++++++++++++------- arch/powerpc/include/asm/pgalloc-64.h | 17 +++++++++---- arch/powerpc/include/asm/pgtable-ppc32.h | 7 +++++- arch/powerpc/include/asm/pgtable-ppc64-4k.h | 6 ++++- arch/powerpc/include/asm/pgtable-ppc64.h | 36 +++++++++++++++++++++------- arch/powerpc/mm/40x_mmu.c | 10 ++++---- arch/powerpc/mm/pgtable_64.c | 19 +++++++-------- 11 files changed, 154 insertions(+), 57 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +5 -1
@@ -105,7 +105,11 @@ extern unsigned long ioremap_bot;#define pmd_none (pmd) (!pmd_val(pmd))#define pmd_bad (pmd) (pmd_val(pmd) & _PMD_BAD)#define pmd_present (pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK) -#define pmd_clear (pmdp) do { pmd_val(*(pmdp)) = 0; } while (0) +static inline void pmd_clear (pmd_t *pmdp) +{ + *pmdp =__pmd (0 ); +} +/* * When flushing the tlb entry for a page, we also need to flush the hash
arch/powerpc/include/asm/book3s/64/hash-4k.h +5 -1
@@ -71,9 +71,13 @@#define pgd_none (pgd) (!pgd_val(pgd))#define pgd_bad (pgd) (pgd_val(pgd) == 0)#define pgd_present (pgd) (pgd_val(pgd) != 0) -#define pgd_clear (pgdp) (pgd_val(*(pgdp)) = 0)#define pgd_page_vaddr (pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS) +static inline void pgd_clear (pgd_t *pgdp) +{ + *pgdp =__pgd (0 ); +} +static inline pte_t pgd_pte (pgd_t pgd) {return __pte (pgd_val (pgd));
arch/powerpc/include/asm/book3s/64/pgtable.h +27 -9
@@ -238,21 +238,38 @@#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)#define PUD_BAD_BITS (PMD_TABLE_SIZE-1) -#define pmd_set (pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval)) +static inline void pmd_set (pmd_t *pmdp,unsigned long val) +{ + *pmdp =__pmd (val); +} + +static inline void pmd_clear (pmd_t *pmdp) +{ + *pmdp =__pmd (0 ); +} + +#define pmd_none (pmd) (!pmd_val(pmd))#define pmd_bad (pmd) (!is_kernel_addr(pmd_val(pmd)) \ || (pmd_val(pmd) & PMD_BAD_BITS))#define pmd_present (pmd) (!pmd_none(pmd)) -#define pmd_clear (pmdp) (pmd_val(*(pmdp)) = 0)#define pmd_page_vaddr (pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)extern struct page *pmd_page (pmd_t pmd); -#define pud_set (pudp, pudval) (pud_val(*(pudp)) = (pudval)) +static inline void pud_set (pud_t *pudp,unsigned long val) +{ + *pudp =__pud (val); +} + +static inline void pud_clear (pud_t *pudp) +{ + *pudp =__pud (0 ); +} +#define pud_none (pud) (!pud_val(pud))#define pud_bad (pud) (!is_kernel_addr(pud_val(pud)) \ || (pud_val(pud) & PUD_BAD_BITS))#define pud_present (pud) (pud_val(pud) != 0) -#define pud_clear (pudp) (pud_val(*(pudp)) = 0)#define pud_page_vaddr (pud) (pud_val(pud) & ~PUD_MASKED_BITS)extern struct page *pud_page (pud_t pud);
@@ -267,8 +284,11 @@ static inline pud_t pte_pud(pte_t pte)return __pud (pte_val (pte)); }#define pud_write (pud) pte_write(pud_pte(pud)) -#define pgd_set (pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})#define pgd_write (pgd) pte_write(pgd_pte(pgd)) +static inline void pgd_set (pgd_t *pgdp,unsigned long val) +{ + *pgdp =__pgd (val); +}/* * Find an entry in a page-table-directory. We combine the address region
@@ -590,14 +610,12 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd)static inline pmd_t pmd_mknotpresent (pmd_t pmd) { -pmd_val (pmd) &= ~_PAGE_PRESENT; -return pmd; +return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); }static inline pmd_t pmd_mksplitting (pmd_t pmd) { -pmd_val (pmd) |= _PAGE_SPLITTING; -return pmd; +return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); }#define __HAVE_ARCH_PMD_SAME
arch/powerpc/include/asm/page.h +26 -8
@@ -303,21 +303,30 @@ typedef struct { pte_t pte; } real_pte_t;/* PMD level */ #ifdef CONFIG_PPC64 typedef struct {unsigned long pmd; }pmd_t ; -#define pmd_val (x) ((x).pmd)#define __pmd (x) ((pmd_t) { (x) }) +static inline unsigned long pmd_val (pmd_t x) +{ +return x.pmd; +}/* PUD level exusts only on 4k pages */ #ifndef CONFIG_PPC_64K_PAGES typedef struct {unsigned long pud; }pud_t ; -#define pud_val (x) ((x).pud)#define __pud (x) ((pud_t) { (x) }) +static inline unsigned long pud_val (pud_t x) +{ +return x.pud; +}#endif /* !CONFIG_PPC_64K_PAGES */ #endif /* CONFIG_PPC64 */ /* PGD level */ typedef struct {unsigned long pgd; }pgd_t ; -#define pgd_val (x) ((x).pgd)#define __pgd (x) ((pgd_t) { (x) }) +static inline unsigned long pgd_val (pgd_t x) +{ +return x.pgd; +}/* Page protection bits */ typedef struct {unsigned long pgprot; }pgprot_t ;
@@ -346,22 +355,31 @@ typedef pte_t real_pte_t;#ifdef CONFIG_PPC64 typedef unsigned long pmd_t ; -#define pmd_val (x) (x)#define __pmd (x) (x) +static inline unsigned long pmd_val (pmd_t pmd) +{ +return pmd; +}#ifndef CONFIG_PPC_64K_PAGES typedef unsigned long pud_t ; -#define pud_val (x) (x)#define __pud (x) (x) +static inline unsigned long pud_val (pud_t pud) +{ +return pud; +}#endif /* !CONFIG_PPC_64K_PAGES */ #endif /* CONFIG_PPC64 */ typedef unsigned long pgd_t ; -#define pgd_val (x) (x) -#define pgprot_val (x) (x) +#define __pgd (x) (x) +static inline unsigned long pgd_val (pgd_t pgd) +{ +return pgd; +}typedef unsigned long pgprot_t ; -#define __pgd (x) (x) +#define pgprot_val (x) (x)#define __pgprot (x) (x)#endif
arch/powerpc/include/asm/pgalloc-32.h +26 -8
@@ -21,16 +21,34 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);/* #define pgd_populate(mm, pmd, pte) BUG() */ #ifndef CONFIG_BOOKE -#define pmd_populate_kernel (mm, pmd, pte) \ - (pmd_val(*(pmd)) = __pa(pte) | _PMD_PRESENT) -#define pmd_populate (mm, pmd, pte) \ - (pmd_val(*(pmd)) = (page_to_pfn(pte) << PAGE_SHIFT) | _PMD_PRESENT) + +static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmdp, +pte_t *pte) +{ + *pmdp =__pmd (__pa (pte) | _PMD_PRESENT); +} + +static inline void pmd_populate (struct mm_struct *mm,pmd_t *pmdp, +pgtable_t pte_page) +{ + *pmdp =__pmd ((page_to_pfn (pte_page) <<PAGE_SHIFT ) | _PMD_PRESENT); +} +#define pmd_pgtable (pmd) pmd_page(pmd)#else -#define pmd_populate_kernel (mm, pmd, pte) \ - (pmd_val(*(pmd)) = (unsigned long)pte | _PMD_PRESENT) -#define pmd_populate (mm, pmd, pte) \ - (pmd_val(*(pmd)) = (unsigned long)lowmem_page_address(pte) | _PMD_PRESENT) + +static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmdp, +pte_t *pte) +{ + *pmdp =__pmd ((unsigned long )pte | _PMD_PRESENT); +} + +static inline void pmd_populate (struct mm_struct *mm,pmd_t *pmdp, +pgtable_t pte_page) +{ + *pmdp =__pmd ((unsigned long )lowmem_page_address (pte_page) | _PMD_PRESENT); +} +#define pmd_pgtable (pmd) pmd_page(pmd)#endif
arch/powerpc/include/asm/pgalloc-64.h +13 -4
@@ -53,7 +53,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)#ifndef CONFIG_PPC_64K_PAGES -#define pgd_populate (MM ,PGD ,PUD ) pgd_set(PGD, PUD) +#define pgd_populate (MM ,PGD ,PUD ) pgd_set(PGD, (unsigned long)PUD)static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long addr) {
@@ -71,9 +71,18 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)pud_set (pud, (unsigned long )pmd); } -#define pmd_populate (mm, pmd, pte_page) \ - pmd_populate_kernel(mm, pmd, page_address(pte_page)) -#define pmd_populate_kernel (mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte)) +static inline void pmd_populate_kernel (struct mm_struct *mm,pmd_t *pmd, +pte_t *pte) +{ +pmd_set (pmd, (unsigned long )pte); +} + +static inline void pmd_populate (struct mm_struct *mm,pmd_t *pmd, +pgtable_t pte_page) +{ +pmd_set (pmd, (unsigned long )page_address (pte_page)); +} +#define pmd_pgtable (pmd) pmd_page(pmd) static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
arch/powerpc/include/asm/pgtable-ppc32.h +6 -1
@@ -128,7 +128,12 @@ extern int icache_44x_need_flush;#define pmd_none (pmd) (!pmd_val(pmd))#define pmd_bad (pmd) (pmd_val(pmd) & _PMD_BAD)#define pmd_present (pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK) -#define pmd_clear (pmdp) do { pmd_val(*(pmdp)) = 0; } while (0) +static inline void pmd_clear (pmd_t *pmdp) +{ + *pmdp =__pmd (0 ); +} + +/* * When flushing the tlb entry for a page, we also need to flush the hash
arch/powerpc/include/asm/pgtable-ppc64-4k.h +5 -1
@@ -55,11 +55,15 @@#define pgd_none (pgd) (!pgd_val(pgd))#define pgd_bad (pgd) (pgd_val(pgd) == 0)#define pgd_present (pgd) (pgd_val(pgd) != 0) -#define pgd_clear (pgdp) (pgd_val(*(pgdp)) = 0)#define pgd_page_vaddr (pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)#ifndef __ASSEMBLY__ +static inline void pgd_clear (pgd_t *pgdp) +{ + *pgdp =__pgd (0 ); +} +static inline pte_t pgd_pte (pgd_t pgd) {return __pte (pgd_val (pgd));
arch/powerpc/include/asm/pgtable-ppc64.h +27 -9
@@ -144,21 +144,37 @@#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)#define PUD_BAD_BITS (PMD_TABLE_SIZE-1) -#define pmd_set (pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval)) +static inline void pmd_set (pmd_t *pmdp,unsigned long val) +{ + *pmdp =__pmd (val); +} + +static inline void pmd_clear (pmd_t *pmdp) +{ + *pmdp =__pmd (0 ); +} +#define pmd_none (pmd) (!pmd_val(pmd))#define pmd_bad (pmd) (!is_kernel_addr(pmd_val(pmd)) \ || (pmd_val(pmd) & PMD_BAD_BITS))#define pmd_present (pmd) (!pmd_none(pmd)) -#define pmd_clear (pmdp) (pmd_val(*(pmdp)) = 0)#define pmd_page_vaddr (pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)extern struct page *pmd_page (pmd_t pmd); -#define pud_set (pudp, pudval) (pud_val(*(pudp)) = (pudval)) +static inline void pud_set (pud_t *pudp,unsigned long val) +{ + *pudp =__pud (val); +} + +static inline void pud_clear (pud_t *pudp) +{ + *pudp =__pud (0 ); +} +#define pud_none (pud) (!pud_val(pud))#define pud_bad (pud) (!is_kernel_addr(pud_val(pud)) \ || (pud_val(pud) & PUD_BAD_BITS))#define pud_present (pud) (pud_val(pud) != 0) -#define pud_clear (pudp) (pud_val(*(pudp)) = 0)#define pud_page_vaddr (pud) (pud_val(pud) & ~PUD_MASKED_BITS)extern struct page *pud_page (pud_t pud);
@@ -173,9 +189,13 @@ static inline pud_t pte_pud(pte_t pte)return __pud (pte_val (pte)); }#define pud_write (pud) pte_write(pud_pte(pud)) -#define pgd_set (pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})#define pgd_write (pgd) pte_write(pgd_pte(pgd)) +static inline void pgd_set (pgd_t *pgdp,unsigned long val) +{ + *pgdp =__pgd (val); +} +/* * Find an entry in a page-table-directory. We combine the address region * (the high order N bits) and the pgd portion of the address.
@@ -528,14 +548,12 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd)static inline pmd_t pmd_mknotpresent (pmd_t pmd) { -pmd_val (pmd) &= ~_PAGE_PRESENT; -return pmd; +return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); }static inline pmd_t pmd_mksplitting (pmd_t pmd) { -pmd_val (pmd) |= _PAGE_SPLITTING; -return pmd; +return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); }#define __HAVE_ARCH_PMD_SAME
arch/powerpc/mm/40x_mmu.c +5 -5
@@ -110,10 +110,10 @@ unsigned long __init mmu_mapin_ram(unsigned long top)unsigned long val = p | _PMD_SIZE_16M | _PAGE_EXEC | _PAGE_HWWRITE; pmdp =pmd_offset (pud_offset (pgd_offset_k (v), v), v); -pmd_val (*pmdp++) = val; -pmd_val (*pmdp++) = val; -pmd_val (*pmdp++) = val; -pmd_val (*pmdp++) = val; + *pmdp++ =__pmd (val); + *pmdp++ =__pmd (val); + *pmdp++ =__pmd (val); + *pmdp++ =__pmd (val); v +=LARGE_PAGE_SIZE_16M ; p +=LARGE_PAGE_SIZE_16M ;
@@ -125,7 +125,7 @@ unsigned long __init mmu_mapin_ram(unsigned long top)unsigned long val = p | _PMD_SIZE_4M | _PAGE_EXEC | _PAGE_HWWRITE; pmdp =pmd_offset (pud_offset (pgd_offset_k (v), v), v); -pmd_val (*pmdp) = val; + *pmdp =__pmd (val); v +=LARGE_PAGE_SIZE_4M ; p +=LARGE_PAGE_SIZE_4M ;
arch/powerpc/mm/pgtable_64.c +9 -10
@@ -759,22 +759,20 @@ void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,static pmd_t pmd_set_protbits (pmd_t pmd,pgprot_t pgprot) { -pmd_val (pmd) |=pgprot_val (pgprot); -return pmd; +return __pmd (pmd_val (pmd) |pgprot_val (pgprot)); }pmd_t pfn_pmd (unsigned long pfn,pgprot_t pgprot) { -pmd_t pmd; +unsigned long pmdv;/* * For a valid pte, we would have _PAGE_PRESENT always * set. We use this to check THP page at pmd level. * leaf pte for huge page, bottom two bits != 00 */ -pmd_val (pmd) = pfn <<PTE_RPN_SHIFT ; -pmd_val (pmd) |= _PAGE_THP_HUGE; - pmd =pmd_set_protbits (pmd, pgprot); -return pmd; + pmdv = pfn <<PTE_RPN_SHIFT ; + pmdv |= _PAGE_THP_HUGE; +return pmd_set_protbits (__pmd (pmdv), pgprot); }pmd_t mk_pmd (struct page *page,pgprot_t pgprot)
@@ -784,10 +782,11 @@ pmd_t mk_pmd(struct page *page, pgprot_t pgprot)pmd_t pmd_modify (pmd_t pmd,pgprot_t newprot) { +unsigned long pmdv; -pmd_val (pmd) &= _HPAGE_CHG_MASK; - pmd =pmd_set_protbits (pmd, newprot); -return pmd; + pmdv =pmd_val (pmd); + pmdv &= _HPAGE_CHG_MASK; +return pmd_set_protbits (__pmd (pmdv), newprot); }/*
Signature · 1 line
2.5.0
PATCH v5 11/31 powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h
In reply to Aneesh Kumar K.VThis enables us to keep hash64 related bits together, and makes it easy to follow.
--- arch/powerpc/include/asm/book3s/64/hash.h | 450 ++++++++++++++++++++++++++- arch/powerpc/include/asm/book3s/64/pgtable.h | 447 +------------------------- arch/powerpc/include/asm/pgtable.h | 6 - 3 files changed, 450 insertions(+), 453 deletions(-)
arch/powerpc/include/asm/book3s/64/hash.h +447 -3
@@ -2,6 +2,61 @@#define _ASM_POWERPC_BOOK3S_64_HASH_H#ifdef __KERNEL__ +#ifdef CONFIG_PPC_64K_PAGES +#include <asm/book3s/64/hash-64k.h> +#else +#include <asm/book3s/64/hash-4k.h> +#endif + +/* +* Size of EA range mapped by our pagetables. +*/ +#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ + PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) +#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#define PMD_CACHE_INDEX (PMD_INDEX_SIZE + 1) +#else +#define PMD_CACHE_INDEX PMD_INDEX_SIZE +#endif +/* +* Define the address range of the kernel non-linear virtual area +*/ +#define KERN_VIRT_START ASM_CONST(0xD000000000000000) +#define KERN_VIRT_SIZE ASM_CONST(0x0000100000000000) + +/* +* The vmalloc space starts at the beginning of that region, and +* occupies half of it on hash CPUs and a quarter of it on Book3E +* (we keep a quarter for the virtual memmap) +*/ +#define VMALLOC_START KERN_VIRT_START +#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1) +#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) + +/* +* Region IDs +*/ +#define REGION_SHIFT 60UL +#define REGION_MASK (0xfUL << REGION_SHIFT) +#define REGION_ID (ea) (((unsigned long)(ea)) >> REGION_SHIFT) + +#define VMALLOC_REGION_ID (REGION_ID(VMALLOC_START)) +#define KERNEL_REGION_ID (REGION_ID(PAGE_OFFSET)) +#define VMEMMAP_REGION_ID (0xfUL)/* Server only */ +#define USER_REGION_ID (0UL) + +/* +* Defines the address of the vmemap area, in its own region on +* hash table CPUs. +*/ +#define VMEMMAP_BASE (VMEMMAP_REGION_ID << REGION_SHIFT) + +#ifdef CONFIG_PPC_MM_SLICES +#define HAVE_ARCH_UNMAPPED_AREA +#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN +#endif /* CONFIG_PPC_MM_SLICES */ /* * Common bits between 4K and 64K pages in a linux-style PTE. * These match the bits in the (hardware-defined) PowerPC PTE as closely
@@ -46,11 +101,400 @@/* Hash table based platforms need atomic updates of the linux PTE */ #define PTE_ATOMIC_UPDATES 1 -#ifdef CONFIG_PPC_64K_PAGES -#include <asm/book3s/64/hash-64k.h> +/* +* THP pages can't be special. So use the _PAGE_SPECIAL +*/ +#define _PAGE_SPLITTING _PAGE_SPECIAL + +/* +* We need to differentiate between explicit huge page and THP huge +* page, since THP huge page also need to track real subpage details +*/ +#define _PAGE_THP_HUGE _PAGE_4K_PFN + +/* +* set of bits not changed in pmd_modify. +*/ +#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ + _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ + _PAGE_THP_HUGE) +#define _PTE_NONE_MASK _PAGE_HPTEFLAGS +/* +* The mask convered by the RPN must be a ULL on 32-bit platforms with +* 64-bit PTEs +* FIXME!! double check the RPN_MAX May be not used +*/ +//#define PTE_RPN_MAX (1UL << (32 - PTE_RPN_SHIFT)) +#define PTE_RPN_MASK (~((1UL << PTE_RPN_SHIFT) - 1)) +/* +* _PAGE_CHG_MASK masks of bits that are to be preserved across +* pgprot changes +*/ +#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ + _PAGE_ACCESSED | _PAGE_SPECIAL) +/* +* Mask of bits returned by pte_pgprot() +*/ +#define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \ + _PAGE_WRITETHRU | _PAGE_4K_PFN | \ + _PAGE_USER | _PAGE_ACCESSED | \ + _PAGE_RW | _PAGE_DIRTY | _PAGE_EXEC) +/* +* We define 2 sets of base prot bits, one for basic pages (ie, +* cacheable kernel and user pages) and one for non cacheable +* pages. We always set _PAGE_COHERENT when SMP is enabled or +* the processor might need it for DMA coherency. +*/ +#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_PSIZE) +#define _PAGE_BASE (_PAGE_BASE_NC | _PAGE_COHERENT) + +/* Permission masks used to generate the __P and __S table, +* +* Note:__pgprot is defined in arch/powerpc/include/asm/page.h +* +* Write permissions imply read permissions for now (we could make write-only +* pages on BookE but we don't bother for now). Execute permission control is +* possible on platforms that define _PAGE_EXEC +* +* Note due to the way vm flags are laid out, the bits are XWR +*/ +#define PAGE_NONE __pgprot(_PAGE_BASE) +#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW) +#define PAGE_SHARED_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_RW | \ + _PAGE_EXEC) +#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER ) +#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) +#define PAGE_READONLY __pgprot(_PAGE_BASE | _PAGE_USER ) +#define PAGE_READONLY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC) + +#define __P000 PAGE_NONE +#define __P001 PAGE_READONLY +#define __P010 PAGE_COPY +#define __P011 PAGE_COPY +#define __P100 PAGE_READONLY_X +#define __P101 PAGE_READONLY_X +#define __P110 PAGE_COPY_X +#define __P111 PAGE_COPY_X + +#define __S000 PAGE_NONE +#define __S001 PAGE_READONLY +#define __S010 PAGE_SHARED +#define __S011 PAGE_SHARED +#define __S100 PAGE_READONLY_X +#define __S101 PAGE_READONLY_X +#define __S110 PAGE_SHARED_X +#define __S111 PAGE_SHARED_X + +/* Permission masks used for kernel mappings */ +#define PAGE_KERNEL __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW) +#define PAGE_KERNEL_NC __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \ + _PAGE_NO_CACHE) +#define PAGE_KERNEL_NCG __pgprot(_PAGE_BASE_NC | _PAGE_KERNEL_RW | \ + _PAGE_NO_CACHE | _PAGE_GUARDED) +#define PAGE_KERNEL_X __pgprot(_PAGE_BASE | _PAGE_KERNEL_RWX) +#define PAGE_KERNEL_RO __pgprot(_PAGE_BASE | _PAGE_KERNEL_RO) +#define PAGE_KERNEL_ROX __pgprot(_PAGE_BASE | _PAGE_KERNEL_ROX) + +/* Protection used for kernel text. We want the debuggers to be able to +* set breakpoints anywhere, so don't write protect the kernel text +* on platforms where such control is possible. +*/ +#if defined(CONFIG_KGDB ) || defined(CONFIG_XMON ) || defined(CONFIG_BDI_SWITCH ) ||\ + defined(CONFIG_KPROBES ) || defined(CONFIG_DYNAMIC_FTRACE ) +#define PAGE_KERNEL_TEXT PAGE_KERNEL_X#else -#include <asm/book3s/64/hash-4k.h> +#define PAGE_KERNEL_TEXT PAGE_KERNEL_ROX#endif +/* Make modules code happy. We don't set RO yet */ +#define PAGE_KERNEL_EXEC PAGE_KERNEL_X +#define PAGE_AGP (PAGE_KERNEL_NC) + +#define PMD_BAD_BITS (PTE_TABLE_SIZE-1) +#define PUD_BAD_BITS (PMD_TABLE_SIZE-1) +/* +* We save the slot number & secondary bit in the second half of the +* PTE page. We use the 8 bytes per each pte entry. +*/ +#define PTE_PAGE_HIDX_OFFSET (PTRS_PER_PTE * 8) + +#ifndef __ASSEMBLY__ +#define pmd_bad (pmd) (!is_kernel_addr(pmd_val(pmd)) \ + || (pmd_val(pmd) & PMD_BAD_BITS)) +#define pmd_page_vaddr (pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) + +#define pud_bad (pud) (!is_kernel_addr(pud_val(pud)) \ + || (pud_val(pud) & PUD_BAD_BITS)) +#define pud_page_vaddr (pud) (pud_val(pud) & ~PUD_MASKED_BITS) + +#define pgd_index (address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1)) +#define pmd_index (address) (((address) >> (PMD_SHIFT)) & (PTRS_PER_PMD - 1)) +#define pte_index (address) (((address) >> (PAGE_SHIFT)) & (PTRS_PER_PTE - 1)) + +extern void hpte_need_flush (struct mm_struct *mm,unsigned long addr, +pte_t *ptep,unsigned long pte,int huge); +extern unsigned long pmd_hugepage_update (struct mm_struct *mm, +unsigned long addr, +pmd_t *pmdp, +unsigned long clr, +unsigned long set); +/* Atomic PTE updates */ +static inline unsigned long pte_update (struct mm_struct *mm, +unsigned long addr, +pte_t *ptep,unsigned long clr, +unsigned long set, +int huge) +{ +unsigned long old, tmp; + + __asm__ __volatile__( +"1: ldarx %0,0,%3 # pte_update\n\ +andi. %1,%0,%6\n\ +bne- 1b \n\ +andc %1,%0,%4 \n\ +or %1,%1,%7\n\ +stdcx. %1,0,%3 \n\ +bne- 1b" + :"=&r" (old),"=&r" (tmp),"=m" (*ptep) + :"r" (ptep),"r" (clr),"m" (*ptep),"i" (_PAGE_BUSY),"r" (set) + :"cc" ); +/* huge pages use the old page table lock */ +if (!huge) +assert_pte_locked (mm, addr); + +if (old & _PAGE_HASHPTE) +hpte_need_flush (mm, addr, ptep, old, huge); + +return old; +} + +static inline int __ptep_test_and_clear_young (struct mm_struct *mm, +unsigned long addr,pte_t *ptep) +{ +unsigned long old; + +if ((pte_val (*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) ==0 ) +return 0 ; + old =pte_update (mm, addr, ptep, _PAGE_ACCESSED,0 ,0 ); +return (old & _PAGE_ACCESSED) !=0 ; +} +#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG +#define ptep_test_and_clear_young (__vma, __addr, __ptep) \ +({ \ + int __r; \ + __r = __ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \ + __r; \ +}) + +#define __HAVE_ARCH_PTEP_SET_WRPROTECT +static inline void ptep_set_wrprotect (struct mm_struct *mm,unsigned long addr, +pte_t *ptep) +{ + +if ((pte_val (*ptep) & _PAGE_RW) ==0 ) +return ; + +pte_update (mm, addr, ptep, _PAGE_RW,0 ,0 ); +} + +static inline void huge_ptep_set_wrprotect (struct mm_struct *mm, +unsigned long addr,pte_t *ptep) +{ +if ((pte_val (*ptep) & _PAGE_RW) ==0 ) +return ; + +pte_update (mm, addr, ptep, _PAGE_RW,0 ,1 ); +} + +/* +* We currently remove entries from the hashtable regardless of whether +* the entry was young or dirty. The generic routines only flush if the +* entry was young or dirty which is not good enough. +* +* We should be more intelligent about this but for the moment we override +* these functions and force a tlb flush unconditionally +*/ +#define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH +#define ptep_clear_flush_young (__vma, __address, __ptep) \ +({ \ + int __young = __ptep_test_and_clear_young((__vma)->vm_mm, __address, \ + __ptep); \ + __young; \ +}) + +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR +static inline pte_t ptep_get_and_clear (struct mm_struct *mm, +unsigned long addr,pte_t *ptep) +{ +unsigned long old =pte_update (mm, addr, ptep, ~0UL ,0 ,0 ); +return __pte (old); +} + +static inline void pte_clear (struct mm_struct *mm,unsigned long addr, +pte_t * ptep) +{ +pte_update (mm, addr, ptep, ~0UL ,0 ,0 ); +} + + +/* Set the dirty and/or accessed bits atomically in a linux PTE, this +* function doesn't need to flush the hash entry +*/ +static inline void __ptep_set_access_flags (pte_t *ptep,pte_t entry) +{ +unsigned long bits =pte_val (entry) & + (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_RW | _PAGE_EXEC); + +unsigned long old, tmp; + + __asm__ __volatile__( +"1: ldarx %0,0,%4\n\ +andi. %1,%0,%6\n\ +bne- 1b \n\ +or %0,%3,%0\n\ +stdcx. %0,0,%4\n\ +bne- 1b" + :"=&r" (old),"=&r" (tmp),"=m" (*ptep) + :"r" (bits),"r" (ptep),"m" (*ptep),"i" (_PAGE_BUSY) + :"cc" ); +} + +#define __HAVE_ARCH_PTE_SAME +#define pte_same (A ,B ) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) + +static inline char *get_hpte_slot_array (pmd_t *pmdp) +{ +/* +* The hpte hindex is stored in the pgtable whose address is in the +* second half of the PMD +* +* Order this load with the test for pmd_trans_huge in the caller +*/ +smp_rmb (); +return *(char **)(pmdp +PTRS_PER_PMD ); + + +} +/* +* The linux hugepage PMD now include the pmd entries followed by the address +* to the stashed pgtable_t. The stashed pgtable_t contains the hpte bits. +* [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per +* each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and +* with 4K HPTE we need 4096 entries. Both will fit in a 4K pgtable_t. +* +* The last three bits are intentionally left to zero. This memory location +* are also used as normal page PTE pointers. So if we have any pointers +* left around while we collapse a hugepage, we need to make sure +* _PAGE_PRESENT bit of that is zero when we look at them +*/ +static inline unsigned int hpte_valid (unsigned char *hpte_slot_array,int index) +{ +return (hpte_slot_array[index] >>3 ) &0x1 ; +} + +static inline unsigned int hpte_hash_index (unsigned char *hpte_slot_array, +int index) +{ +return hpte_slot_array[index] >>4 ; +} + +static inline void mark_hpte_slot_valid (unsigned char *hpte_slot_array, +unsigned int index,unsigned int hidx) +{ + hpte_slot_array[index] = hidx <<4 |0x1 <<3 ; +} + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +/* +* +* For core kernel code by design pmd_trans_huge is never run on any hugetlbfs +* page. The hugetlbfs page table walking and mangling paths are totally +* separated form the core VM paths and they're differentiated by +* VM_HUGETLB being set on vm_flags well before any pmd_trans_huge could run. +* +* pmd_trans_huge() is defined as false at build time if +* CONFIG_TRANSPARENT_HUGEPAGE=n to optimize away code blocks at build +* time in such case. +* +* For ppc64 we need to differntiate from explicit hugepages from THP, because +* for THP we also track the subpage details at the pmd level. We don't do +* that for explicit huge pages. +* +*/ +static inline int pmd_trans_huge (pmd_t pmd) +{ +/* +* leaf pte for huge page, bottom two bits != 00 +*/ +return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); +} + +static inline int pmd_trans_splitting (pmd_t pmd) +{ +if (pmd_trans_huge (pmd)) +return pmd_val (pmd) & _PAGE_SPLITTING; +return 0 ; +} + +#endif +static inline int pmd_large (pmd_t pmd) +{ +/* +* leaf pte for huge page, bottom two bits != 00 +*/ +return ((pmd_val (pmd) &0x3 ) !=0x0 ); +} + +static inline pmd_t pmd_mknotpresent (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); +} + +static inline pmd_t pmd_mksplitting (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); +} + +#define __HAVE_ARCH_PMD_SAME +static inline int pmd_same (pmd_t pmd_a,pmd_t pmd_b) +{ +return (((pmd_val (pmd_a) ^pmd_val (pmd_b)) & ~_PAGE_HPTEFLAGS) ==0 ); +} + +static inline int __pmdp_test_and_clear_young (struct mm_struct *mm, +unsigned long addr,pmd_t *pmdp) +{ +unsigned long old; + +if ((pmd_val (*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) ==0 ) +return 0 ; + old =pmd_hugepage_update (mm, addr, pmdp, _PAGE_ACCESSED,0 ); +return ((old & _PAGE_ACCESSED) !=0 ); +} + +#define __HAVE_ARCH_PMDP_SET_WRPROTECT +static inline void pmdp_set_wrprotect (struct mm_struct *mm,unsigned long addr, +pmd_t *pmdp) +{ + +if ((pmd_val (*pmdp) & _PAGE_RW) ==0 ) +return ; + +pmd_hugepage_update (mm, addr, pmdp, _PAGE_RW,0 ); +} + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +extern void hpte_do_hugepage_flush (struct mm_struct *mm,unsigned long addr, +pmd_t *pmdp,unsigned long old_pmd); +#else +static inline void hpte_do_hugepage_flush (struct mm_struct *mm, +unsigned long addr,pmd_t *pmdp, +unsigned long old_pmd) +{ +WARN (1 ,"%s called with THP disabled\n" , __func__); +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ + +#endif /* !__ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
arch/powerpc/include/asm/book3s/64/pgtable.h +3 -444
538 lines not on this page · raw message
arch/powerpc/include/asm/pgtable.h +0 -6
@@ -18,12 +18,6 @@ struct mm_struct;#include <asm/pgtable-book3e.h> #endif /* !CONFIG_PPC_BOOK3S */ -/* -* We save the slot number & secondary bit in the second half of the -* PTE page. We use the 8 bytes per each pte entry. -*/ -#define PTE_PAGE_HIDX_OFFSET (PTRS_PER_PTE * 8) -#ifndef __ASSEMBLY__#include <asm/tlbflush.h>
Signature · 1 line
2.5.0
Re: [PATCH V5 11/31] powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h
Quoted 9 lines · Aneesh Kumar K.V
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-1+extern struct page *pmd_page (pmd_t pmd);static inline pte_t pud_pte (pud_t pud) {return __pte (pud_val (pud));@@ -294,15 +115,14 @@ static inline void pgd_set(pgd_t *pgdp, unsigned long val)* Find an entry in a page-table-directory. We combine the address region * (the high order N bits) and the pgd portion of the address. */ -#define pgd_index (address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
arch/powerpc/include/asm/book3s/64/pgtable.h static inline void pgd_set(pgd_t *pgdp, unsigned long val) · line 125
Quoted 10 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +2
-2#define pgd_offset (mm, address) ((mm)->pgd + pgd_index(address))#define pmd_offset (pudp,addr) \ - (((pmd_t *) pud_page_vaddr(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) + (((pmd_t *) pud_page_vaddr(*(pudp))) + pmd_index(addr))#define pte_offset_kernel (dir,addr) \ - (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) + (((pte_t *) pmd_page_vaddr(*(dir))) + pte_index(addr))
These additions of the code should have been done in a separate patch.
This has been observed in some of the previous patches as well. If the commit message says that PTE definitions need to be moved then the patch only needs to move them, not change them anyway while on the move. Any changes to code should be done in separate patch. That will keep the change log clean, logical and makes it easy to track and understand.
------------------------------------------------------------------------
powerpc/mm: Move hash64 PTE bits from book3s/64/pgtable.h to hash.h
This enables us to keep hash64 related bits together, and makes it easy to follow.
arch/powerpc/include/asm/book3s/64/hash.h | 450 ++++++++++++++++++ arch/powerpc/include/asm/book3s/64/pgtable.h | 447 ------------------ arch/powerpc/include/asm/pgtable.h | 6 -- 3 files changed, 450 insertions(+), 453 deletions(-)
PATCH v5 12/31 powerpc/mm: Move PTE bits from generic functions to hash64 functions.
In reply to Aneesh Kumar K.Vfunctions which operate on pte bits are moved to hash*.h and other generic functions are moved to pgtable.h
--- arch/powerpc/include/asm/book3s/32/pgtable.h | 183 ++++++++++++++++++++++++ arch/powerpc/include/asm/book3s/64/hash.h | 151 ++++++++++++++++++++ arch/powerpc/include/asm/book3s/64/pgtable.h | 6 + arch/powerpc/include/asm/book3s/pgtable.h | 204 --------------------------- 4 files changed, 340 insertions(+), 204 deletions(-)
arch/powerpc/include/asm/book3s/32/pgtable.h +183 -0
@@ -294,6 +294,189 @@ void pgtable_cache_init(void);extern int get_pteptr (struct mm_struct *mm,unsigned long addr,pte_t **ptep,pmd_t **pmdp); +/* Generic accessors to PTE bits */ +static inline int pte_write (pte_t pte) {return !!(pte_val (pte) & _PAGE_RW);} +static inline int pte_dirty (pte_t pte) {return !!(pte_val (pte) & _PAGE_DIRTY); } +static inline int pte_young (pte_t pte) {return !!(pte_val (pte) & _PAGE_ACCESSED); } +static inline int pte_special (pte_t pte) {return !!(pte_val (pte) & _PAGE_SPECIAL); } +static inline int pte_none (pte_t pte) {return (pte_val (pte) & ~_PTE_NONE_MASK) ==0 ; } +static inline pgprot_t pte_pgprot (pte_t pte) {return __pgprot (pte_val (pte) &PAGE_PROT_BITS ); } + +static inline int pte_present (pte_t pte) +{ +return pte_val (pte) & _PAGE_PRESENT; +} + +/* Conversion functions: convert a page and protection to a page entry, +* and a page entry and page directory to the page they refer to. +* +* Even if PTEs can be unsigned long long, a PFN is always an unsigned +* long for now. +*/ +static inline pte_t pfn_pte (unsigned long pfn,pgprot_t pgprot) +{ +return __pte (((pte_basic_t)(pfn) <<PTE_RPN_SHIFT ) | +pgprot_val (pgprot)); +} + +static inline unsigned long pte_pfn (pte_t pte) +{ +return pte_val (pte) >>PTE_RPN_SHIFT ; +} + +/* Generic modifiers for PTE bits */ +static inline pte_t pte_wrprotect (pte_t pte) +{ +return __pte (pte_val (pte) & ~_PAGE_RW); +} + +static inline pte_t pte_mkclean (pte_t pte) +{ +return __pte (pte_val (pte) & ~_PAGE_DIRTY); +} + +static inline pte_t pte_mkold (pte_t pte) +{ +return __pte (pte_val (pte) & ~_PAGE_ACCESSED); +} + +static inline pte_t pte_mkwrite (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_RW); +} + +static inline pte_t pte_mkdirty (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_DIRTY); +} + +static inline pte_t pte_mkyoung (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_ACCESSED); +} + +static inline pte_t pte_mkspecial (pte_t pte) +{ +return __pte (pte_val (pte) | _PAGE_SPECIAL); +} + +static inline pte_t pte_mkhuge (pte_t pte) +{ +return pte; +} + +static inline pte_t pte_modify (pte_t pte,pgprot_t newprot) +{ +return __pte ((pte_val (pte) & _PAGE_CHG_MASK) |pgprot_val (newprot)); +} + + + +/* This low level function performs the actual PTE insertion +* Setting the PTE depends on the MMU type and other factors. It's +* an horrible mess that I'm not going to try to clean up now but +* I'm keeping it in one place rather than spread around +*/ +static inline void __set_pte_at (struct mm_struct *mm,unsigned long addr, +pte_t *ptep,pte_t pte,int percpu) +{ +#if defined(CONFIG_PPC_STD_MMU_32 ) && defined(CONFIG_SMP ) && !defined(CONFIG_PTE_64BIT ) +/* First case is 32-bit Hash MMU in SMP mode with 32-bit PTEs. We use the +* helper pte_update() which does an atomic update. We need to do that +* because a concurrent invalidation can clear _PAGE_HASHPTE. If it's a +* per-CPU PTE such as a kmap_atomic, we do a simple update preserving +* the hash bits instead (ie, same as the non-SMP case) +*/ +if (percpu) + *ptep =__pte ((pte_val (*ptep) & _PAGE_HASHPTE) + | (pte_val (pte) & ~_PAGE_HASHPTE)); +else +pte_update (ptep, ~_PAGE_HASHPTE,pte_val (pte)); + +#elif defined(CONFIG_PPC32 ) && defined(CONFIG_PTE_64BIT ) +/* Second case is 32-bit with 64-bit PTE. In this case, we +* can just store as long as we do the two halves in the right order +* with a barrier in between. This is possible because we take care, +* in the hash code, to pre-invalidate if the PTE was already hashed, +* which synchronizes us with any concurrent invalidation. +* In the percpu case, we also fallback to the simple update preserving +* the hash bits +*/ +if (percpu) { + *ptep =__pte ((pte_val (*ptep) & _PAGE_HASHPTE) + | (pte_val (pte) & ~_PAGE_HASHPTE)); +return ; + } +if (pte_val (*ptep) & _PAGE_HASHPTE) +flush_hash_entry (mm, ptep, addr); + __asm__ __volatile__("\ +stw%U0%X0 %2,%0\n\ +eieio\n\ +stw%U0%X0 %L2,%1" + :"=m" (*ptep),"=m" (*((unsigned char *)ptep+4 )) + :"r" (pte) :"memory" ); + +#elif defined(CONFIG_PPC_STD_MMU_32 ) +/* Third case is 32-bit hash table in UP mode, we need to preserve +* the _PAGE_HASHPTE bit since we may not have invalidated the previous +* translation in the hash yet (done in a subsequent flush_tlb_xxx()) +* and see we need to keep track that this PTE needs invalidating +*/ + *ptep =__pte ((pte_val (*ptep) & _PAGE_HASHPTE) + | (pte_val (pte) & ~_PAGE_HASHPTE)); + +#else +#error "Not supported " +#endif +} + +/* +* Macro to mark a page protection value as "uncacheable". +*/ + +#define _PAGE_CACHE_CTL (_PAGE_COHERENT | _PAGE_GUARDED | _PAGE_NO_CACHE | \ + _PAGE_WRITETHRU) + +#define pgprot_noncached pgprot_noncached +static inline pgprot_t pgprot_noncached (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_NO_CACHE | _PAGE_GUARDED); +} + +#define pgprot_noncached_wc pgprot_noncached_wc +static inline pgprot_t pgprot_noncached_wc (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_NO_CACHE); +} + +#define pgprot_cached pgprot_cached +static inline pgprot_t pgprot_cached (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_COHERENT); +} + +#define pgprot_cached_wthru pgprot_cached_wthru +static inline pgprot_t pgprot_cached_wthru (pgprot_t prot) +{ +return __pgprot ((pgprot_val (prot) & ~_PAGE_CACHE_CTL) | + _PAGE_COHERENT | _PAGE_WRITETHRU); +} + +#define pgprot_cached_noncoherent pgprot_cached_noncoherent +static inline pgprot_t pgprot_cached_noncoherent (pgprot_t prot) +{ +return __pgprot (pgprot_val (prot) & ~_PAGE_CACHE_CTL); +} + +#define pgprot_writecombine pgprot_writecombine +static inline pgprot_t pgprot_writecombine (pgprot_t prot) +{ +return pgprot_noncached_wc (prot); +} +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_POWERPC_PGTABLE_PPC32_H */
arch/powerpc/include/asm/book3s/64/hash.h +151 -0
157 lines not on this page · raw message
arch/powerpc/include/asm/book3s/64/pgtable.h +6 -0
@@ -201,6 +201,12 @@ static inline pte_t *pmdp_ptep(pmd_t *pmd)#define pmd_mkdirty (pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))#define pmd_mkyoung (pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))#define pmd_mkwrite (pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) +#ifdef CONFIG_NUMA_BALANCING +static inline int pmd_protnone (pmd_t pmd) +{ +return pte_protnone (pmd_pte (pmd)); +} +#endif /* CONFIG_NUMA_BALANCING */ #define __HAVE_ARCH_PMD_WRITE#define pmd_write (pmd) pte_write(pmd_pte(pmd))
arch/powerpc/include/asm/book3s/pgtable.h +0 -204
221 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v5 13/31 powerpc/booke: Move nohash headers (part 1)
In reply to Aneesh Kumar K.VMove the booke related headers below booke/32 or booke/64
We are splitting this change into multiple patch to make the rebasing easier. The following patches can be folded into this if needed. They are kept separate for easier review.
---
arch/powerpc/include/asm/{pgtable-book3e.h => nohash/pgtable.h} | 0
arch/powerpc/include/asm/pgtable.h | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
rename arch/powerpc/include/asm/{pgtable-book3e.h => nohash/pgtable.h} (100%)arch/powerpc/include/asm/nohash/pgtable.h renamed from arch/powerpc/include/asm/pgtable-book3e.h +0 -0
arch/powerpc/include/asm/pgtable.h +1 -1
@@ -15,7 +15,7 @@ struct mm_struct;#ifdef CONFIG_PPC_BOOK3S #include <asm/book3s/pgtable.h> #else -#include <asm/pgtable-book3e.h> +#include <asm/nohash/pgtable.h> #endif /* !CONFIG_PPC_BOOK3S */ #ifndef __ASSEMBLY__
Signature · 1 line
2.5.0
PATCH v5 14/31 powerpc/booke: Move nohash headers (part 2)
In reply to Aneesh Kumar K.V---
arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} | 0
arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} | 2 +-
arch/powerpc/include/asm/nohash/pgtable.h | 8 ++++----
3 files changed, 5 insertions(+), 5 deletions(-)
rename arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} (100%)
rename arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} (99%)arch/powerpc/include/asm/nohash/32/pgtable.h renamed from arch/powerpc/include/asm/pgtable-ppc32.h +0 -0
arch/powerpc/include/asm/nohash/64/pgtable.h renamed from arch/powerpc/include/asm/pgtable-ppc64.h +1 -1
@@ -18,7 +18,7 @@* Size of EA range mapped by our pagetables. */ #define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ - PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) + PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)#ifdef CONFIG_TRANSPARENT_HUGEPAGE
arch/powerpc/include/asm/nohash/pgtable.h +4 -4
@@ -1,10 +1,10 @@ -#ifndef _ASM_POWERPC_PGTABLE_BOOK3E_H -#define _ASM_POWERPC_PGTABLE_BOOK3E_H +#ifndef _ASM_POWERPC_NOHASH_PGTABLE_H +#define _ASM_POWERPC_NOHASH_PGTABLE_H#if defined(CONFIG_PPC64 ) -#include <asm/pgtable-ppc64.h> +#include <asm/nohash/64/pgtable.h> #else -#include <asm/pgtable-ppc32.h> +#include <asm/nohash/32/pgtable.h> #endif #ifndef __ASSEMBLY__
Signature · 1 line
2.5.0
Re: [PATCH V5 14/31] powerpc/booke: Move nohash headers (part 2)
Some sort of commit message enlisting what we copied from where and which all header file references have changed will be helpful here.
arch/powerpc/include/asm/nohash/pgtable.h
Quoted 34 lines · Aneesh Kumar K.V
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} | 0 arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} | 2 +- arch/powerpc/include/asm/nohash/pgtable.h | 8 ++++---- 3 files changed, 5 insertions(+), 5 deletions(-) rename arch/powerpc/include/asm/{pgtable-ppc32.h => nohash/32/pgtable.h} (100%) rename arch/powerpc/include/asm/{pgtable-ppc64.h => nohash/64/pgtable.h} (99%)arch/powerpc/include/asm/nohash/32/pgtable.h renamed from arch/powerpc/include/asm/pgtable-ppc32.h +0
-0arch/powerpc/include/asm/nohash/64/pgtable.h renamed from arch/powerpc/include/asm/pgtable-ppc64.h +1
-1@@ -18,7 +18,7 @@* Size of EA range mapped by our pagetables. */ #define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ - PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) + PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)#ifdef CONFIG_TRANSPARENT_HUGEPAGE arch/powerpc/include/asm/nohash/pgtable.h +0
-0
This should be added at the end of the file.
#endif /* _ASM_POWERPC_NOHASH_PGTABLE_H */
PATCH v5 15/31 powerpc/booke: Move nohash headers (part 3)
In reply to Aneesh Kumar K.V---
.../include/asm/{pgtable-ppc64-4k.h => nohash/64/pgtable-4k.h} | 0
.../asm/{pgtable-ppc64-64k.h => nohash/64/pgtable-64k.h} | 0
arch/powerpc/include/asm/nohash/64/pgtable.h | 10 +++++-----
3 files changed, 5 insertions(+), 5 deletions(-)
rename arch/powerpc/include/asm/{pgtable-ppc64-4k.h => nohash/64/pgtable-4k.h} (100%)
rename arch/powerpc/include/asm/{pgtable-ppc64-64k.h => nohash/64/pgtable-64k.h} (100%)arch/powerpc/include/asm/nohash/64/pgtable-4k.h renamed from arch/powerpc/include/asm/pgtable-ppc64-4k.h +0 -0
arch/powerpc/include/asm/nohash/64/pgtable-64k.h renamed from arch/powerpc/include/asm/pgtable-ppc64-64k.h +0 -0
arch/powerpc/include/asm/nohash/64/pgtable.h +5 -5
@@ -1,14 +1,14 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC64_H_ -#define _ASM_POWERPC_PGTABLE_PPC64_H_ +#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_H +#define _ASM_POWERPC_NOHASH_64_PGTABLE_H/* * This file contains the functions and defines necessary to modify and use * the ppc64 hashed page table. */ #ifdef CONFIG_PPC_64K_PAGES -#include <asm/pgtable-ppc64-64k.h> +#include <asm/nohash/64/pgtable-64k.h> #else -#include <asm/pgtable-ppc64-4k.h> +#include <asm/nohash/64/pgtable-4k.h> #endif #include <asm/barrier.h>
@@ -637,4 +637,4 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,return true; }#endif /* __ASSEMBLY__ */ -#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ +#endif /* _ASM_POWERPC_NOHASH_64_PGTABLE_H */
Signature · 1 line
2.5.0
PATCH v5 16/31 powerpc/booke: Move nohash headers (part 4)
In reply to Aneesh Kumar K.V---
arch/powerpc/include/asm/nohash/32/pgtable.h | 16 ++++++++--------
arch/powerpc/include/asm/{ => nohash/32}/pte-40x.h | 0
arch/powerpc/include/asm/{ => nohash/32}/pte-44x.h | 0
arch/powerpc/include/asm/{ => nohash/32}/pte-8xx.h | 0
arch/powerpc/include/asm/{ => nohash/32}/pte-fsl-booke.h | 0
arch/powerpc/include/asm/nohash/64/pgtable.h | 2 +-
arch/powerpc/include/asm/{ => nohash}/pte-book3e.h | 0
7 files changed, 9 insertions(+), 9 deletions(-)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-40x.h (100%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-44x.h (100%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-8xx.h (100%)
rename arch/powerpc/include/asm/{ => nohash/32}/pte-fsl-booke.h (100%)
rename arch/powerpc/include/asm/{ => nohash}/pte-book3e.h (100%)arch/powerpc/include/asm/nohash/32/pgtable.h +8 -8
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC32_H -#define _ASM_POWERPC_PGTABLE_PPC32_H +#ifndef _ASM_POWERPC_NOHASH_32_PGTABLE_H +#define _ASM_POWERPC_NOHASH_32_PGTABLE_H#include <asm-generic/pgtable-nopmd.h>
@@ -106,15 +106,15 @@ extern int icache_44x_need_flush;*/ #if defined(CONFIG_40x) -#include <asm/pte-40x.h> +#include <asm/nohash/32/pte-40x.h> #elif defined(CONFIG_44x) -#include <asm/pte-44x.h> +#include <asm/nohash/32/pte-44x.h> #elif defined(CONFIG_FSL_BOOKE ) && defined(CONFIG_PTE_64BIT ) -#include <asm/pte-book3e.h> +#include <asm/nohash/pte-book3e.h> #elif defined(CONFIG_FSL_BOOKE ) -#include <asm/pte-fsl-booke.h> +#include <asm/nohash/32/pte-fsl-booke.h> #elif defined(CONFIG_8xx) -#include <asm/pte-8xx.h> +#include <asm/nohash/32/pte-8xx.h> #endif /* And here we include common definitions */
@@ -340,4 +340,4 @@ extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep,#endif /* !__ASSEMBLY__ */ -#endif /* _ASM_POWERPC_PGTABLE_PPC32_H */ +#endif /* __ASM_POWERPC_NOHASH_32_PGTABLE_H */
arch/powerpc/include/asm/nohash/32/pte-40x.h renamed from arch/powerpc/include/asm/pte-40x.h +0 -0
arch/powerpc/include/asm/nohash/32/pte-44x.h renamed from arch/powerpc/include/asm/pte-44x.h +0 -0
arch/powerpc/include/asm/nohash/32/pte-8xx.h renamed from arch/powerpc/include/asm/pte-8xx.h +0 -0
arch/powerpc/include/asm/nohash/32/pte-fsl-booke.h renamed from arch/powerpc/include/asm/pte-fsl-booke.h +0 -0
arch/powerpc/include/asm/nohash/64/pgtable.h +1 -1
@@ -97,7 +97,7 @@/* * Include the PTE bits definitions */ -#include <asm/pte-book3e.h> +#include <asm/nohash/pte-book3e.h> #include <asm/pte-common.h> #ifdef CONFIG_PPC_MM_SLICES
arch/powerpc/include/asm/nohash/pte-book3e.h renamed from arch/powerpc/include/asm/pte-book3e.h +0 -0
Signature · 1 line
2.5.0
PATCH v5 17/31 powerpc/booke: Move nohash headers (part 5)
In reply to Aneesh Kumar K.V--- arch/powerpc/include/asm/nohash/32/pte-40x.h | 6 +++--- arch/powerpc/include/asm/nohash/32/pte-44x.h | 6 +++--- arch/powerpc/include/asm/nohash/32/pte-8xx.h | 6 +++--- arch/powerpc/include/asm/nohash/32/pte-fsl-booke.h | 6 +++--- arch/powerpc/include/asm/nohash/64/pgtable-4k.h | 6 +++--- arch/powerpc/include/asm/nohash/64/pgtable-64k.h | 6 +++--- arch/powerpc/include/asm/nohash/pte-book3e.h | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-)
arch/powerpc/include/asm/nohash/32/pte-40x.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_40x_H -#define _ASM_POWERPC_PTE_40x_H +#ifndef _ASM_POWERPC_NOHASH_32_PTE_40x_H +#define _ASM_POWERPC_NOHASH_32_PTE_40x_H#ifdef __KERNEL__/*
@@ -61,4 +61,4 @@#define PTE_ATOMIC_UPDATES 1#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_40x_H */ +#endif /* _ASM_POWERPC_NOHASH_32_PTE_40x_H */
arch/powerpc/include/asm/nohash/32/pte-44x.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_44x_H -#define _ASM_POWERPC_PTE_44x_H +#ifndef _ASM_POWERPC_NOHASH_32_PTE_44x_H +#define _ASM_POWERPC_NOHASH_32_PTE_44x_H#ifdef __KERNEL__/*
@@ -94,4 +94,4 @@#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_44x_H */ +#endif /* _ASM_POWERPC_NOHASH_32_PTE_44x_H */
arch/powerpc/include/asm/nohash/32/pte-8xx.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_8xx_H -#define _ASM_POWERPC_PTE_8xx_H +#ifndef _ASM_POWERPC_NOHASH_32_PTE_8xx_H +#define _ASM_POWERPC_NOHASH_32_PTE_8xx_H#ifdef __KERNEL__/*
@@ -62,4 +62,4 @@ _PAGE_HWWRITE | _PAGE_EXEC)#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_8xx_H */ +#endif /* _ASM_POWERPC_NOHASH_32_PTE_8xx_H */
arch/powerpc/include/asm/nohash/32/pte-fsl-booke.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_FSL_BOOKE_H -#define _ASM_POWERPC_PTE_FSL_BOOKE_H +#ifndef _ASM_POWERPC_NOHASH_32_PTE_FSL_BOOKE_H +#define _ASM_POWERPC_NOHASH_32_PTE_FSL_BOOKE_H#ifdef __KERNEL__/* PTE bit definitions for Freescale BookE SW loaded TLB MMU based
@@ -37,4 +37,4 @@#define PTE_WIMGE_SHIFT (6)#endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_FSL_BOOKE_H */ +#endif /* _ASM_POWERPC_NOHASH_32_PTE_FSL_BOOKE_H */
arch/powerpc/include/asm/nohash/64/pgtable-4k.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC64_4K_H -#define _ASM_POWERPC_PGTABLE_PPC64_4K_H +#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H +#define _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H/* * Entries per page directory level. The PTE level must use a 64b record * for each page table entry. The PMD and PGD level use a 32b record for
@@ -89,4 +89,4 @@ extern struct page *pgd_page(pgd_t pgd);#define remap_4k_pfn (vma, addr, pfn, prot) \ remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot)) -#endif /* _ASM_POWERPC_PGTABLE_PPC64_4K_H */ +#endif /* _ _ASM_POWERPC_NOHASH_64_PGTABLE_4K_H */
arch/powerpc/include/asm/nohash/64/pgtable-64k.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PGTABLE_PPC64_64K_H -#define _ASM_POWERPC_PGTABLE_PPC64_64K_H +#ifndef _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H +#define _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H#include <asm-generic/pgtable-nopud.h>
@@ -41,4 +41,4 @@#define pgd_pte (pgd) (pud_pte(((pud_t){ pgd })))#define pte_pgd (pte) ((pgd_t)pte_pud(pte)) -#endif /* _ASM_POWERPC_PGTABLE_PPC64_64K_H */ +#endif /* _ASM_POWERPC_NOHASH_64_PGTABLE_64K_H */
arch/powerpc/include/asm/nohash/pte-book3e.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_POWERPC_PTE_BOOK3E_H -#define _ASM_POWERPC_PTE_BOOK3E_H +#ifndef _ASM_POWERPC_NOHASH_PTE_BOOK3E_H +#define _ASM_POWERPC_NOHASH_PTE_BOOK3E_H#ifdef __KERNEL__/* PTE bit definitions for processors compliant to the Book3E
@@ -84,4 +84,4 @@#endif #endif /* __KERNEL__ */ -#endif /* _ASM_POWERPC_PTE_FSL_BOOKE_H */ +#endif /* _ASM_POWERPC_NOHASH_PTE_BOOK3E_H */
Signature · 1 line
2.5.0
Re: [PATCH V5 17/31] powerpc/booke: Move nohash headers (part 5)
Quoted 2 lines · Aneesh Kumar K.V
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>
This and some previous patches can use some amount of description in the commit message to make them clear. Now these first 17 patches in the series are code movement and re organization of header files into book3s (32/64) and book3e (32/64) buckets. Patches starting from 18/31 till 31/31 changes the existing PTE format and related stuff. So first 17 patches can be reviewed as a separate series and considered before dealing with proposed PTE changes. In that scheme of things patches 09/31 and 10/31 which prevents pte_val, pmd_val, pud_val etc being used as lvalue should also be at the end of the series after all movement of headers have been completed not in the middle of it.
PATCH v5 18/31 powerpc/mm: Increase the pte frag size.
In reply to Aneesh Kumar K.VWe will use the increased size to store more information of 4K pte when using 64K page size. The idea is to free up bits in pte_t.
--- arch/powerpc/include/asm/pgalloc-64.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/pgalloc-64.h +6 -6
@@ -164,15 +164,15 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,#else /* if CONFIG_PPC_64K_PAGES */ /* -* we support 16 fragments per PTE page. +* we support 8 fragments per PTE page. */ -#define PTE_FRAG_NR 16 +#define PTE_FRAG_NR 8/* -* We use a 2K PTE page fragment and another 2K for storing -* real_pte_t hash index +* We use a 2K PTE page fragment and another 4K for storing +* real_pte_t hash index. Rounding the entire thing to 8K */ -#define PTE_FRAG_SIZE_SHIFT 12 -#define PTE_FRAG_SIZE (2 * PTRS_PER_PTE * sizeof(pte_t)) +#define PTE_FRAG_SIZE_SHIFT 13 +#define PTE_FRAG_SIZE (1UL << PTE_FRAG_SIZE_SHIFT)extern pte_t *page_table_alloc (struct mm_struct *,unsigned long ,int );extern void page_table_free (struct mm_struct *,unsigned long *,int );
Signature · 1 line
2.5.0
PATCH v5 19/31 powerpc/mm: Convert 4k hash insert to C
In reply to Aneesh Kumar K.V--- arch/powerpc/mm/Makefile | 3 + arch/powerpc/mm/hash64_64k.c | 202 +++++++++++++++++++++ arch/powerpc/mm/hash_low_64.S | 380 ---------------------------------------- arch/powerpc/mm/hash_utils_64.c | 4 +- 4 files changed, 208 insertions(+), 381 deletions(-) create mode 100644 arch/powerpc/mm/hash64_64k.c
arch/powerpc/mm/Makefile +3 -0
@@ -18,6 +18,9 @@ obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ tlb_hash$(CONFIG_WORD_SIZE).o \ mmu_context_hash$(CONFIG_WORD_SIZE).o +ifeq ($(CONFIG_PPC_STD_MMU_64),y) +obj-$(CONFIG_PPC_64K_PAGES) += hash64_64k.o +endif obj-$(CONFIG_PPC_ICSWX) += icswx.o obj-$(CONFIG_PPC_ICSWX_PID) += icswx_pid.o obj-$(CONFIG_40x) += 40x_mmu.o
arch/powerpc/mm/hash64_64k.c new file +202 -0
202 lines not on this page · raw message
arch/powerpc/mm/hash_low_64.S +0 -380
391 lines not on this page · raw message
arch/powerpc/mm/hash_utils_64.c +3 -1
@@ -653,7 +653,7 @@ static void __init htab_finish_init(void)patch_branch (ht64_call_hpte_updatepp,ppc_function_entry (ppc_md.hpte_updatepp),BRANCH_SET_LINK ); -#endif /* CONFIG_PPC_64K_PAGES */ +#else /* !CONFIG_PPC_64K_PAGES */ patch_branch(htab_call_hpte_insert1, ppc_function_entry(ppc_md.hpte_insert),
@@ -667,6 +667,8 @@ static void __init htab_finish_init(void)patch_branch (htab_call_hpte_updatepp,ppc_function_entry (ppc_md.hpte_updatepp),BRANCH_SET_LINK ); +#endif + }static void __init htab_initialize (void )
Signature · 1 line
2.5.0
PATCH v5 20/31 powerpc/mm: update __real_pte to take address as argument
In reply to Aneesh Kumar K.VWe will use this in the later patch to compute the right hash index
--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 2 +- arch/powerpc/include/asm/book3s/64/pgtable.h | 4 ++-- arch/powerpc/include/asm/nohash/64/pgtable.h | 4 ++-- arch/powerpc/mm/hash64_64k.c | 2 +- arch/powerpc/mm/tlb_hash64.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-64k.h +1 -1
@@ -78,7 +78,7 @@* generic accessors and iterators here */ #define __real_pte __real_pte -static inline real_pte_t __real_pte (pte_t pte,pte_t *ptep) +static inline real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep) {real_pte_t rpte;
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -2
@@ -44,10 +44,10 @@#ifndef __real_pte#ifdef CONFIG_STRICT_MM_TYPECHECKS -#define __real_pte (e,p) ((real_pte_t){(e)}) +#define __real_pte (a,e,p) ((real_pte_t){(e)})#define __rpte_to_pte (r) ((r).pte)#else -#define __real_pte (e,p) (e) +#define __real_pte (a,e,p) (e)#define __rpte_to_pte (r) (__pte(r))#endif #define __rpte_to_hidx (r,index) (pte_val(__rpte_to_pte(r)) >> 12)
arch/powerpc/include/asm/nohash/64/pgtable.h +2 -2
@@ -115,10 +115,10 @@#ifndef __real_pte#ifdef CONFIG_STRICT_MM_TYPECHECKS -#define __real_pte (e,p) ((real_pte_t){(e)}) +#define __real_pte (a,e,p) ((real_pte_t){(e)})#define __rpte_to_pte (r) ((r).pte)#else -#define __real_pte (e,p) (e) +#define __real_pte (a,e,p) (e)#define __rpte_to_pte (r) (__pte(r))#endif #define __rpte_to_hidx (r,index) (pte_val(__rpte_to_pte(r)) >> 12)
arch/powerpc/mm/hash64_64k.c +1 -1
@@ -90,7 +90,7 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, subpg_index = (ea & (PAGE_SIZE -1 )) >> shift; vpn =hpt_vpn (ea, vsid, ssize); - rpte =__real_pte (__pte (old_pte), ptep); + rpte =__real_pte (ea,__pte (old_pte), ptep);/* *None of the sub 4k page is hashed */
arch/powerpc/mm/tlb_hash64.c +1 -1
@@ -89,7 +89,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, }WARN_ON (vsid ==0 ); vpn =hpt_vpn (addr, vsid, ssize); - rpte =__real_pte (__pte (pte), ptep); + rpte =__real_pte (addr,__pte (pte), ptep);/* * Check if we have an active batch on this CPU. If not, just
Signature · 1 line
2.5.0
PATCH v5 21/31 powerpc/mm: make pte page hash index slot 8 bits
In reply to Aneesh Kumar K.VCurrently we use 4 bits for each slot and pack all the 16 slot information related to a 64K linux page in a 64bit value. To do this we use 16 bits of pte_t. Move the hash slot valid bit out of pte_t and place them in the second half of pte page. We also use 8 bit per each slot.
--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 48 +++++++++++++++------------ arch/powerpc/include/asm/book3s/64/hash.h | 5 --- arch/powerpc/include/asm/page.h | 4 +-- arch/powerpc/mm/hash64_64k.c | 34 +++++++++++++++---- 4 files changed, 56 insertions(+), 35 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-64k.h +27 -21
@@ -78,33 +78,39 @@* generic accessors and iterators here */ #define __real_pte __real_pte -static inline real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep) -{ -real_pte_t rpte; - - rpte.pte = pte; - rpte.hidx =0 ; -if (pte_val (pte) & _PAGE_COMBO) { -/* -* Make sure we order the hidx load against the _PAGE_COMBO -* check. The store side ordering is done in __hash_page_4K -*/ -smp_rmb (); - rpte.hidx =pte_val (*((ptep) +PTRS_PER_PTE )); - } -return rpte; -} - +extern real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep);static inline unsigned long __rpte_to_hidx (real_pte_t rpte,unsigned long index) {if ((pte_val (rpte.pte) & _PAGE_COMBO)) -return (rpte.hidx >> (index<<2 )) &0xf ; +return (unsigned long ) rpte.hidx[index] >>4 ;return (pte_val (rpte.pte) >>12 ) &0xf ; } -#define __rpte_to_pte (r) ((r).pte) -#define __rpte_sub_valid (rpte, index) \ - (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) +static inline pte_t __rpte_to_pte (real_pte_t rpte) +{ +return rpte.pte; +} +/* +* we look at the second half of the pte page to determine whether +* the sub 4k hpte is valid. We use 8 bits per each index, and we have +* 16 index mapping full 64K page. Hence for each +* 64K linux page we use 128 bit from the second half of pte page. +* The encoding in the second half of the page is as below: +* [ index 15 ] .........................[index 0] +* [bit 127 ..................................bit 0] +* fomat of each index +* bit 7 ........ bit0 +* [one bit secondary][ 3 bit hidx][1 bit valid][000] +*/ +static inline bool __rpte_sub_valid (real_pte_t rpte,unsigned long index) +{ +unsigned char index_val = rpte.hidx[index]; + +if ((index_val >>3 ) &0x1 ) +return true; +return false; +} +/* * Trick: we set __end to va + 64k, which happens works for * a 16M page as well as we want only one iteration
arch/powerpc/include/asm/book3s/64/hash.h +0 -5
@@ -212,11 +212,6 @@#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)#define PUD_BAD_BITS (PMD_TABLE_SIZE-1) -/* -* We save the slot number & secondary bit in the second half of the -* PTE page. We use the 8 bytes per each pte entry. -*/ -#define PTE_PAGE_HIDX_OFFSET (PTRS_PER_PTE * 8)#ifndef __ASSEMBLY__#define pmd_bad (pmd) (!is_kernel_addr(pmd_val(pmd)) \
arch/powerpc/include/asm/page.h +2 -2
@@ -295,7 +295,7 @@ static inline pte_basic_t pte_val(pte_t x)* the "second half" part of the PTE for pseudo 64k pages */ #if defined(CONFIG_PPC_64K_PAGES ) && defined(CONFIG_PPC_STD_MMU_64 ) -typedef struct {pte_t pte;unsigned long hidx; }real_pte_t ; +typedef struct {pte_t pte;unsigned char *hidx; }real_pte_t ;#else typedef struct {pte_t pte; }real_pte_t ;#endif
@@ -347,7 +347,7 @@ static inline pte_basic_t pte_val(pte_t pte) }#if defined(CONFIG_PPC_64K_PAGES ) && defined(CONFIG_PPC_STD_MMU_64 ) -typedef struct {pte_t pte;unsigned long hidx; }real_pte_t ; +typedef struct {pte_t pte;unsigned char *hidx; }real_pte_t ;#else typedef pte_t real_pte_t ;#endif
arch/powerpc/mm/hash64_64k.c +27 -7
@@ -16,12 +16,32 @@#include <asm/machdep.h> #include <asm/mmu.h> +real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep) +{ +int indx; +real_pte_t rpte; +pte_t *pte_headp; + + rpte.pte = pte; + rpte.hidx =NULL ; +if (pte_val (pte) & _PAGE_COMBO) { + indx =pte_index (addr); + pte_headp = ptep - indx; +/* +* Make sure we order the hidx load against the _PAGE_COMBO +* check. The store side ordering is done in __hash_page_4K +*/ +smp_rmb (); + rpte.hidx = (unsigned char *)(pte_headp +PTRS_PER_PTE ) + (16 * indx); + } +return rpte; +} +int __hash_page_4K (unsigned long ea,unsigned long access,unsigned long vsid,pte_t *ptep,unsigned long trap,unsigned long flags,int ssize,int subpg_prot) {real_pte_t rpte; -unsigned long *hidxp;unsigned long hpte_group;unsigned int subpg_index;unsigned long shift =12 ;/* 4K */
@@ -90,7 +110,10 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, subpg_index = (ea & (PAGE_SIZE -1 )) >> shift; vpn =hpt_vpn (ea, vsid, ssize); - rpte =__real_pte (ea,__pte (old_pte), ptep); +if (!(old_pte & _PAGE_COMBO)) + rpte =__real_pte (ea,__pte (old_pte | _PAGE_COMBO), ptep); +else + rpte =__real_pte (ea,__pte (old_pte), ptep);/* *None of the sub 4k page is hashed */
@@ -188,11 +211,8 @@ repeat:* Since we have _PAGE_BUSY set on ptep, we can be sure * nobody is undating hidx. */ - hidxp = (unsigned long *)(ptep +PTRS_PER_PTE ); -/* __real_pte use pte_val() any idea why ? FIXME!! */ - rpte.hidx &= ~(0xfUL << (subpg_index <<2 )); - *hidxp = rpte.hidx | (slot << (subpg_index <<2 )); - new_pte |= (_PAGE_HPTE_SUB0 >> subpg_index); + rpte.hidx[subpg_index] = (unsigned char )(slot <<4 |0x1 <<3 ); + new_pte |= _PAGE_HPTE_SUB0;/* * check __real_pte for details on matching smp_rmb() */
Signature · 1 line
2.5.0
Re: [PATCH V5 21/31] powerpc/mm: make pte page hash index slot 8 bits
Quoted 3 lines · Aneesh Kumar K.V
Currently we use 4 bits for each slot and pack all the 16 slot information related to a 64K linux page in a 64bit value. To do this we use 16 bits of
pte_t. Move the hash slot valid bit out ofpte_t
Looking into the existing function __real_pte, rpte.hidx is stored in the second half of the PTE page not inside the pte_t as the commit message points out. Also did not get how 16 bits of pte_t is used to track 64 bits of subpage information tracked inside the second half of the PTE page.
rpte.hidx = pte_val(*((ptep) + PTRS_PER_PTE));
With the current patch, it changes the storage requirement of the sub page tracking from (4 * 16 = 64 bits) into (8 * 16 = 128 bits) which is now made accessible as a character array (the rpte.hidx) instead of an unsigned long as it was happening previously before the change.
Quoted 23 lines
and place them in the second half of pte page. We also use 8 bit per each slot.
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 48 +++++++++++++++------------ arch/powerpc/include/asm/book3s/64/hash.h | 5 --- arch/powerpc/include/asm/page.h | 4 +-- arch/powerpc/mm/hash64_64k.c | 34 +++++++++++++++---- 4 files changed, 56 insertions(+), 35 deletions(-)arch/powerpc/include/asm/book3s/64/hash-64k.h +0
-3@@ -78,33 +78,39 @@* generic accessors and iterators here */ #define __real_pte __real_pte -static inline real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep) -{ -real_pte_t rpte;
arch/powerpc/include/asm/book3s/64/hash-64k.h line 93
Quoted 10 lines
arch/powerpc/include/asm/book3s/64/hash-64k.h +0
-10- - rpte.pte = pte; - rpte.hidx =0 ; -if (pte_val (pte) & _PAGE_COMBO) { -/* -* Make sure we order the hidx load against the _PAGE_COMBO -* check. The store side ordering is done in __hash_page_4K -*/ -smp_rmb (); - rpte.hidx =pte_val (*((ptep) +PTRS_PER_PTE ));
The previous function was storing it in the second half of the PTE page.
Quoted 49 lines
arch/powerpc/include/asm/book3s/64/hash-64k.h +27
-8- } -return rpte; -} - +extern real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep);static inline unsigned long __rpte_to_hidx (real_pte_t rpte,unsigned long index) {if ((pte_val (rpte.pte) & _PAGE_COMBO)) -return (rpte.hidx >> (index<<2 )) &0xf ; +return (unsigned long ) rpte.hidx[index] >>4 ;return (pte_val (rpte.pte) >>12 ) &0xf ; } -#define __rpte_to_pte (r) ((r).pte) -#define __rpte_sub_valid (rpte, index) \ - (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index))) +static inline pte_t __rpte_to_pte (real_pte_t rpte) +{ +return rpte.pte; +} +/* +* we look at the second half of the pte page to determine whether +* the sub 4k hpte is valid. We use 8 bits per each index, and we have +* 16 index mapping full 64K page. Hence for each +* 64K linux page we use 128 bit from the second half of pte page. +* The encoding in the second half of the page is as below: +* [ index 15 ] .........................[index 0] +* [bit 127 ..................................bit 0] +* fomat of each index +* bit 7 ........ bit0 +* [one bit secondary][ 3 bit hidx][1 bit valid][000] +*/ +static inline bool __rpte_sub_valid (real_pte_t rpte,unsigned long index) +{ +unsigned char index_val = rpte.hidx[index]; + +if ((index_val >>3 ) &0x1 ) +return true; +return false; +} +/* * Trick: we set __end to va + 64k, which happens works for * a 16M page as well as we want only one iteration arch/powerpc/include/asm/book3s/64/hash.h +0
-0
arch/powerpc/include/asm/book3s/64/hash.h line 218
Quoted 7 lines
arch/powerpc/include/asm/book3s/64/hash.h +0
-4@@ -212,11 +212,6 @@#define PMD_BAD_BITS (PTE_TABLE_SIZE-1)#define PUD_BAD_BITS (PMD_TABLE_SIZE-1) -/* -* We save the slot number & secondary bit in the second half of the -* PTE page. We use the 8 bytes per each pte entry. -*/
This previous comment also talked about it. ^^^^^^^^^^^^^^^
Quoted 41 lines
arch/powerpc/include/asm/book3s/64/hash.h +0
-1-#define PTE_PAGE_HIDX_OFFSET (PTRS_PER_PTE * 8)#ifndef __ASSEMBLY__#define pmd_bad (pmd) (!is_kernel_addr(pmd_val(pmd)) \arch/powerpc/include/asm/page.h +2
-2@@ -295,7 +295,7 @@ static inline pte_basic_t pte_val(pte_t x)* the "second half" part of the PTE for pseudo 64k pages */ #if defined(CONFIG_PPC_64K_PAGES ) && defined(CONFIG_PPC_STD_MMU_64 ) -typedef struct {pte_t pte;unsigned long hidx; }real_pte_t ; +typedef struct {pte_t pte;unsigned char *hidx; }real_pte_t ;#else typedef struct {pte_t pte; }real_pte_t ;#endif @@ -347,7 +347,7 @@ static inline pte_basic_t pte_val(pte_t pte) }#if defined(CONFIG_PPC_64K_PAGES ) && defined(CONFIG_PPC_STD_MMU_64 ) -typedef struct {pte_t pte;unsigned long hidx; }real_pte_t ; +typedef struct {pte_t pte;unsigned char *hidx; }real_pte_t ;#else typedef pte_t real_pte_t ;#endif arch/powerpc/mm/hash64_64k.c +7
-0@@ -16,12 +16,32 @@#include <asm/machdep.h> #include <asm/mmu.h> +real_pte_t __real_pte (unsigned long addr,pte_t pte,pte_t *ptep) +{ +int indx; +real_pte_t rpte; +pte_t *pte_headp; + + rpte.pte = pte;
arch/powerpc/mm/hash64_64k.c line 35
Quoted 10 lines
arch/powerpc/mm/hash64_64k.c +10
-0+ rpte.hidx =NULL ; +if (pte_val (pte) & _PAGE_COMBO) { + indx =pte_index (addr); + pte_headp = ptep - indx; +/* +* Make sure we order the hidx load against the _PAGE_COMBO +* check. The store side ordering is done in __hash_page_4K +*/ +smp_rmb (); + rpte.hidx = (unsigned char *)(pte_headp +PTRS_PER_PTE ) + (16 * indx);
The new scheme here also tracks these 16 byte information in the second half of the PTE page.
Quoted 14 lines
arch/powerpc/mm/hash64_64k.c +4
-1+ } +return rpte; +} +int __hash_page_4K (unsigned long ea,unsigned long access,unsigned long vsid,pte_t *ptep,unsigned long trap,unsigned long flags,int ssize,int subpg_prot) {real_pte_t rpte; -unsigned long *hidxp;unsigned long hpte_group;unsigned int subpg_index;unsigned long shift =12 ;/* 4K */
arch/powerpc/mm/hash64_64k.c int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, · line 116
Quoted 8 lines
arch/powerpc/mm/hash64_64k.c +4
-1@@ -90,7 +110,10 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, subpg_index = (ea & (PAGE_SIZE -1 )) >> shift; vpn =hpt_vpn (ea, vsid, ssize); - rpte =__real_pte (ea,__pte (old_pte), ptep); +if (!(old_pte & _PAGE_COMBO)) + rpte =__real_pte (ea,__pte (old_pte | _PAGE_COMBO), ptep); +else + rpte =__real_pte (ea,__pte (old_pte), ptep);
The above hunk can be replaced with just the following line which adds _PAGE_COMBO flag no matter what.
rpte = __real_pte(ea, __pte(old_pte | _PAGE_COMBO), ptep);
arch/powerpc/mm/hash64_64k.c repeat: · line 214
Quoted 13 lines
arch/powerpc/mm/hash64_64k.c +1
-5/* *None of the sub 4k page is hashed */ @@ -188,11 +211,8 @@ repeat:* Since we have _PAGE_BUSY set on ptep, we can be sure * nobody is undating hidx. */ - hidxp = (unsigned long *)(ptep +PTRS_PER_PTE ); -/* __real_pte use pte_val() any idea why ? FIXME!! */ - rpte.hidx &= ~(0xfUL << (subpg_index <<2 )); - *hidxp = rpte.hidx | (slot << (subpg_index <<2 )); - new_pte |= (_PAGE_HPTE_SUB0 >> subpg_index); + rpte.hidx[subpg_index] = (unsigned char )(slot <<4 |0x1 <<3 );
Dont we need to check anything before inserting the validity bit (0x1 << 3) for the sub page into the 8 bit information ?
Quoted 5 lines
arch/powerpc/mm/hash64_64k.c +1
-0+ new_pte |= _PAGE_HPTE_SUB0;/* * check __real_pte for details on matching smp_rmb() */
PATCH v5 22/31 powerpc/mm: Don't track subpage valid bit in pte_t
In reply to Aneesh Kumar K.VThis free up 11 bits in pte_t. In the later patch we also change the pte_t format so that we can start supporting migration pte at pmd level.
--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 10 +-------- arch/powerpc/include/asm/book3s/64/hash-64k.h | 29 ++------------------------- arch/powerpc/include/asm/book3s/64/hash.h | 4 ++++ arch/powerpc/mm/hash64_64k.c | 4 ++-- arch/powerpc/mm/hash_low_64.S | 6 +----- arch/powerpc/mm/hugetlbpage-hash64.c | 5 +---- arch/powerpc/mm/pgtable_64.c | 2 +- 7 files changed, 12 insertions(+), 48 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-4k.h +1 -9
@@ -47,17 +47,9 @@/* Bits to mask out from a PGD to get to the PUD page */ #define PGD_MASKED_BITS 0 -/* PTE bits */ -#define _PAGE_HASHPTE 0x0400/* software: pte has an associated HPTE */ -#define _PAGE_SECONDARY 0x8000/* software: HPTE is in secondary group */ -#define _PAGE_GROUP_IX 0x7000/* software: HPTE index within group */ -#define _PAGE_F_SECOND _PAGE_SECONDARY -#define _PAGE_F_GIX _PAGE_GROUP_IX -#define _PAGE_SPECIAL 0x10000/* software: special page */ -/* PTE flags to conserve for HPTE identification */ #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \ - _PAGE_SECONDARY | _PAGE_GROUP_IX) + _PAGE_F_SECOND | _PAGE_F_GIX)/* shift to put page number into pte */ #define PTE_RPN_SHIFT (17)
arch/powerpc/include/asm/book3s/64/hash-64k.h +2 -27
@@ -31,33 +31,8 @@/* Bits to mask out from a PGD/PUD to get to the PMD page */ #define PUD_MASKED_BITS 0x1ff -/* Additional PTE bits (don't change without checking asm in hash_low.S) */ -#define _PAGE_SPECIAL 0x00000400/* software: special page */ -#define _PAGE_HPTE_SUB 0x0ffff000/* combo only: sub pages HPTE bits */ -#define _PAGE_HPTE_SUB0 0x08000000/* combo only: first sub page */ -#define _PAGE_COMBO 0x10000000/* this is a combo 4k page */ -#define _PAGE_4K_PFN 0x20000000/* PFN is for a single 4k page */ - -/* For 64K page, we don't have a separate _PAGE_HASHPTE bit. Instead, -* we set that to be the whole sub-bits mask. The C code will only -* test this, so a multi-bit mask will work. For combo pages, this -* is equivalent as effectively, the old _PAGE_HASHPTE was an OR of -* all the sub bits. For real 64k pages, we now have the assembly set -* _PAGE_HPTE_SUB0 in addition to setting the HIDX bits which overlap -* that mask. This is fine as long as the HIDX bits are never set on -* a PTE that isn't hashed, which is the case today. -* -* A little nit is for the huge page C code, which does the hashing -* in C, we need to provide which bit to use. -*/ -#define _PAGE_HASHPTE _PAGE_HPTE_SUB - -/* Note the full page bits must be in the same location as for normal -* 4k pages as the same assembly will be used to insert 64K pages -* whether the kernel has CONFIG_PPC_64K_PAGES or not -*/ -#define _PAGE_F_SECOND 0x00008000/* full page: hidx bits */ -#define _PAGE_F_GIX 0x00007000/* full page: hidx bits */ +#define _PAGE_COMBO 0x00020000/* this is a combo 4k page */ +#define _PAGE_4K_PFN 0x00040000/* PFN is for a single 4k page */ /* PTE flags to conserve for HPTE identification */ #define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_COMBO)
arch/powerpc/include/asm/book3s/64/hash.h +4 -0
@@ -81,7 +81,11 @@#define _PAGE_DIRTY 0x0080/* C: page changed */ #define _PAGE_ACCESSED 0x0100/* R: page referenced */ #define _PAGE_RW 0x0200/* software: user write access allowed */ +#define _PAGE_HASHPTE 0x0400/* software: pte has an associated HPTE */ #define _PAGE_BUSY 0x0800/* software: PTE & hash are busy */ +#define _PAGE_F_GIX 0x7000/* full page: hidx bits */ +#define _PAGE_F_SECOND 0x8000/* Whether to use secondary hash or not */ +#define _PAGE_SPECIAL 0x10000/* software: special page */ /* No separate kernel read-only */ #define _PAGE_KERNEL_RW (_PAGE_RW | _PAGE_DIRTY)/* user access blocked by key */
arch/powerpc/mm/hash64_64k.c +2 -2
@@ -125,7 +125,7 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,*/ if (!(old_pte & _PAGE_COMBO)) {flush_hash_page (vpn, rpte,MMU_PAGE_64K , ssize, flags); - old_pte &= ~_PAGE_HPTE_SUB; + old_pte &= ~_PAGE_HASHPTE | _PAGE_F_GIX | _PAGE_F_SECOND; goto htab_insert_hpte; }/*
@@ -212,7 +212,7 @@ repeat:* nobody is undating hidx. */ rpte.hidx[subpg_index] = (unsigned char )(slot <<4 |0x1 <<3 ); - new_pte |= _PAGE_HPTE_SUB0; + new_pte |= _PAGE_HASHPTE;/* * check __real_pte for details on matching smp_rmb() */
arch/powerpc/mm/hash_low_64.S +1 -5
@@ -285,7 +285,7 @@ htab_modify_pte: /* Secondary group ? if yes, get a inverted hash value */ mr r5,r28 - andi. r0,r31,_PAGE_SECONDARY + andi. r0,r31,_PAGE_F_SECOND beq 1f not r5,r5 1:
@@ -473,11 +473,7 @@ ht64_insert_pte: lis r0,_PAGE_HPTEFLAGS@h ori r0,r0,_PAGE_HPTEFLAGS@l andc r30,r30,r0 -#ifdef CONFIG_PPC_64K_PAGES - oris r30,r30,_PAGE_HPTE_SUB0@h -#else ori r30,r30,_PAGE_HASHPTE -#endif /* Phyical address in r5 */ rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT sldi r5,r5,PAGE_SHIFT
arch/powerpc/mm/hugetlbpage-hash64.c +1 -4
@@ -91,11 +91,8 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, pa =pte_pfn (__pte (old_pte)) <<PAGE_SHIFT ;/* clear HPTE slot informations in new PTE */ -#ifdef CONFIG_PPC_64K_PAGES - new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0; -#else new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE; -#endif +/* Add in WIMG bits */ rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | _PAGE_COHERENT | _PAGE_GUARDED));
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -625,7 +625,7 @@ void pmdp_splitting_flush(struct vm_area_struct *vma,"1: ldarx %0,0,%3\n\ andi. %1,%0,%6\n\ bne- 1b \n\ -ori %1,%0,%4 \n\ +oris %1,%0,%4@h \n\ stdcx. %1,0,%3 \n\ bne- 1b" : "=&r" (old), "=&r" (tmp), "=m" (*pmdp)
Signature · 1 line
2.5.0
PATCH v5 23/31 powerpc/mm: Increase the width of #define
In reply to Aneesh Kumar K.VNo real change, only style changes
--- arch/powerpc/include/asm/book3s/64/hash.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
arch/powerpc/include/asm/book3s/64/hash.h +13 -13
@@ -69,22 +69,22 @@* We could create separate kernel read-only if we used the 3 PP bits * combinations that newer processors provide but we currently don't. */ -#define _PAGE_PRESENT 0x0001/* software: pte contains a translation */ -#define _PAGE_USER 0x0002/* matches one of the PP bits */ +#define _PAGE_PRESENT 0x00001/* software: pte contains a translation */ +#define _PAGE_USER 0x00002/* matches one of the PP bits */ #define _PAGE_BIT_SWAP_TYPE 2 -#define _PAGE_EXEC 0x0004/* No execute on POWER4 and newer (we invert) */ -#define _PAGE_GUARDED 0x0008 +#define _PAGE_EXEC 0x00004/* No execute on POWER4 and newer (we invert) */ +#define _PAGE_GUARDED 0x00008/* We can derive Memory coherence from _PAGE_NO_CACHE */ #define _PAGE_COHERENT 0x0 -#define _PAGE_NO_CACHE 0x0020/* I: cache inhibit */ -#define _PAGE_WRITETHRU 0x0040/* W: cache write-through */ -#define _PAGE_DIRTY 0x0080/* C: page changed */ -#define _PAGE_ACCESSED 0x0100/* R: page referenced */ -#define _PAGE_RW 0x0200/* software: user write access allowed */ -#define _PAGE_HASHPTE 0x0400/* software: pte has an associated HPTE */ -#define _PAGE_BUSY 0x0800/* software: PTE & hash are busy */ -#define _PAGE_F_GIX 0x7000/* full page: hidx bits */ -#define _PAGE_F_SECOND 0x8000/* Whether to use secondary hash or not */ +#define _PAGE_NO_CACHE 0x00020/* I: cache inhibit */ +#define _PAGE_WRITETHRU 0x00040/* W: cache write-through */ +#define _PAGE_DIRTY 0x00080/* C: page changed */ +#define _PAGE_ACCESSED 0x00100/* R: page referenced */ +#define _PAGE_RW 0x00200/* software: user write access allowed */ +#define _PAGE_HASHPTE 0x00400/* software: pte has an associated HPTE */ +#define _PAGE_BUSY 0x00800/* software: PTE & hash are busy */ +#define _PAGE_F_GIX 0x07000/* full page: hidx bits */ +#define _PAGE_F_SECOND 0x08000/* Whether to use secondary hash or not */ #define _PAGE_SPECIAL 0x10000/* software: special page */ /* No separate kernel read-only */
Signature · 1 line
2.5.0
Re: [PATCH V5 23/31] powerpc/mm: Increase the width of #define
Quoted 1 line · Aneesh Kumar K.V
No real change, only style changes
If there are no real changes and it does not help upcoming patches in the series, should not it just follow patch 17 after all the header movement has been completed before we get down to real changes. IMHO the sequence of patches matters.
PATCH v5 24/31 powerpc/mm: Convert __hash_page_64K to C
In reply to Aneesh Kumar K.VConvert from asm to C
--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 3 +- arch/powerpc/include/asm/book3s/64/hash.h | 1 + arch/powerpc/mm/hash64_64k.c | 134 +++++++++++- arch/powerpc/mm/hash_low_64.S | 290 +------------------------- arch/powerpc/mm/hash_utils_64.c | 19 +- 5 files changed, 137 insertions(+), 310 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-64k.h +2 -1
@@ -35,7 +35,8 @@#define _PAGE_4K_PFN 0x00040000/* PFN is for a single 4k page */ /* PTE flags to conserve for HPTE identification */ -#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_COMBO) +#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_F_SECOND | \ + _PAGE_F_GIX | _PAGE_HASHPTE | _PAGE_COMBO)/* Shift to put page number into pte. *
arch/powerpc/include/asm/book3s/64/hash.h +1 -0
@@ -84,6 +84,7 @@#define _PAGE_HASHPTE 0x00400/* software: pte has an associated HPTE */ #define _PAGE_BUSY 0x00800/* software: PTE & hash are busy */ #define _PAGE_F_GIX 0x07000/* full page: hidx bits */ +#define _PAGE_F_GIX_SHIFT 12#define _PAGE_F_SECOND 0x08000/* Whether to use secondary hash or not */ #define _PAGE_SPECIAL 0x10000/* software: special page */
arch/powerpc/mm/hash64_64k.c +132 -2
152 lines not on this page · raw message
arch/powerpc/mm/hash_low_64.S +1 -289
293 lines not on this page · raw message
arch/powerpc/mm/hash_utils_64.c +1 -18
@@ -633,28 +633,11 @@ extern u32 htab_call_hpte_insert1[];extern u32 htab_call_hpte_insert2[];extern u32 htab_call_hpte_remove[];extern u32 htab_call_hpte_updatepp[]; -extern u32 ht64_call_hpte_insert1[]; -extern u32 ht64_call_hpte_insert2[]; -extern u32 ht64_call_hpte_remove[]; -extern u32 ht64_call_hpte_updatepp[];static void __init htab_finish_init (void ) { -#ifdef CONFIG_PPC_64K_PAGES -patch_branch (ht64_call_hpte_insert1, -ppc_function_entry (ppc_md.hpte_insert), -BRANCH_SET_LINK ); -patch_branch (ht64_call_hpte_insert2, -ppc_function_entry (ppc_md.hpte_insert), -BRANCH_SET_LINK ); -patch_branch (ht64_call_hpte_remove, -ppc_function_entry (ppc_md.hpte_remove), -BRANCH_SET_LINK ); -patch_branch (ht64_call_hpte_updatepp, -ppc_function_entry (ppc_md.hpte_updatepp), -BRANCH_SET_LINK ); -#else /* !CONFIG_PPC_64K_PAGES */ +#ifdef CONFIG_PPC_4K_PAGES patch_branch (htab_call_hpte_insert1,ppc_function_entry (ppc_md.hpte_insert),BRANCH_SET_LINK );
Signature · 1 line
2.5.0
PATCH v5 25/31 powerpc/mm: Convert 4k insert from asm to C
In reply to Aneesh Kumar K.VThis is similar to 64K insert. May be we want to consolidate
--- arch/powerpc/mm/Makefile | 6 +- arch/powerpc/mm/hash64_4k.c | 139 +++++++++++++++++ arch/powerpc/mm/hash_low_64.S | 331 ---------------------------------------- arch/powerpc/mm/hash_utils_64.c | 26 ---- 4 files changed, 142 insertions(+), 360 deletions(-) create mode 100644 arch/powerpc/mm/hash64_4k.c delete mode 100644 arch/powerpc/mm/hash_low_64.S
arch/powerpc/mm/Makefile +3 -3
@@ -14,11 +14,11 @@ obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ obj-$(CONFIG_PPC_BOOK3E) += tlb_low_$(CONFIG_WORD_SIZE)e.o hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o slb_low.o slb.o $(hash64-y) -obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o -obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ - tlb_hash$(CONFIG_WORD_SIZE).o \ +obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o hash_low_32.o +obj-$(CONFIG_PPC_STD_MMU) += tlb_hash$(CONFIG_WORD_SIZE).o \ mmu_context_hash$(CONFIG_WORD_SIZE).o ifeq ($(CONFIG_PPC_STD_MMU_64),y) +obj-$(CONFIG_PPC_4K_PAGES) += hash64_4k.o obj-$(CONFIG_PPC_64K_PAGES) += hash64_64k.o endif obj-$(CONFIG_PPC_ICSWX) += icswx.o
arch/powerpc/mm/hash64_4k.c new file +139 -0
139 lines not on this page · raw message
arch/powerpc/mm/hash_low_64.S deleted +0 -331
331 lines not on this page · raw message
arch/powerpc/mm/hash_utils_64.c +0 -26
@@ -629,31 +629,6 @@ int remove_section_mapping(unsigned long start, unsigned long end) }#endif /* CONFIG_MEMORY_HOTPLUG */ -extern u32 htab_call_hpte_insert1[]; -extern u32 htab_call_hpte_insert2[]; -extern u32 htab_call_hpte_remove[]; -extern u32 htab_call_hpte_updatepp[]; - -static void __init htab_finish_init (void ) -{ - -#ifdef CONFIG_PPC_4K_PAGES -patch_branch (htab_call_hpte_insert1, -ppc_function_entry (ppc_md.hpte_insert), -BRANCH_SET_LINK ); -patch_branch (htab_call_hpte_insert2, -ppc_function_entry (ppc_md.hpte_insert), -BRANCH_SET_LINK ); -patch_branch (htab_call_hpte_remove, -ppc_function_entry (ppc_md.hpte_remove), -BRANCH_SET_LINK ); -patch_branch (htab_call_hpte_updatepp, -ppc_function_entry (ppc_md.hpte_updatepp), -BRANCH_SET_LINK ); -#endif - -} -static void __init htab_initialize (void ) {unsigned long table;
@@ -800,7 +775,6 @@ static void __init htab_initialize(void) mmu_linear_psize, mmu_kernel_ssize)); } -htab_finish_init ();DBG (" <- htab_initialize()\n" ); }
Signature · 1 line
2.5.0
PATCH v5 26/31 powerpc/mm: Remove the dependency on pte bit position in asm code
In reply to Aneesh Kumar K.VWe should not expect pte bit position in asm code. Simply by moving part of that to C
--- arch/powerpc/kernel/exceptions-64s.S | 16 +++------------- arch/powerpc/mm/hash_utils_64.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-)
arch/powerpc/kernel/exceptions-64s.S +3 -13
@@ -1556,28 +1556,18 @@ do_hash_page: lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ bne 77f /* then don't call hash_page now */ - /* - * We need to set the _PAGE_USER bit if MSR_PR is set or if we are - * accessing a userspace segment (even from the kernel). We assume - * kernel addresses always have the high bit set. - */ - rlwinm r4,r4,32-25+9,31-9,31-9 /* DSISR_STORE -> _PAGE_RW */ - rotldi r0,r3,15 /* Move high bit into MSR_PR posn */ - orc r0,r12,r0 /* MSR_PR | ~high_bit */ - rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */ - ori r4,r4,1 /* add _PAGE_PRESENT */ - rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */ /* * r3 contains the faulting address - * r4 contains the required access permissions + * r4 msr * r5 contains the trap number * r6 contains dsisr * * at return r3 = 0 for success, 1 for page fault, negative for error */ + mr r4,r12 ld r6,_DSISR(r1) - bl hash_page /* build HPTE if possible */ + bl __hash_page /* build HPTE if possible */ cmpdi r3,0 /* see if hash_page succeeded */ /* Success */
arch/powerpc/mm/hash_utils_64.c +29 -0
@@ -1162,6 +1162,35 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap, }EXPORT_SYMBOL_GPL (hash_page); +int __hash_page (unsigned long ea,unsigned long msr,unsigned long trap, +unsigned long dsisr) +{ +unsigned long access = _PAGE_PRESENT; +unsigned long flags =0 ; +struct mm_struct *mm = current->mm; + +if (REGION_ID (ea) ==VMALLOC_REGION_ID ) + mm = &init_mm; + +if (dsisr &DSISR_NOHPTE ) + flags |=HPTE_NOHPTE_UPDATE ; + +if (dsisr &DSISR_ISSTORE ) + access |= _PAGE_RW; +/* +* We need to set the _PAGE_USER bit if MSR_PR is set or if we are +* accessing a userspace segment (even from the kernel). We assume +* kernel addresses always have the high bit set. +*/ +if ((msr &MSR_PR ) || (REGION_ID (ea) ==USER_REGION_ID )) + access |= _PAGE_USER; + +if (trap ==0x400 ) + access |= _PAGE_EXEC; + +return hash_page_mm (mm, ea, access, trap, flags); +} +void hash_preload (struct mm_struct *mm,unsigned long ea,unsigned long access,unsigned long trap) {
Signature · 1 line
2.5.0
Re: [PATCH V5 26/31] powerpc/mm: Remove the dependency on pte bit position in asm code
Quoted 2 lines · Aneesh Kumar K.V
We should not expect pte bit position in asm code. Simply by moving part of that to C
There is a full stop missing in the second sentence. The commit message here does not tell about why we would want to process the page access flags or other PTE flags in the C code. Was it needed at this stage of this series during PTE change or its just an improvement which could have segregated out before.
Quoted 33 lines
Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/kernel/exceptions-64s.S | 16 +++------------- arch/powerpc/mm/hash_utils_64.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 13 deletions(-)arch/powerpc/kernel/exceptions-64s.S +1
-12@@ -1556,28 +1556,18 @@ do_hash_page: lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ bne 77f /* then don't call hash_page now */ - /* - * We need to set the _PAGE_USER bit if MSR_PR is set or if we are - * accessing a userspace segment (even from the kernel). We assume - * kernel addresses always have the high bit set. - */ - rlwinm r4,r4,32-25+9,31-9,31-9 /* DSISR_STORE -> _PAGE_RW */ - rotldi r0,r3,15 /* Move high bit into MSR_PR posn */ - orc r0,r12,r0 /* MSR_PR | ~high_bit */ - rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */ - ori r4,r4,1 /* add _PAGE_PRESENT */ - rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */ /* * r3 contains the faulting address - * r4 contains the required access permissions + * r4 msr * r5 contains the trap number
arch/powerpc/kernel/exceptions-64s.S do_hash_page: · line 1572
Quoted 10 lines
arch/powerpc/kernel/exceptions-64s.S +2
-1* r6 contains dsisr * * at return r3 = 0 for success, 1 for page fault, negative for error */ + mr r4,r12 ld r6,_DSISR(r1) - bl hash_page /* build HPTE if possible */ + bl __hash_page /* build HPTE if possible */ cmpdi r3,0 /* see if hash_page succeeded */
The comment needs to change to __hash_page ^^^^^^^^^^^^^^^^^^^^^^^^.
arch/powerpc/mm/hash_utils_64.c int hash_page(unsigned long ea, unsigned long access, unsigned long trap, · line 1163
Quoted 9 lines
arch/powerpc/kernel/exceptions-64s.S +0
-0/* Success */arch/powerpc/mm/hash_utils_64.c +0
-0@@ -1162,6 +1162,35 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap, }EXPORT_SYMBOL_GPL (hash_page);
So we are still keeping hash_page as an exported symbol here as there are consumers for it ?
Quoted 19 lines
arch/powerpc/mm/hash_utils_64.c +18
-0+int __hash_page (unsigned long ea,unsigned long msr,unsigned long trap, +unsigned long dsisr) +{ +unsigned long access = _PAGE_PRESENT; +unsigned long flags =0 ; +struct mm_struct *mm = current->mm; + +if (REGION_ID (ea) ==VMALLOC_REGION_ID ) + mm = &init_mm; + +if (dsisr &DSISR_NOHPTE ) + flags |=HPTE_NOHPTE_UPDATE ; + +if (dsisr &DSISR_ISSTORE ) + access |= _PAGE_RW; +/* +* We need to set the _PAGE_USER bit if MSR_PR is set or if we are +* accessing a userspace segment (even from the kernel). We assume
arch/powerpc/mm/hash_utils_64.c int hash_page(unsigned long ea, unsigned long access, unsigned long trap, · line 1192
Quoted 10 lines
arch/powerpc/mm/hash_utils_64.c +10
-0+* kernel addresses always have the high bit set. +*/ +if ((msr &MSR_PR ) || (REGION_ID (ea) ==USER_REGION_ID )) + access |= _PAGE_USER; + +if (trap ==0x400 ) + access |= _PAGE_EXEC; + +return hash_page_mm (mm, ea, access, trap, flags); +}
There are some code similarity between hash_page and __hash_page above. Cant we consolidate some part of it ?
PATCH v5 27/31 powerpc/mm: Add helper for converting pte bit to hpte bits
In reply to Aneesh Kumar K.VInstead of open coding it in multiple code paths, export the helper and add more documentation. Also make sure we don't make assumption regarding pte bit position
--- arch/powerpc/include/asm/book3s/64/hash.h | 1 + arch/powerpc/mm/hash64_4k.c | 13 +----------- arch/powerpc/mm/hash64_64k.c | 35 +++---------------------------- arch/powerpc/mm/hash_utils_64.c | 22 ++++++++++++------- arch/powerpc/mm/hugepage-hash64.c | 13 +----------- arch/powerpc/mm/hugetlbpage-hash64.c | 4 +--- 6 files changed, 21 insertions(+), 67 deletions(-)
arch/powerpc/include/asm/book3s/64/hash.h +1 -0
@@ -238,6 +238,7 @@ extern unsigned long pmd_hugepage_update(struct mm_struct *mm,pmd_t *pmdp, unsigned long clr, unsigned long set); +extern unsigned long htab_convert_pte_flags (unsigned long pteflags);/* Atomic PTE updates */ static inline unsigned long pte_update(struct mm_struct *mm, unsigned long addr,
arch/powerpc/mm/hash64_4k.c +1 -12
@@ -53,18 +53,7 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,* PP bits. _PAGE_USER is already PP bit 0x2, so we only * need to add in 0x1 if it's a read-only user page */ - rflags = new_pte & _PAGE_USER; -if ((new_pte & _PAGE_USER) && !((new_pte & _PAGE_RW) && - (new_pte & _PAGE_DIRTY))) - rflags |=0x1 ; -/* -* _PAGE_EXEC -> HW_NO_EXEC since it's inverted -*/ - rflags |= ((new_pte & _PAGE_EXEC) ?0 :HPTE_R_N ); -/* -* Always add C and Memory coherence bit -*/ - rflags |=HPTE_R_C |HPTE_R_M ; + rflags =htab_convert_pte_flags (new_pte);/* * Add in WIMG bits */
arch/powerpc/mm/hash64_64k.c +3 -32
@@ -76,22 +76,7 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,* Handle the subpage protection bits */ subpg_pte = new_pte & ~subpg_prot; -/* -* PP bits. _PAGE_USER is already PP bit 0x2, so we only -* need to add in 0x1 if it's a read-only user page -*/ - rflags = subpg_pte & _PAGE_USER; -if ((subpg_pte & _PAGE_USER) && !((subpg_pte & _PAGE_RW) && - (subpg_pte & _PAGE_DIRTY))) - rflags |=0x1 ; -/* -* _PAGE_EXEC -> HW_NO_EXEC since it's inverted -*/ - rflags |= ((subpg_pte & _PAGE_EXEC) ?0 :HPTE_R_N ); -/* -* Always add C and Memory coherence bit -*/ - rflags |=HPTE_R_C |HPTE_R_M ; + rflags =htab_convert_pte_flags (subpg_pte);/* * Add in WIMG bits */
@@ -262,22 +247,8 @@ int __hash_page_64K(unsigned long ea, unsigned long access, new_pte |= _PAGE_DIRTY; }while (old_pte !=__cmpxchg_u64 ((unsigned long *)ptep, old_pte, new_pte)); -/* -* PP bits. _PAGE_USER is already PP bit 0x2, so we only -* need to add in 0x1 if it's a read-only user page -*/ - rflags = new_pte & _PAGE_USER; -if ((new_pte & _PAGE_USER) && !((new_pte & _PAGE_RW) && - (new_pte & _PAGE_DIRTY))) - rflags |=0x1 ; -/* -* _PAGE_EXEC -> HW_NO_EXEC since it's inverted -*/ - rflags |= ((new_pte & _PAGE_EXEC) ?0 :HPTE_R_N ); -/* -* Always add C and Memory coherence bit -*/ - rflags |=HPTE_R_C |HPTE_R_M ; + + rflags =htab_convert_pte_flags (new_pte);/* * Add in WIMG bits */
arch/powerpc/mm/hash_utils_64.c +14 -8
@@ -159,20 +159,26 @@ static struct mmu_psize_def mmu_psize_defaults_gp[] = { }, }; -static unsigned long htab_convert_pte_flags (unsigned long pteflags) +unsigned long htab_convert_pte_flags (unsigned long pteflags) { -unsigned long rflags = pteflags &0x1fa ; +unsigned long rflags =0 ;/* _PAGE_EXEC -> NOEXEC */ if ((pteflags & _PAGE_EXEC) ==0 ) rflags |=HPTE_R_N ; - -/* PP bits. PAGE_USER is already PP bit 0x2, so we only -* need to add in 0x1 if it's a read-only user page +/* +* PP bits: +* Linux use slb key 0 for kernel and 1 for user. +* kernel areas are mapped by PP bits 00 +* and and there is no kernel RO (_PAGE_KERNEL_RO). +* User area mapped by 0x2 and read only use by +* 0x3. */ -if ((pteflags & _PAGE_USER) && !((pteflags & _PAGE_RW) && - (pteflags & _PAGE_DIRTY))) - rflags |=1 ; +if (pteflags & _PAGE_USER) { + rflags |=0x2 ; +if (!((pteflags & _PAGE_RW) && (pteflags & _PAGE_DIRTY))) + rflags |=0x1 ; + }/* * Always add "C" bit for perf. Memory coherence is always enabled */
arch/powerpc/mm/hugepage-hash64.c +1 -12
@@ -54,18 +54,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, new_pmd |= _PAGE_DIRTY; }while (old_pmd !=__cmpxchg_u64 ((unsigned long *)pmdp, old_pmd, new_pmd)); -/* -* PP bits. _PAGE_USER is already PP bit 0x2, so we only -* need to add in 0x1 if it's a read-only user page -*/ - rflags = new_pmd & _PAGE_USER; -if ((new_pmd & _PAGE_USER) && !((new_pmd & _PAGE_RW) && - (new_pmd & _PAGE_DIRTY))) - rflags |=0x1 ; -/* -* _PAGE_EXEC -> HW_NO_EXEC since it's inverted -*/ - rflags |= ((new_pmd & _PAGE_EXEC) ?0 :HPTE_R_N ); + rflags =htab_convert_pte_flags (new_pmd);#if 0 if (!cpu_has_feature (CPU_FTR_COHERENT_ICACHE )) {
arch/powerpc/mm/hugetlbpage-hash64.c +1 -3
@@ -59,10 +59,8 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, new_pte |= _PAGE_DIRTY; }while (old_pte !=__cmpxchg_u64 ((unsigned long *)ptep, old_pte, new_pte)); + rflags =htab_convert_pte_flags (new_pte); - rflags =0x2 | (!(new_pte & _PAGE_RW)); -/* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */ - rflags |= ((new_pte & _PAGE_EXEC) ?0 :HPTE_R_N ); sz = ((1UL ) << shift);if (!cpu_has_feature (CPU_FTR_COHERENT_ICACHE ))/* No CPU has hugepages but lacks no execute, so we
Signature · 1 line
2.5.0
PATCH v5 28/31 powerpc/mm: Move WIMG update to helper.
In reply to Aneesh Kumar K.VOnly difference here is, we apply the WIMG mapping early, so rflags passed to updatepp will also be changed.
--- arch/powerpc/mm/hash64_4k.c | 5 ----- arch/powerpc/mm/hash64_64k.c | 10 ---------- arch/powerpc/mm/hash_utils_64.c | 13 ++++++++++++- arch/powerpc/mm/hugepage-hash64.c | 7 ------- arch/powerpc/mm/hugetlbpage-hash64.c | 8 -------- 5 files changed, 12 insertions(+), 31 deletions(-)
arch/powerpc/mm/hash64_4k.c +0 -5
@@ -54,11 +54,6 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,* need to add in 0x1 if it's a read-only user page */ rflags =htab_convert_pte_flags (new_pte); -/* -* Add in WIMG bits -*/ - rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | - _PAGE_COHERENT | _PAGE_GUARDED));if (!cpu_has_feature (CPU_FTR_NOEXECUTE ) && !cpu_has_feature (CPU_FTR_COHERENT_ICACHE ))
arch/powerpc/mm/hash64_64k.c +0 -10
@@ -77,11 +77,6 @@ int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,*/ subpg_pte = new_pte & ~subpg_prot; rflags =htab_convert_pte_flags (subpg_pte); -/* -* Add in WIMG bits -*/ - rflags |= (subpg_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | - _PAGE_COHERENT | _PAGE_GUARDED));if (!cpu_has_feature (CPU_FTR_NOEXECUTE ) && !cpu_has_feature (CPU_FTR_COHERENT_ICACHE )) {
@@ -249,11 +244,6 @@ int __hash_page_64K(unsigned long ea, unsigned long access, old_pte, new_pte)); rflags =htab_convert_pte_flags (new_pte); -/* -* Add in WIMG bits -*/ - rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | - _PAGE_COHERENT | _PAGE_GUARDED));if (!cpu_has_feature (CPU_FTR_NOEXECUTE ) && !cpu_has_feature (CPU_FTR_COHERENT_ICACHE ))
arch/powerpc/mm/hash_utils_64.c +12 -1
@@ -182,7 +182,18 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags)/* * Always add "C" bit for perf. Memory coherence is always enabled */ -return rflags |HPTE_R_C |HPTE_R_M ; + rflags |=HPTE_R_C |HPTE_R_M ; +/* +* Add in WIG bits +*/ +if (pteflags & _PAGE_WRITETHRU) + rflags |=HPTE_R_W ; +if (pteflags & _PAGE_NO_CACHE) + rflags |=HPTE_R_I ; +if (pteflags & _PAGE_GUARDED) + rflags |=HPTE_R_G ; + +return rflags; } int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
arch/powerpc/mm/hugepage-hash64.c +0 -7
@@ -120,13 +120,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, pa =pmd_pfn (__pmd (old_pmd)) <<PAGE_SHIFT ; new_pmd |= _PAGE_HASHPTE; -/* Add in WIMG bits */ - rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | - _PAGE_GUARDED)); -/* -* enable the memory coherence always -*/ - rflags |=HPTE_R_M ; repeat: hpte_group = ((hash & htab_hash_mask) *HPTES_PER_GROUP ) & ~0x7UL ;
arch/powerpc/mm/hugetlbpage-hash64.c +0 -8
@@ -91,14 +91,6 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,/* clear HPTE slot informations in new PTE */ new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE; -/* Add in WIMG bits */ - rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | - _PAGE_COHERENT | _PAGE_GUARDED)); -/* -* enable the memory coherence always -*/ - rflags |=HPTE_R_M ; - slot =hpte_insert_repeating (hash, vpn, pa, rflags,0 , mmu_psize, ssize);
Signature · 1 line
2.5.0
Re: [PATCH V5 28/31] powerpc/mm: Move WIMG update to helper.
Quoted 2 lines · Aneesh Kumar K.V
Only difference here is, we apply the WIMG mapping early, so rflags passed to updatepp will also be changed.
This patch can be folded back with the previous patch.
PATCH v5 29/31 powerpc/mm: Move hugetlb related headers
In reply to Aneesh Kumar K.VW.r.t hugetlb, we support two format for pmd. With book3s_64 and 64K linux page size, we can have pte at the pmd level. Hence we don't need to support hugepd there. For everything else hugepd is supported and pmd_huge is (0).
--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 31 ++++++++++++ arch/powerpc/include/asm/book3s/64/hash-64k.h | 51 +++++++++++++++++++ arch/powerpc/include/asm/nohash/pgtable.h | 25 ++++++++++ arch/powerpc/include/asm/page.h | 42 ++-------------- arch/powerpc/mm/hugetlbpage-hash64.c | 18 +++++++ arch/powerpc/mm/hugetlbpage.c | 72 --------------------------- 6 files changed, 129 insertions(+), 110 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-4k.h +31 -0
@@ -93,6 +93,37 @@ extern struct page *pgd_page(pgd_t pgd);#define remap_4k_pfn (vma, addr, pfn, prot) \ remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, (prot)) +#ifdef CONFIG_HUGETLB_PAGE +/* +* For 4k page size, we support explicit hugepage via hugepd +*/ +static inline int pmd_huge (pmd_t pmd) +{ +return 0 ; +} + +static inline int pud_huge (pud_t pud) +{ +return 0 ; +} + +static inline int pgd_huge (pgd_t pgd) +{ +return 0 ; +} +#define pgd_huge pgd_huge + +static inline int hugepd_ok (hugepd_t hpd) +{ +/* +* hugepd pointer, bottom two bits == 00 and next 4 bits +* indicate size of table +*/ +return (((hpd.pd &0x3 ) ==0x0 ) && ((hpd.pd &HUGEPD_SHIFT_MASK ) !=0 )); +} +#define is_hugepd (hpd) (hugepd_ok(hpd)) +#endif +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_4K_H */
arch/powerpc/include/asm/book3s/64/hash-64k.h +51 -0
57 lines not on this page · raw message
arch/powerpc/include/asm/nohash/pgtable.h +25 -0
@@ -223,5 +223,30 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, unsigned long size, pgprot_t vma_prot);#define __HAVE_PHYS_MEM_ACCESS_PROT +#ifdef CONFIG_HUGETLB_PAGE +static inline int hugepd_ok (hugepd_t hpd) +{ +return (hpd.pd >0 ); +} + +static inline int pmd_huge (pmd_t pmd) +{ +return 0 ; +} + +static inline int pud_huge (pud_t pud) +{ +return 0 ; +} + +static inline int pgd_huge (pgd_t pgd) +{ +return 0 ; +} +#define pgd_huge pgd_huge + +#define is_hugepd (hpd) (hugepd_ok(hpd)) +#endif +#endif /* __ASSEMBLY__ */ #endif
arch/powerpc/include/asm/page.h +4 -38
49 lines not on this page · raw message
arch/powerpc/mm/hugetlbpage-hash64.c +18 -0
@@ -114,3 +114,21 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, *ptep =__pte (new_pte & ~_PAGE_BUSY);return 0 ; } + +#if defined(CONFIG_PPC_64K_PAGES ) && defined(CONFIG_DEBUG_VM ) +/* +* This enables us to catch the wrong page directory format +* Moved here so that we can use WARN() in the call. +*/ +int hugepd_ok (hugepd_t hpd) +{ +bool is_hugepd; + +/* +* We should not find this format in page directory, warn otherwise. +*/ + is_hugepd = (((hpd.pd &0x3 ) ==0x0 ) && ((hpd.pd &HUGEPD_SHIFT_MASK ) !=0 )); +WARN (is_hugepd,"Found wrong page directory format\n" ); +return 0 ; +} +#endif
arch/powerpc/mm/hugetlbpage.c +0 -72
78 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v5 30/31 powerpc/mm: Move THP headers around
In reply to Aneesh Kumar K.VWe support THP only with book3s_64 and 64K page size. Move THP details to hash64-64k.h to clarify the same.
--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 126 +++++++++++++ arch/powerpc/include/asm/book3s/64/hash.h | 223 +++++------------------ arch/powerpc/include/asm/nohash/64/pgtable.h | 253 +------------------------- arch/powerpc/mm/hash_native_64.c | 10 + arch/powerpc/mm/pgtable_64.c | 2 +- arch/powerpc/platforms/pseries/lpar.c | 10 + 6 files changed, 201 insertions(+), 423 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-64k.h +126 -0
@@ -170,6 +170,132 @@ static inline int hugepd_ok(hugepd_t hpd)#endif /* CONFIG_HUGETLB_PAGE */ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +extern unsigned long pmd_hugepage_update (struct mm_struct *mm, +unsigned long addr, +pmd_t *pmdp, +unsigned long clr, +unsigned long set); +static inline char *get_hpte_slot_array (pmd_t *pmdp) +{ +/* +* The hpte hindex is stored in the pgtable whose address is in the +* second half of the PMD +* +* Order this load with the test for pmd_trans_huge in the caller +*/ +smp_rmb (); +return *(char **)(pmdp +PTRS_PER_PMD ); + + +} +/* +* The linux hugepage PMD now include the pmd entries followed by the address +* to the stashed pgtable_t. The stashed pgtable_t contains the hpte bits. +* [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per +* each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and +* with 4K HPTE we need 4096 entries. Both will fit in a 4K pgtable_t. +* +* The last three bits are intentionally left to zero. This memory location +* are also used as normal page PTE pointers. So if we have any pointers +* left around while we collapse a hugepage, we need to make sure +* _PAGE_PRESENT bit of that is zero when we look at them +*/ +static inline unsigned int hpte_valid (unsigned char *hpte_slot_array,int index) +{ +return (hpte_slot_array[index] >>3 ) &0x1 ; +} + +static inline unsigned int hpte_hash_index (unsigned char *hpte_slot_array, +int index) +{ +return hpte_slot_array[index] >>4 ; +} + +static inline void mark_hpte_slot_valid (unsigned char *hpte_slot_array, +unsigned int index,unsigned int hidx) +{ + hpte_slot_array[index] = hidx <<4 |0x1 <<3 ; +} + +/* +* +* For core kernel code by design pmd_trans_huge is never run on any hugetlbfs +* page. The hugetlbfs page table walking and mangling paths are totally +* separated form the core VM paths and they're differentiated by +* VM_HUGETLB being set on vm_flags well before any pmd_trans_huge could run. +* +* pmd_trans_huge() is defined as false at build time if +* CONFIG_TRANSPARENT_HUGEPAGE=n to optimize away code blocks at build +* time in such case. +* +* For ppc64 we need to differntiate from explicit hugepages from THP, because +* for THP we also track the subpage details at the pmd level. We don't do +* that for explicit huge pages. +* +*/ +static inline int pmd_trans_huge (pmd_t pmd) +{ +/* +* leaf pte for huge page, bottom two bits != 00 +*/ +return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); +} + +static inline int pmd_trans_splitting (pmd_t pmd) +{ +if (pmd_trans_huge (pmd)) +return pmd_val (pmd) & _PAGE_SPLITTING; +return 0 ; +} + +static inline int pmd_large (pmd_t pmd) +{ +/* +* leaf pte for huge page, bottom two bits != 00 +*/ +return ((pmd_val (pmd) &0x3 ) !=0x0 ); +} + +static inline pmd_t pmd_mknotpresent (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); +} + +static inline pmd_t pmd_mksplitting (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); +} + +#define __HAVE_ARCH_PMD_SAME +static inline int pmd_same (pmd_t pmd_a,pmd_t pmd_b) +{ +return (((pmd_val (pmd_a) ^pmd_val (pmd_b)) & ~_PAGE_HPTEFLAGS) ==0 ); +} + +static inline int __pmdp_test_and_clear_young (struct mm_struct *mm, +unsigned long addr,pmd_t *pmdp) +{ +unsigned long old; + +if ((pmd_val (*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) ==0 ) +return 0 ; + old =pmd_hugepage_update (mm, addr, pmdp, _PAGE_ACCESSED,0 ); +return ((old & _PAGE_ACCESSED) !=0 ); +} + +#define __HAVE_ARCH_PMDP_SET_WRPROTECT +static inline void pmdp_set_wrprotect (struct mm_struct *mm,unsigned long addr, +pmd_t *pmdp) +{ + +if ((pmd_val (*pmdp) & _PAGE_RW) ==0 ) +return ; + +pmd_hugepage_update (mm, addr, pmdp, _PAGE_RW,0 ); +} + +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_64K_H */
arch/powerpc/include/asm/book3s/64/hash.h +49 -174
253 lines not on this page · raw message
arch/powerpc/include/asm/nohash/64/pgtable.h +5 -248
263 lines not on this page · raw message
arch/powerpc/mm/hash_native_64.c +10 -0
@@ -429,6 +429,7 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,local_irq_restore (flags); } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE static void native_hugepage_invalidate(unsigned long vsid, unsigned long addr, unsigned char *hpte_slot_array,
@@ -482,6 +483,15 @@ static void native_hugepage_invalidate(unsigned long vsid, }local_irq_restore (flags); } +#else +static void native_hugepage_invalidate (unsigned long vsid, +unsigned long addr, +unsigned char *hpte_slot_array, +int psize,int ssize,int local) +{ +WARN (1 ,"%s called without THP support\n" , __func__); +} +#endif static inline int __hpte_actual_psize (unsigned int lp,int psize) {
arch/powerpc/mm/pgtable_64.c +1 -1
@@ -359,7 +359,7 @@ struct page *pud_page(pud_t pud)struct page *pmd_page (pmd_t pmd) {if (pmd_trans_huge (pmd) ||pmd_huge (pmd)) -return pfn_to_page (pmd_pfn (pmd)); +return pte_page (pmd_pte (pmd));return virt_to_page (pmd_page_vaddr (pmd)); }
arch/powerpc/platforms/pseries/lpar.c +10 -0
@@ -396,6 +396,7 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,BUG_ON (lpar_rc !=H_SUCCESS ); } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE /* * Limit iterations holding pSeries_lpar_tlbie_lock to 3. We also need * to make sure that we avoid bouncing the hypervisor tlbie lock.
@@ -494,6 +495,15 @@ static void pSeries_lpar_hugepage_invalidate(unsigned long vsid,__pSeries_lpar_hugepage_invalidate (slot_array, vpn_array, index, psize, ssize); } +#else +static void pSeries_lpar_hugepage_invalidate (unsigned long vsid, +unsigned long addr, +unsigned char *hpte_slot_array, +int psize,int ssize,int local) +{ +WARN (1 ,"%s called without THP support\n" , __func__); +} +#endif static void pSeries_lpar_hpte_removebolted (unsigned long ea,int psize,int ssize)
Signature · 1 line
2.5.0
Re: [PATCH V5 30/31] powerpc/mm: Move THP headers around
Quoted 577 lines · Aneesh Kumar K.V
We support THP only with
book3s_64and 64K page size. Move THP details tohash64-64k.hto clarify the same.Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 126 +++++++++++++ arch/powerpc/include/asm/book3s/64/hash.h | 223 +++++------------------ arch/powerpc/include/asm/nohash/64/pgtable.h | 253 +------------------------- arch/powerpc/mm/hash_native_64.c | 10 + arch/powerpc/mm/pgtable_64.c | 2 +- arch/powerpc/platforms/pseries/lpar.c | 10 + 6 files changed, 201 insertions(+), 423 deletions(-)arch/powerpc/include/asm/book3s/64/hash-64k.h +21
-0@@ -170,6 +170,132 @@ static inline int hugepd_ok(hugepd_t hpd)#endif /* CONFIG_HUGETLB_PAGE */ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +extern unsigned long pmd_hugepage_update (struct mm_struct *mm, +unsigned long addr, +pmd_t *pmdp, +unsigned long clr, +unsigned long set); +static inline char *get_hpte_slot_array (pmd_t *pmdp) +{ +/* +* The hpte hindex is stored in the pgtable whose address is in the +* second half of the PMD +* +* Order this load with the test for pmd_trans_huge in the caller +*/ +smp_rmb (); +return *(char **)(pmdp +PTRS_PER_PMD ); + + +} +/* +* The linux hugepage PMD now include the pmd entries followed by the address
+ * to the stashedpgtable_t. The stashedpgtable_tcontains the hpte bits.
+ * [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per
+ * each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and
+ * with 4K HPTE we need 4096 entries. Both will fit in a 4Kpgtable_t.
+ *
+ * The last three bits are intentionally left to zero. This memory location
+ * are also used as normal page PTE pointers. So if we have any pointers
+ * left around while we collapse a hugepage, we need to make sure
+ *_PAGE_PRESENTbit of that is zero when we look at them
+ */
+static inline unsigned inthpte_valid(unsigned char *hpte_slot_array, int index)arch/powerpc/include/asm/book3s/64/hash-64k.h +19
-0+{ +return (hpte_slot_array[index] >>3 ) &0x1 ; +} + +static inline unsigned int hpte_hash_index (unsigned char *hpte_slot_array, +int index) +{ +return hpte_slot_array[index] >>4 ; +} + +static inline void mark_hpte_slot_valid (unsigned char *hpte_slot_array, +unsigned int index,unsigned int hidx) +{ + hpte_slot_array[index] = hidx <<4 |0x1 <<3 ; +} + +/* +* +* For core kernel code by design pmd_trans_huge is never run on any hugetlbfs
+ * page. The hugetlbfs page table walking and mangling paths are totally
+ * separated form the core VM paths and they're differentiated by
+ *VM_HUGETLBbeing set onvm_flagswell before anypmd_trans_hugecould run.
+ *
+ *pmd_trans_huge()is defined as false at build time if
+ *CONFIG_TRANSPARENT_HUGEPAGE=nto optimize away code blocks at build
+ * time in such case.
+ *
+ * For ppc64 we need to differntiate from explicit hugepages from THP, because
+ * for THP we also track the subpage details at the pmd level. We don't do
+ * that for explicit huge pages.
+ *
+ */arch/powerpc/include/asm/book3s/64/hash-64k.h +52
-0+static inline int pmd_trans_huge (pmd_t pmd) +{ +/* +* leaf pte for huge page, bottom two bits != 00 +*/ +return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); +} + +static inline int pmd_trans_splitting (pmd_t pmd) +{ +if (pmd_trans_huge (pmd)) +return pmd_val (pmd) & _PAGE_SPLITTING; +return 0 ; +} + +static inline int pmd_large (pmd_t pmd) +{ +/* +* leaf pte for huge page, bottom two bits != 00 +*/ +return ((pmd_val (pmd) &0x3 ) !=0x0 ); +} + +static inline pmd_t pmd_mknotpresent (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); +} + +static inline pmd_t pmd_mksplitting (pmd_t pmd) +{ +return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); +} + +#define __HAVE_ARCH_PMD_SAME +static inline int pmd_same (pmd_t pmd_a,pmd_t pmd_b) +{ +return (((pmd_val (pmd_a) ^pmd_val (pmd_b)) & ~_PAGE_HPTEFLAGS) ==0 ); +} + +static inline int __pmdp_test_and_clear_young (struct mm_struct *mm, +unsigned long addr,pmd_t *pmdp) +{ +unsigned long old; + +if ((pmd_val (*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) ==0 ) +return 0 ; + old =pmd_hugepage_update (mm, addr, pmdp, _PAGE_ACCESSED,0 ); +return ((old & _PAGE_ACCESSED) !=0 ); +} + +#define __HAVE_ARCH_PMDP_SET_WRPROTECT +static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned longaddr,
arch/powerpc/include/asm/book3s/64/hash-64k.h +10
-0+ pmd_t *pmdp) +{ + +if ((pmd_val (*pmdp) & _PAGE_RW) ==0 ) +return ; + +pmd_hugepage_update (mm, addr, pmdp, _PAGE_RW,0 ); +} + +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_64K_H */ arch/powerpc/include/asm/book3s/64/hash.h +49
-0@@ -2,6 +2,55 @@#define _ASM_POWERPC_BOOK3S_64_HASH_H#ifdef __KERNEL__ +/* +* Common bits between 4K and 64K pages in a linux-style PTE. +* These match the bits in the (hardware-defined) PowerPC PTE as closely +* as possible. Additional bits may be defined in pgtable-hash64-*.h +* +* Note: We only support user read/write permissions. Supervisor always +* have full read/write to pages above PAGE_OFFSET (pages below that +* always use the user access permissions). +* +* We could create separate kernel read-only if we used the 3 PP bits +* combinations that newer processors provide but we currently don't. +*/ +#define _PAGE_PRESENT 0x00001/* software: pte contains a translation */ +#define _PAGE_USER 0x00002/* matches one of the PP bits */ +#define _PAGE_BIT_SWAP_TYPE 2 +#define _PAGE_EXEC 0x00004/* No execute on POWER4 and newer (we invert) */ +#define _PAGE_GUARDED 0x00008 +/* We can derive Memory coherence from _PAGE_NO_CACHE */ +#define _PAGE_COHERENT 0x0 +#define _PAGE_NO_CACHE 0x00020/* I: cache inhibit */ +#define _PAGE_WRITETHRU 0x00040/* W: cache write-through */ +#define _PAGE_DIRTY 0x00080/* C: page changed */ +#define _PAGE_ACCESSED 0x00100/* R: page referenced */ +#define _PAGE_RW 0x00200/* software: user write access allowed */ +#define _PAGE_HASHPTE 0x00400/* software: pte has an associated HPTE */ +#define _PAGE_BUSY 0x00800/* software: PTE & hash are busy */ +#define _PAGE_F_GIX 0x07000/* full page: hidx bits */ +#define _PAGE_F_GIX_SHIFT 12 +#define _PAGE_F_SECOND 0x08000/* Whether to use secondary hash or not */ +#define _PAGE_SPECIAL 0x10000/* software: special page */ + +/* +* THP pages can't be special. So use the _PAGE_SPECIAL +*/ +#define _PAGE_SPLITTING _PAGE_SPECIAL + +/* +* We need to differentiate between explicit huge page and THP huge +* page, since THP huge page also need to track real subpage details +*/ +#define _PAGE_THP_HUGE _PAGE_4K_PFN + +/* +* set of bits not changed in pmd_modify. +*/ +#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ + _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ + _PAGE_THP_HUGE) +#ifdef CONFIG_PPC_64K_PAGES #include <asm/book3s/64/hash-64k.h> #else
arch/powerpc/include/asm/book3s/64/hash.h +0
-30@@ -57,36 +106,6 @@#define HAVE_ARCH_UNMAPPED_AREA #define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN #endif /* CONFIG_PPC_MM_SLICES */ -/* -* Common bits between 4K and 64K pages in a linux-style PTE. -* These match the bits in the (hardware-defined) PowerPC PTE as closely -* as possible. Additional bits may be defined in pgtable-hash64-*.h -* -* Note: We only support user read/write permissions. Supervisor always -* have full read/write to pages above PAGE_OFFSET (pages below that -* always use the user access permissions). -* -* We could create separate kernel read-only if we used the 3 PP bits -* combinations that newer processors provide but we currently don't. -*/ -#define _PAGE_PRESENT 0x00001/* software: pte contains a translation */ -#define _PAGE_USER 0x00002/* matches one of the PP bits */ -#define _PAGE_BIT_SWAP_TYPE 2 -#define _PAGE_EXEC 0x00004/* No execute on POWER4 and newer (we invert) */ -#define _PAGE_GUARDED 0x00008 -/* We can derive Memory coherence from _PAGE_NO_CACHE */ -#define _PAGE_COHERENT 0x0 -#define _PAGE_NO_CACHE 0x00020/* I: cache inhibit */ -#define _PAGE_WRITETHRU 0x00040/* W: cache write-through */ -#define _PAGE_DIRTY 0x00080/* C: page changed */ -#define _PAGE_ACCESSED 0x00100/* R: page referenced */ -#define _PAGE_RW 0x00200/* software: user write access allowed */ -#define _PAGE_HASHPTE 0x00400/* software: pte has an associated HPTE */ -#define _PAGE_BUSY 0x00800/* software: PTE & hash are busy */ -#define _PAGE_F_GIX 0x07000/* full page: hidx bits */ -#define _PAGE_F_GIX_SHIFT 12 -#define _PAGE_F_SECOND 0x08000/* Whether to use secondary hash or not */ -#define _PAGE_SPECIAL 0x10000/* software: special page */ /* No separate kernel read-only */ #define
_PAGE_KERNEL_RW(_PAGE_RW|_PAGE_DIRTY) /* user access blocked by
key */arch/powerpc/include/asm/book3s/64/hash.h +0
-38@@ -105,24 +124,6 @@/* Hash table based platforms need atomic updates of the linux PTE */ #define PTE_ATOMIC_UPDATES 1 - -/* -* THP pages can't be special. So use the _PAGE_SPECIAL -*/ -#define _PAGE_SPLITTING _PAGE_SPECIAL - -/* -* We need to differentiate between explicit huge page and THP huge -* page, since THP huge page also need to track real subpage details -*/ -#define _PAGE_THP_HUGE _PAGE_4K_PFN - -/* -* set of bits not changed in pmd_modify. -*/ -#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ - _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ - _PAGE_THP_HUGE)#define _PTE_NONE_MASK _PAGE_HPTEFLAGS/* * The mask convered by the RPN must be a ULL on 32-bit platforms with @@ -233,11 +234,6 @@extern void hpte_need_flush (struct mm_struct *mm,unsigned long addr,pte_t *ptep,unsigned long pte,int huge); -extern unsigned long pmd_hugepage_update (struct mm_struct *mm, -unsigned long addr, -pmd_t *pmdp, -unsigned long clr, -unsigned long set);extern unsigned long htab_convert_pte_flags (unsigned long pteflags);/* Atomic PTE updates */ static inline unsigned long pte_update(struct mm_struct *mm,@@ -363,127 +359,6 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)#define __HAVE_ARCH_PTE_SAME#define pte_same (A ,B ) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) -static inline char *get_hpte_slot_array (pmd_t *pmdp) -{ -/* -* The hpte hindex is stored in the pgtable whose address is in the -* second half of the PMD -* -* Order this load with the test for pmd_trans_huge in the caller -*/ -smp_rmb (); -return *(char **)(pmdp +PTRS_PER_PMD ); - - -} -/* -* The linux hugepage PMD now include the pmd entries followed by the address
- * to the stashedpgtable_t. The stashedpgtable_tcontains the hpte bits.
- * [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per
- * each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and
- * with 4K HPTE we need 4096 entries. Both will fit in a 4Kpgtable_t.
- *
- * The last three bits are intentionally left to zero. This memory location
- * are also used as normal page PTE pointers. So if we have any pointers
- * left around while we collapse a hugepage, we need to make sure
- *_PAGE_PRESENTbit of that is zero when we look at them
- */
-static inline unsigned inthpte_valid(unsigned char *hpte_slot_array, int index)arch/powerpc/include/asm/book3s/64/hash.h +0
-20-{ -return (hpte_slot_array[index] >>3 ) &0x1 ; -} - -static inline unsigned int hpte_hash_index (unsigned char *hpte_slot_array, -int index) -{ -return hpte_slot_array[index] >>4 ; -} - -static inline void mark_hpte_slot_valid (unsigned char *hpte_slot_array, -unsigned int index,unsigned int hidx) -{ - hpte_slot_array[index] = hidx <<4 |0x1 <<3 ; -} - -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -/* -* -* For core kernel code by design pmd_trans_huge is never run on any hugetlbfs
- * page. The hugetlbfs page table walking and mangling paths are totally
- * separated form the core VM paths and they're differentiated by
- *VM_HUGETLBbeing set onvm_flagswell before anypmd_trans_hugecould run.
- *
- *pmd_trans_huge()is defined as false at build time if
- *CONFIG_TRANSPARENT_HUGEPAGE=nto optimize away code blocks at build
- * time in such case.
- *
- * For ppc64 we need to differntiate from explicit hugepages from THP, because
- * for THP we also track the subpage details at the pmd level. We don't do
- * that for explicit huge pages.
- *
- */arch/powerpc/include/asm/book3s/64/hash.h +0
-53-static inline int pmd_trans_huge (pmd_t pmd) -{ -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); -} - -static inline int pmd_trans_splitting (pmd_t pmd) -{ -if (pmd_trans_huge (pmd)) -return pmd_val (pmd) & _PAGE_SPLITTING; -return 0 ; -} - -#endif -static inline int pmd_large (pmd_t pmd) -{ -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return ((pmd_val (pmd) &0x3 ) !=0x0 ); -} - -static inline pmd_t pmd_mknotpresent (pmd_t pmd) -{ -return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); -} - -static inline pmd_t pmd_mksplitting (pmd_t pmd) -{ -return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); -} - -#define __HAVE_ARCH_PMD_SAME -static inline int pmd_same (pmd_t pmd_a,pmd_t pmd_b) -{ -return (((pmd_val (pmd_a) ^pmd_val (pmd_b)) & ~_PAGE_HPTEFLAGS) ==0 ); -} - -static inline int __pmdp_test_and_clear_young (struct mm_struct *mm, -unsigned long addr,pmd_t *pmdp) -{ -unsigned long old; - -if ((pmd_val (*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) ==0 ) -return 0 ; - old =pmd_hugepage_update (mm, addr, pmdp, _PAGE_ACCESSED,0 ); -return ((old & _PAGE_ACCESSED) !=0 ); -} - -#define __HAVE_ARCH_PMDP_SET_WRPROTECT -static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned longaddr,
arch/powerpc/include/asm/book3s/64/hash.h +0
-9- pmd_t *pmdp) -{ - -if ((pmd_val (*pmdp) & _PAGE_RW) ==0 ) -return ; - -pmd_hugepage_update (mm, addr, pmdp, _PAGE_RW,0 ); -} -/* Generic accessors to PTE bits */ static inline int pte_write(pte_t pte) { return !!(pte_val(pte) &
_PAGE_RW);}
static inline intpte_dirty(pte_t pte){ return !!(pte_val(pte) &_PAGE_DIRTY); }arch/powerpc/include/asm/nohash/64/pgtable.h +5
-21@@ -154,6 +154,11 @@ static inline void pmd_clear(pmd_t *pmdp) *pmdp =__pmd (0 ); } +static inline pte_t pmd_pte (pmd_t pmd) +{ +return __pte (pmd_val (pmd)); +} +#define pmd_none (pmd) (!pmd_val(pmd))#define pmd_bad (pmd) (!is_kernel_addr(pmd_val(pmd)) \ || (pmd_val(pmd) & PMD_BAD_BITS))@@ -389,252 +394,4 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *));void pgtable_cache_init (void );#endif /* __ASSEMBLY__ */ -/* -* THP pages can't be special. So use the _PAGE_SPECIAL -*/ -#define _PAGE_SPLITTING _PAGE_SPECIAL - -/* -* We need to differentiate between explicit huge page and THP huge -* page, since THP huge page also need to track real subpage details -*/ -#define _PAGE_THP_HUGE _PAGE_4K_PFN - -/* -* set of bits not changed in pmd_modify. -*/ -#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ - _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ - _PAGE_THP_HUGE) - -#ifndef __ASSEMBLY__ -/* -* The linux hugepage PMD now include the pmd entries followed by the address
- * to the stashedpgtable_t. The stashedpgtable_tcontains the hpte bits.
- * [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per
- * each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and
- * with 4K HPTE we need 4096 entries. Both will fit in a 4Kpgtable_t.
- *
- * The last three bits are intentionally left to zero. This memory location
- * are also used as normal page PTE pointers. So if we have any pointers
- * left around while we collapse a hugepage, we need to make sure
- *_PAGE_PRESENTbit of that is zero when we look at them
- */
-static inline unsigned inthpte_valid(unsigned char *hpte_slot_array, int index)arch/powerpc/include/asm/nohash/64/pgtable.h +0
-34-{ -return (hpte_slot_array[index] >>3 ) &0x1 ; -} - -static inline unsigned int hpte_hash_index (unsigned char *hpte_slot_array, -int index) -{ -return hpte_slot_array[index] >>4 ; -} - -static inline void mark_hpte_slot_valid (unsigned char *hpte_slot_array, -unsigned int index,unsigned int hidx) -{ - hpte_slot_array[index] = hidx <<4 |0x1 <<3 ; -} - -struct page *realmode_pfn_to_page (unsigned long pfn); - -static inline char *get_hpte_slot_array (pmd_t *pmdp) -{ -/* -* The hpte hindex is stored in the pgtable whose address is in the -* second half of the PMD -* -* Order this load with the test for pmd_trans_huge in the caller -*/ -smp_rmb (); -return *(char **)(pmdp +PTRS_PER_PMD ); - - -} - -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -extern void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned longaddr,
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-7- pmd_t *pmdp, unsigned long old_pmd); -extern pmd_t pfn_pmd (unsigned long pfn,pgprot_t pgprot); -extern pmd_t mk_pmd (struct page *page,pgprot_t pgprot); -extern pmd_t pmd_modify (pmd_t pmd,pgprot_t newprot); -extern void set_pmd_at (struct mm_struct *mm,unsigned long addr, -pmd_t *pmdp,pmd_t pmd); -extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned longaddr,
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-4- pmd_t *pmd); -/* -* -* For core kernel code by design pmd_trans_huge is never run on any hugetlbfs
- * page. The hugetlbfs page table walking and mangling paths are totally
- * separated form the core VM paths and they're differentiated by
- *VM_HUGETLBbeing set onvm_flagswell before anypmd_trans_hugecould run.
- *
- *pmd_trans_huge()is defined as false at build time if
- *CONFIG_TRANSPARENT_HUGEPAGE=nto optimize away code blocks at build
- * time in such case.
- *
- * For ppc64 we need to differntiate from explicit hugepages from THP, because
- * for THP we also track the subpage details at the pmd level. We don't do
- * that for explicit huge pages.
- *
- */arch/powerpc/include/asm/nohash/64/pgtable.h +0
-13-static inline int pmd_trans_huge (pmd_t pmd) -{ -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); -} - -static inline int pmd_trans_splitting (pmd_t pmd) -{ -if (pmd_trans_huge (pmd)) -return pmd_val (pmd) & _PAGE_SPLITTING; -return 0 ;
arch/powerpc/include/asm/nohash/64/pgtable.h void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); · line 504
Quoted 10 lines
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-10-} - -extern int has_transparent_hugepage (void ); -#else -static inline void hpte_do_hugepage_flush (struct mm_struct *mm, -unsigned long addr,pmd_t *pmdp, -unsigned long old_pmd) -{ - -WARN (1 ,"%s called with THP disabled\n" , __func__);
We can't reach this function with huge pages disabled, right? Would it be better to use WARN_ON_ONCE?
Quoted 155 lines
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-95-} -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ - -static inline int pmd_large (pmd_t pmd) -{ -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return ((pmd_val (pmd) &0x3 ) !=0x0 ); -} - -static inline pte_t pmd_pte (pmd_t pmd) -{ -return __pte (pmd_val (pmd)); -} - -static inline pmd_t pte_pmd (pte_t pte) -{ -return __pmd (pte_val (pte)); -} - -static inline pte_t *pmdp_ptep (pmd_t *pmd) -{ -return (pte_t *)pmd; -} - -#define pmd_pfn (pmd) pte_pfn(pmd_pte(pmd)) -#define pmd_dirty (pmd) pte_dirty(pmd_pte(pmd)) -#define pmd_young (pmd) pte_young(pmd_pte(pmd)) -#define pmd_mkold (pmd) pte_pmd(pte_mkold(pmd_pte(pmd))) -#define pmd_wrprotect (pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd))) -#define pmd_mkdirty (pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd))) -#define pmd_mkyoung (pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd))) -#define pmd_mkwrite (pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd))) - -#define __HAVE_ARCH_PMD_WRITE -#define pmd_write (pmd) pte_write(pmd_pte(pmd)) - -static inline pmd_t pmd_mkhuge (pmd_t pmd) -{ -/* Do nothing, mk_pmd() does this part. */ -return pmd; -} - -static inline pmd_t pmd_mknotpresent (pmd_t pmd) -{ -return __pmd (pmd_val (pmd) & ~_PAGE_PRESENT); -} - -static inline pmd_t pmd_mksplitting (pmd_t pmd) -{ -return __pmd (pmd_val (pmd) | _PAGE_SPLITTING); -} - -#define __HAVE_ARCH_PMD_SAME -static inline int pmd_same (pmd_t pmd_a,pmd_t pmd_b) -{ -return (((pmd_val (pmd_a) ^pmd_val (pmd_b)) & ~_PAGE_HPTEFLAGS) ==0 ); -} - -#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS -extern int pmdp_set_access_flags (struct vm_area_struct *vma, -unsigned long address,pmd_t *pmdp, -pmd_t entry,int dirty); - -extern unsigned long pmd_hugepage_update (struct mm_struct *mm, -unsigned long addr, -pmd_t *pmdp, -unsigned long clr, -unsigned long set); - -static inline int __pmdp_test_and_clear_young (struct mm_struct *mm, -unsigned long addr,pmd_t *pmdp) -{ -unsigned long old; - -if ((pmd_val (*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) ==0 ) -return 0 ; - old =pmd_hugepage_update (mm, addr, pmdp, _PAGE_ACCESSED,0 ); -return ((old & _PAGE_ACCESSED) !=0 ); -} - -#define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG -extern int pmdp_test_and_clear_young (struct vm_area_struct *vma, -unsigned long address,pmd_t *pmdp); -#define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH -extern int pmdp_clear_flush_young (struct vm_area_struct *vma, -unsigned long address,pmd_t *pmdp); - -#define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR -extern pmd_t pmdp_huge_get_and_clear (struct mm_struct *mm, -unsigned long addr,pmd_t *pmdp); - -#define __HAVE_ARCH_PMDP_SET_WRPROTECT -static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned longaddr,
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-22- pmd_t *pmdp) -{ - -if ((pmd_val (*pmdp) & _PAGE_RW) ==0 ) -return ; - -pmd_hugepage_update (mm, addr, pmdp, _PAGE_RW,0 ); -} - -#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH -extern void pmdp_splitting_flush (struct vm_area_struct *vma, -unsigned long address,pmd_t *pmdp); - -extern pmd_t pmdp_collapse_flush (struct vm_area_struct *vma, -unsigned long address,pmd_t *pmdp); -#define pmdp_collapse_flush pmdp_collapse_flush - -#define __HAVE_ARCH_PGTABLE_DEPOSIT -extern void pgtable_trans_huge_deposit (struct mm_struct *mm,pmd_t *pmdp, -pgtable_t pgtable); -#define __HAVE_ARCH_PGTABLE_WITHDRAW -extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t*pmdp);
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-3- -#define __HAVE_ARCH_PMDP_INVALIDATE -extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned longaddress,
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-15- pmd_t *pmdp); - -#define pmd_move_must_withdraw pmd_move_must_withdraw -struct spinlock ; -static inline int pmd_move_must_withdraw (struct spinlock *new_pmd_ptl, -struct spinlock *old_pmd_ptl) -{ -/* -* Archs like ppc64 use pgtable to store per pmd -* specific information. So when we switch the pmd, -* we should also withdraw and deposit the pgtable -*/ -return true; -} -#endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_NOHASH_64_PGTABLE_H */ arch/powerpc/mm/hash_native_64.c +1
-0@@ -429,6 +429,7 @@ static void native_hpte_invalidate(unsigned long slot,unsigned long vpn,local_irq_restore (flags ); } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE static void native_hugepage_invalidate(unsigned long vsid, unsigned long addr,arch/powerpc/mm/hash_native_64.c +0
-0unsigned char *hpte_slot_array,@@ -482,6 +483,15 @@ static void native_hugepage_invalidate(unsigned long vsid,
arch/powerpc/mm/hash_native_64.c static void native_hugepage_invalidate(unsigned long · line 493
Quoted 10 lines
arch/powerpc/mm/hash_native_64.c +7
-0}local_irq_restore (flags); } +#else +static void native_hugepage_invalidate (unsigned long vsid, +unsigned long addr, +unsigned char *hpte_slot_array, +int psize,int ssize,int local) +{ +WARN (1 ,"%s called without THP support\n" , __func__);
ditto
Quoted 34 lines
arch/powerpc/mm/hash_native_64.c +2
-0+} +#endif static inline int __hpte_actual_psize (unsigned int lp,int psize){
arch/powerpc/mm/pgtable_64.c +1
-1@@ -359,7 +359,7 @@ struct page *pud_page(pud_t pud)struct page *pmd_page (pmd_t pmd) {if (pmd_trans_huge (pmd) ||pmd_huge (pmd)) -return pfn_to_page (pmd_pfn (pmd)); +return pte_page (pmd_pte (pmd));return virt_to_page (pmd_page_vaddr (pmd)); }arch/powerpc/platforms/pseries/lpar.c +1
-0@@ -396,6 +396,7 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,BUG_ON (lpar_rc !=H_SUCCESS ); } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE /* * Limit iterations holding pSeries_lpar_tlbie_lock to 3. We also need * to make sure that we avoid bouncing the hypervisor tlbie lock.
arch/powerpc/platforms/pseries/lpar.c +0
-0@@ -494,6 +495,15 @@ static void pSeries_lpar_hugepage_invalidate(unsigned long vsid,
arch/powerpc/platforms/pseries/lpar.c static void pSeries_lpar_hugepage_invalidate(unsigned · line 505
Quoted 10 lines
arch/powerpc/platforms/pseries/lpar.c +7
-0__pSeries_lpar_hugepage_invalidate (slot_array, vpn_array, index, psize, ssize); } +#else +static void pSeries_lpar_hugepage_invalidate (unsigned long vsid, +unsigned long addr, +unsigned char *hpte_slot_array, +int psize,int ssize,int local) +{ +WARN (1 ,"%s called without THP support\n" , __func__);
ditto
Quoted 9 lines
arch/powerpc/platforms/pseries/lpar.c +2
-0+} +#endif static void pSeries_lpar_hpte_removebolted(unsigned long ea,int psize, int ssize)
--
2.5.0
Re: [PATCH V5 30/31] powerpc/mm: Move THP headers around
Quoted 3 lines · Denis Kirjanov
Quoted 2 lines · Aneesh Kumar K.V
We support THP only with
book3s_64and 64K page size. Move THP details tohash64-64k.hto clarify the same.
...
Quoted 8 lines
arch/powerpc/include/asm/nohash/64/pgtable.h void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); · line 504
Quoted 6 lines
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-6-static inline void hpte_do_hugepage_flush (struct mm_struct *mm, -unsigned long addr,pmd_t *pmdp, -unsigned long old_pmd) -{ - -WARN (1 ,"%s called with THP disabled\n" , __func__);We can't reach this function with huge pages disabled, right? Would it be better to use
WARN_ON_ONCE?
Shouldn't matter, if should never get called and if we get called, them something is really wrong, and mostly need a kernel fix. This will only happen during devel mistakes.
-aneesh
Re: [PATCH V5 30/31] powerpc/mm: Move THP headers around
Quoted 16 lines · Aneesh Kumar K.V
Quoted 3 lines · Denis Kirjanov
Quoted 2 lines · Aneesh Kumar K.V
We support THP only with
book3s_64and 64K page size. Move THP details tohash64-64k.hto clarify the same....
Quoted 8 lines
arch/powerpc/include/asm/nohash/64/pgtable.h void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); · line 504
Quoted 6 lines
arch/powerpc/include/asm/nohash/64/pgtable.h +0
-6-static inline void hpte_do_hugepage_flush (struct mm_struct *mm, -unsigned long addr,pmd_t *pmdp, -unsigned long old_pmd) -{ - -WARN (1 ,"%s called with THP disabled\n" , __func__);We can't reach this function with huge pages disabled, right? Would it be better to use
WARN_ON_ONCE?
Quoted 3 lines
Shouldn't matter, if should never get called and if we get called, them something is really wrong, and mostly need a kernel fix. This will only happen during devel mistakes.
Ok, we can put the BUG() macro then, but as I know Linus doesn't like it :) So WARN() is fine I think
Quoted 4 lines
-aneesh
PATCH v5 31/31 powerpc/mm: Add a _PAGE_PTE bit
In reply to Aneesh Kumar K.VFor a pte entry we will have _PAGE_PTE set. Our pte page address have a minimum alignment requirement of HUGEPD_SHIFT_MASK + 1. We use the lower 7 bits to indicate hugepd. ie.
For pmd and pgd we can find:
1) _PAGE_PTE set pte -> indicate PTE
2) bits [2..6] non zero -> indicate hugepd.
They also encode the size. We skip bit 1 (_PAGE_PRESENT).
3) othewise pointer to next table.
--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 9 ++++++--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 23 +++++++++-------------- arch/powerpc/include/asm/book3s/64/hash.h | 13 +++++++------ arch/powerpc/include/asm/book3s/64/pgtable.h | 3 +-- arch/powerpc/include/asm/pte-common.h | 5 +++++ arch/powerpc/mm/hugetlbpage.c | 4 ++-- arch/powerpc/mm/pgtable.c | 4 ++++ arch/powerpc/mm/pgtable_64.c | 7 +------ 8 files changed, 35 insertions(+), 33 deletions(-)
arch/powerpc/include/asm/book3s/64/hash-4k.h +6 -3
@@ -116,10 +116,13 @@ static inline int pgd_huge(pgd_t pgd)static inline int hugepd_ok (hugepd_t hpd) {/* -* hugepd pointer, bottom two bits == 00 and next 4 bits -* indicate size of table +* if it is not a pte and have hugepd shift mask +* set, then it is a hugepd directory pointer */ -return (((hpd.pd &0x3 ) ==0x0 ) && ((hpd.pd &HUGEPD_SHIFT_MASK ) !=0 )); +if (!(hpd.pd & _PAGE_PTE) && + ((hpd.pd &HUGEPD_SHIFT_MASK ) !=0 )) +return true; +return false; }#define is_hugepd (hpd) (hugepd_ok(hpd))#endif
arch/powerpc/include/asm/book3s/64/hash-64k.h +9 -14
@@ -130,25 +130,25 @@ static inline bool __rpte_sub_valid(real_pte_t rpte, unsigned long index)static inline int pmd_huge (pmd_t pmd) {/* -* leaf pte for huge page, bottom two bits != 00 +* leaf pte for huge page */ -return ((pmd_val (pmd) &0x3 ) !=0x0 ); +return !!(pmd_val (pmd) & _PAGE_PTE); }static inline int pud_huge (pud_t pud) {/* -* leaf pte for huge page, bottom two bits != 00 +* leaf pte for huge page */ -return ((pud_val (pud) &0x3 ) !=0x0 ); +return !!(pud_val (pud) & _PAGE_PTE); }static inline int pgd_huge (pgd_t pgd) {/* -* leaf pte for huge page, bottom two bits != 00 +* leaf pte for huge page */ -return ((pgd_val (pgd) &0x3 ) !=0x0 ); +return !!(pgd_val (pgd) & _PAGE_PTE); }#define pgd_huge pgd_huge
@@ -236,10 +236,8 @@ static inline void mark_hpte_slot_valid(unsigned char *hpte_slot_array,*/ static inline int pmd_trans_huge (pmd_t pmd) { -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); +return !!((pmd_val (pmd) & (_PAGE_PTE | _PAGE_THP_HUGE)) == + (_PAGE_PTE | _PAGE_THP_HUGE)); }static inline int pmd_trans_splitting (pmd_t pmd)
@@ -251,10 +249,7 @@ static inline int pmd_trans_splitting(pmd_t pmd)static inline int pmd_large (pmd_t pmd) { -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return ((pmd_val (pmd) &0x3 ) !=0x0 ); +return !!(pmd_val (pmd) & _PAGE_PTE); }static inline pmd_t pmd_mknotpresent (pmd_t pmd)
arch/powerpc/include/asm/book3s/64/hash.h +7 -6
@@ -14,11 +14,12 @@* We could create separate kernel read-only if we used the 3 PP bits * combinations that newer processors provide but we currently don't. */ -#define _PAGE_PRESENT 0x00001/* software: pte contains a translation */ -#define _PAGE_USER 0x00002/* matches one of the PP bits */ +#define _PAGE_PTE 0x00001 +#define _PAGE_PRESENT 0x00002/* software: pte contains a translation */ #define _PAGE_BIT_SWAP_TYPE 2 -#define _PAGE_EXEC 0x00004/* No execute on POWER4 and newer (we invert) */ -#define _PAGE_GUARDED 0x00008 +#define _PAGE_USER 0x00004/* matches one of the PP bits */ +#define _PAGE_EXEC 0x00008/* No execute on POWER4 and newer (we invert) */ +#define _PAGE_GUARDED 0x00010/* We can derive Memory coherence from _PAGE_NO_CACHE */ #define _PAGE_COHERENT 0x0#define _PAGE_NO_CACHE 0x00020/* I: cache inhibit */
@@ -49,7 +50,7 @@*/ #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ - _PAGE_THP_HUGE) + _PAGE_THP_HUGE | _PAGE_PTE)#ifdef CONFIG_PPC_64K_PAGES #include <asm/book3s/64/hash-64k.h>
@@ -137,7 +138,7 @@* pgprot changes */ #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ - _PAGE_ACCESSED | _PAGE_SPECIAL) + _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE)/* * Mask of bits returned by pte_pgprot() */
arch/powerpc/include/asm/book3s/64/pgtable.h +1 -2
@@ -213,8 +213,7 @@ static inline int pmd_protnone(pmd_t pmd)static inline pmd_t pmd_mkhuge (pmd_t pmd) { -/* Do nothing, mk_pmd() does this part. */ -return pmd; +return __pmd (pmd_val (pmd) | (_PAGE_PTE | _PAGE_THP_HUGE)); }#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS
arch/powerpc/include/asm/pte-common.h +5 -0
@@ -40,6 +40,11 @@#else #define _PAGE_RW 0#endif + +#ifndef _PAGE_PTE +#define _PAGE_PTE 0 +#endif +#ifndef _PMD_PRESENT_MASK#define _PMD_PRESENT_MASK _PMD_PRESENT#endif
arch/powerpc/mm/hugetlbpage.c +2 -2
@@ -894,8 +894,8 @@ void flush_dcache_icache_hugepage(struct page *page)* We have 4 cases for pgds and pmds: * (1) invalid (all zeroes) * (2) pointer to next table, as normal; bottom 6 bits == 0 -* (3) leaf pte for huge page, bottom two bits != 00 -* (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size of table +* (3) leaf pte for huge page _PAGE_PTE set +* (4) hugepd pointer, _PAGE_PTE = 0 and bits [2..6] indicate size of table * * So long as we atomically load page table pointers we are safe against teardown, * we can follow the address down to the the page and take a ref on it.
arch/powerpc/mm/pgtable.c +4 -0
@@ -179,6 +179,10 @@ void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,*/ VM_WARN_ON ((pte_val (*ptep) & (_PAGE_PRESENT | _PAGE_USER)) == (_PAGE_PRESENT | _PAGE_USER)); +/* +* Add the pte bit when tryint set a pte +*/ + pte =__pte (pte_val (pte) | _PAGE_PTE);/* Note: mm->context.id might not yet have been assigned as * this context might not have been activated yet when this
arch/powerpc/mm/pgtable_64.c +1 -6
@@ -765,13 +765,8 @@ static pmd_t pmd_set_protbits(pmd_t pmd, pgprot_t pgprot)pmd_t pfn_pmd (unsigned long pfn,pgprot_t pgprot) {unsigned long pmdv; -/* -* For a valid pte, we would have _PAGE_PRESENT always -* set. We use this to check THP page at pmd level. -* leaf pte for huge page, bottom two bits != 00 -*/ + pmdv = pfn <<PTE_RPN_SHIFT ; - pmdv |= _PAGE_THP_HUGE;return pmd_set_protbits (__pmd (pmdv), pgprot); }
Signature · 1 line
2.5.0
Re: [PATCH V5 31/31] powerpc/mm: Add a _PAGE_PTE bit
Quoted 32 lines · Aneesh Kumar K.V
For a pte entry we will have
_PAGE_PTEset. Our pte page address have a minimum alignment requirement ofHUGEPD_SHIFT_MASK+ 1. We use the lower 7 bits to indicate hugepd. ie.For pmd and pgd we can find:
1)_PAGE_PTEset pte -> indicate PTE
2) bits [2..6] non zero -> indicate hugepd.
They also encode the size. We skip bit 1 (_PAGE_PRESENT).
3) othewise pointer to next table.Acked-by Scott Wood <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/include/asm/book3s/64/hash-4k.h | 9 ++++++--- arch/powerpc/include/asm/book3s/64/hash-64k.h | 23 +++++++++-------------- arch/powerpc/include/asm/book3s/64/hash.h | 13 +++++++------ arch/powerpc/include/asm/book3s/64/pgtable.h | 3 +-- arch/powerpc/include/asm/pte-common.h | 5 +++++ arch/powerpc/mm/hugetlbpage.c | 4 ++-- arch/powerpc/mm/pgtable.c | 4 ++++ arch/powerpc/mm/pgtable_64.c | 7 +------ 8 files changed, 35 insertions(+), 33 deletions(-)arch/powerpc/include/asm/book3s/64/hash-4k.h +0
-0@@ -116,10 +116,13 @@ static inline int pgd_huge(pgd_t pgd)static inline int hugepd_ok (hugepd_t hpd) {/*
arch/powerpc/include/asm/book3s/64/hash-4k.h static inline int pgd_huge(pgd_t pgd) · line 125
Quoted 10 lines
arch/powerpc/include/asm/book3s/64/hash-4k.h +6
-3-* hugepd pointer, bottom two bits == 00 and next 4 bits -* indicate size of table +* if it is not a pte and have hugepd shift mask +* set, then it is a hugepd directory pointer */ -return (((hpd.pd &0x3 ) ==0x0 ) && ((hpd.pd &HUGEPD_SHIFT_MASK ) !=0 )); +if (!(hpd.pd & _PAGE_PTE) && + ((hpd.pd &HUGEPD_SHIFT_MASK ) !=0 )) +return true; +return false;
then the function can be converted to the bool type as well as all the logical functions below in the patch.
Quoted 199 lines
arch/powerpc/include/asm/book3s/64/hash-4k.h +0
-0}#define is_hugepd (hpd) (hugepd_ok(hpd))#endif arch/powerpc/include/asm/book3s/64/hash-64k.h +8
-10@@ -130,25 +130,25 @@ static inline bool __rpte_sub_valid(real_pte_t rpte, unsigned long index)static inline int pmd_huge (pmd_t pmd) {/* -* leaf pte for huge page, bottom two bits != 00 +* leaf pte for huge page */ -return ((pmd_val (pmd) &0x3 ) !=0x0 ); +return !!(pmd_val (pmd) & _PAGE_PTE); }static inline int pud_huge (pud_t pud) {/* -* leaf pte for huge page, bottom two bits != 00 +* leaf pte for huge page */ -return ((pud_val (pud) &0x3 ) !=0x0 ); +return !!(pud_val (pud) & _PAGE_PTE); }static inline int pgd_huge (pgd_t pgd) {/* -* leaf pte for huge page, bottom two bits != 00 +* leaf pte for huge page */ -return ((pgd_val (pgd) &0x3 ) !=0x0 ); +return !!(pgd_val (pgd) & _PAGE_PTE); }#define pgd_huge pgd_huge@@ -236,10 +236,8 @@ static inline void mark_hpte_slot_valid(unsigned char*hpte_slot_array, */ static inline int pmd_trans_huge (pmd_t pmd) { -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return (pmd_val (pmd) &0x3 ) && (pmd_val (pmd) & _PAGE_THP_HUGE); +return !!((pmd_val (pmd) & (_PAGE_PTE | _PAGE_THP_HUGE)) == + (_PAGE_PTE | _PAGE_THP_HUGE)); }static inline int
pmd_trans_splitting(pmd_t pmd)arch/powerpc/include/asm/book3s/64/hash-64k.h +1
-4@@ -251,10 +249,7 @@ static inline int pmd_trans_splitting(pmd_t pmd)static inline int pmd_large (pmd_t pmd) { -/* -* leaf pte for huge page, bottom two bits != 00 -*/ -return ((pmd_val (pmd) &0x3 ) !=0x0 ); +return !!(pmd_val (pmd) & _PAGE_PTE); }static inline pmd_t pmd_mknotpresent (pmd_t pmd)arch/powerpc/include/asm/book3s/64/hash.h +5
-4@@ -14,11 +14,12 @@* We could create separate kernel read-only if we used the 3 PP bits * combinations that newer processors provide but we currently don't. */ -#define _PAGE_PRESENT 0x00001/* software: pte contains a translation */ -#define _PAGE_USER 0x00002/* matches one of the PP bits */ +#define _PAGE_PTE 0x00001 +#define _PAGE_PRESENT 0x00002/* software: pte contains a translation */ #define _PAGE_BIT_SWAP_TYPE 2 -#define _PAGE_EXEC 0x00004/* No execute on POWER4 and newer (we invert) */ -#define _PAGE_GUARDED 0x00008 +#define _PAGE_USER 0x00004/* matches one of the PP bits */ +#define _PAGE_EXEC 0x00008/* No execute on POWER4 and newer (we invert) */ +#define _PAGE_GUARDED 0x00010/* We can derive Memory coherence from _PAGE_NO_CACHE */ #define
_PAGE_COHERENT0x0
#define_PAGE_NO_CACHE0x00020/* I: cache inhibit */arch/powerpc/include/asm/book3s/64/hash.h +2
-2@@ -49,7 +50,7 @@*/ #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \ _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \ - _PAGE_THP_HUGE) + _PAGE_THP_HUGE | _PAGE_PTE)#ifdef CONFIG_PPC_64K_PAGES #include <asm/book3s/64/hash-64k.h> @@ -137,7 +138,7 @@* pgprot changes */ #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ - _PAGE_ACCESSED | _PAGE_SPECIAL) + _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE)/* * Mask of bits returned by pte_pgprot() */ arch/powerpc/include/asm/book3s/64/pgtable.h +1
-2@@ -213,8 +213,7 @@ static inline int pmd_protnone(pmd_t pmd)static inline pmd_t pmd_mkhuge (pmd_t pmd) { -/* Do nothing, mk_pmd() does this part. */ -return pmd; +return __pmd (pmd_val (pmd) | (_PAGE_PTE | _PAGE_THP_HUGE)); }#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGSarch/powerpc/include/asm/pte-common.h +5
-0@@ -40,6 +40,11 @@#else #define _PAGE_RW 0#endif + +#ifndef _PAGE_PTE +#define _PAGE_PTE 0 +#endif +#ifndef _PMD_PRESENT_MASK#define _PMD_PRESENT_MASK _PMD_PRESENT#endif arch/powerpc/mm/hugetlbpage.c +0
-2@@ -894,8 +894,8 @@ void flush_dcache_icache_hugepage(struct page *page)* We have 4 cases for pgds and pmds: * (1) invalid (all zeroes) * (2) pointer to next table, as normal; bottom 6 bits == 0 -* (3) leaf pte for huge page, bottom two bits != 00 -* (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size of table
+ * (3) leaf pte for huge page_PAGE_PTEset
+ * (4) hugepd pointer,_PAGE_PTE= 0 and bits [2..6] indicate size of table
*
* So long as we atomically load page table pointers we are safe against
teardown,
* we can follow the address down to the the page and take a ref on it.arch/powerpc/mm/pgtable.c +4
-0@@ -179,6 +179,10 @@ void set_pte_at(struct mm_struct *mm, unsigned longaddr, pte_t *ptep, */ VM_WARN_ON ((pte_val (*ptep) & (_PAGE_PRESENT | _PAGE_USER)) == (_PAGE_PRESENT | _PAGE_USER)); +/* +* Add the pte bit when tryint set a pte +*/ + pte =__pte (pte_val (pte) | _PAGE_PTE);/* Note: mm->context.id might not yet have been assigned as arch/powerpc/mm/pgtable.c +0
-0* this context might not have been activated yet when this arch/powerpc/mm/pgtable_64.c +1
-7@@ -765,13 +765,8 @@ static pmd_t pmd_set_protbits(pmd_t pmd, pgprot_t pgprot) pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot) {unsigned long pmdv; -/* -* For a valid pte, we would have _PAGE_PRESENT always -* set. We use this to check THP page at pmd level. -* leaf pte for huge page, bottom two bits != 00 -*/ + pmdv = pfn <<PTE_RPN_SHIFT ; - pmdv |= _PAGE_THP_HUGE;return pmd_set_protbits (__pmd (pmdv), pgprot); } --2.5.0
Quoted 11 lines · Aneesh Kumar K.V
This patch series attempt to update book3s 64 linux page table format to make it more flexible. Our current pte format is very restrictive and we overload multiple pte bits. This is due to the non-availability of free bits in
pte_t. We usepte_tto track the validity of 4K subpages. This patch series free uppte_tof 11 bits by moving 4K subpage tracking to the lower half of PTE page. The pte format is updated such that we have a better method for identifying a pte entry at pmd level. This will also enable us to implement hugetlb migration(not yet done in this series).Before making the changes to the pte format, I am splitting the pte header definition such that we now have the below layout for headers
This series actually completely removes the tracking of the subages, right ? IE, it also halves the memory footprint of page tables, doesn't it ?
Cheers,
Ben.
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Aneesh Kumar K.V
This patch series attempt to update book3s 64 linux page table format to make it more flexible. Our current pte format is very restrictive and we overload multiple pte bits. This is due to the non-availability of free bits in
pte_t. We usepte_tto track the validity of 4K subpages. This patch series free uppte_tof 11 bits by moving 4K subpage tracking to the lower half of PTE page. The pte format is updated such that we have a better method for identifying a pte entry at pmd level. This will also enable us to implement hugetlb migration(not yet done in this series).
Quoted 7 lines
Quoted 2 lines
Before making the changes to the pte format, I am splitting the pte header definition such that we now have the below layout for headers
This series actually completely removes the tracking of the subages, right ? IE, it also halves the memory footprint of page tables, doesn't it ?
No, that is done in the next series.
http://mid.gmane.org/1448274825-30289-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com
-aneesh
Quoted 22 lines · Aneesh Kumar K.V
Hi All,
This patch series attempt to update book3s 64 linux page table format to make it more flexible. Our current pte format is very restrictive and we overload multiple pte bits. This is due to the non-availability of free bits in
pte_t. We usepte_tto track the validity of 4K subpages. This patch series free uppte_tof 11 bits by moving 4K subpage tracking to the lower half of PTE page. The pte format is updated such that we have a better method for identifying a pte entry at pmd level. This will also enable us to implement hugetlb migration(not yet done in this series).Before making the changes to the pte format, I am splitting the pte header definition such that we now have the below layout for headers
book3s
32
hash.hpgtable.h
64
hash.hpgtable.hhash-4k.hhash-64k.h
booke
32pgtable.h pte-40x.h pte-44x.h pte-8xx.h pte-fsl-booke.h
Quoted 8 lines
64
pgtable-4k.hpgtable-64k.hpgtable.hI have done the header split such that booke headers and modified to the minimum so as to avoid causing breakage in booke.
The patch series can also be found at
https://github.com/kvaneesh/linux.git book3s-pte-format
Aneesh,
The second commit on the tree branch (faa65ca8e) does not match with the second patch posted as part of the series. Has the tree been updated with the latest v5 patches ?
[02/31] powerpc/mm: move pte headers to book3s directory (part 2)