Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'mauro' into docs-next

A big set of fixes and RST conversions from Mauro. He swears that this is
the last RST conversion set, which is certainly cause for celebration.

+747 -596
+1 -1
Documentation/ABI/testing/sysfs-driver-w1_therm
··· 8 8 to device min/max capabilities. Values are integer as they are 9 9 stored in a 8bit register in the device. Lowest value is 10 10 automatically put to TL. Once set, alarms could be search at 11 - master level, refer to Documentation/w1/w1_generic.rst for 11 + master level, refer to Documentation/w1/w1-generic.rst for 12 12 detailed information 13 13 Users: any user space application which wants to communicate with 14 14 w1_term device
+3 -3
Documentation/PCI/pci.rst
··· 265 265 --------------------- 266 266 .. note:: 267 267 If anything below doesn't make sense, please refer to 268 - Documentation/DMA-API.txt. This section is just a reminder that 268 + :doc:`/core-api/dma-api`. This section is just a reminder that 269 269 drivers need to indicate DMA capabilities of the device and is not 270 270 an authoritative source for DMA interfaces. 271 271 ··· 291 291 Setup shared control data 292 292 ------------------------- 293 293 Once the DMA masks are set, the driver can allocate "consistent" (a.k.a. shared) 294 - memory. See Documentation/DMA-API.txt for a full description of 294 + memory. See :doc:`/core-api/dma-api` for a full description of 295 295 the DMA APIs. This section is just a reminder that it needs to be done 296 296 before enabling DMA on the device. 297 297 ··· 421 421 422 422 Then clean up "consistent" buffers which contain the control data. 423 423 424 - See Documentation/DMA-API.txt for details on unmapping interfaces. 424 + See :doc:`/core-api/dma-api` for details on unmapping interfaces. 425 425 426 426 427 427 Unregister from other subsystems
+17 -6
Documentation/admin-guide/mm/hugetlbpage.rst
··· 101 101 page size may be selected with the "default_hugepagesz=<size>" boot parameter. 102 102 103 103 Hugetlb boot command line parameter semantics 104 - hugepagesz - Specify a huge page size. Used in conjunction with hugepages 104 + 105 + hugepagesz 106 + Specify a huge page size. Used in conjunction with hugepages 105 107 parameter to preallocate a number of huge pages of the specified 106 108 size. Hence, hugepagesz and hugepages are typically specified in 107 - pairs such as: 109 + pairs such as:: 110 + 108 111 hugepagesz=2M hugepages=512 112 + 109 113 hugepagesz can only be specified once on the command line for a 110 114 specific huge page size. Valid huge page sizes are architecture 111 115 dependent. 112 - hugepages - Specify the number of huge pages to preallocate. This typically 116 + hugepages 117 + Specify the number of huge pages to preallocate. This typically 113 118 follows a valid hugepagesz or default_hugepagesz parameter. However, 114 119 if hugepages is the first or only hugetlb command line parameter it 115 120 implicitly specifies the number of huge pages of default size to 116 121 allocate. If the number of huge pages of default size is implicitly 117 122 specified, it can not be overwritten by a hugepagesz,hugepages 118 123 parameter pair for the default size. 119 - For example, on an architecture with 2M default huge page size: 124 + 125 + For example, on an architecture with 2M default huge page size:: 126 + 120 127 hugepages=256 hugepagesz=2M hugepages=512 128 + 121 129 will result in 256 2M huge pages being allocated and a warning message 122 130 indicating that the hugepages=512 parameter is ignored. If a hugepages 123 131 parameter is preceded by an invalid hugepagesz parameter, it will 124 132 be ignored. 125 - default_hugepagesz - Specify the default huge page size. This parameter can 133 + default_hugepagesz 134 + pecify the default huge page size. This parameter can 126 135 only be specified once on the command line. default_hugepagesz can 127 136 optionally be followed by the hugepages parameter to preallocate a 128 137 specific number of huge pages of default size. The number of default 129 138 sized huge pages to preallocate can also be implicitly specified as 130 139 mentioned in the hugepages section above. Therefore, on an 131 - architecture with 2M default huge page size: 140 + architecture with 2M default huge page size:: 141 + 132 142 hugepages=256 133 143 default_hugepagesz=2M hugepages=256 134 144 hugepages=256 default_hugepagesz=2M 145 + 135 146 will all result in 256 2M huge pages being allocated. Valid default 136 147 huge page size is architecture dependent. 137 148
+1
Documentation/admin-guide/mm/index.rst
··· 31 31 idle_page_tracking 32 32 ksm 33 33 memory-hotplug 34 + nommu-map 34 35 numa_memory_policy 35 36 numaperf 36 37 pagemap
+1 -1
Documentation/admin-guide/sysctl/vm.rst
··· 583 583 584 584 The default value is 1. 585 585 586 - See Documentation/nommu-mmap.txt for more information. 586 + See Documentation/admin-guide/mm/nommu-mmap.rst for more information. 587 587 588 588 589 589 numa_zonelist_order
+1 -1
Documentation/arm/booting.rst
··· 128 128 129 129 The boot loader must load a device tree image (dtb) into system ram 130 130 at a 64bit aligned address and initialize it with the boot data. The 131 - dtb format is documented in Documentation/devicetree/booting-without-of.txt. 131 + dtb format is documented in Documentation/devicetree/booting-without-of.rst. 132 132 The kernel will look for the dtb magic value of 0xd00dfeed at the dtb 133 133 physical address to determine if a dtb has been passed instead of a 134 134 tagged list.
+1 -1
Documentation/block/biodoc.rst
··· 196 196 do not have a corresponding kernel virtual address space mapping) and 197 197 low-memory pages. 198 198 199 - Note: Please refer to Documentation/DMA-API-HOWTO.txt for a discussion 199 + Note: Please refer to :doc:`/core-api/dma-api-howto` for a discussion 200 200 on PCI high mem DMA aspects and mapping of scatter gather lists, and support 201 201 for 64 bit PCI. 202 202
+1 -1
Documentation/bus-virt-phys-mapping.txt Documentation/core-api/bus-virt-phys-mapping.rst
··· 8 8 9 9 The virt_to_bus() and bus_to_virt() functions have been 10 10 superseded by the functionality provided by the PCI DMA interface 11 - (see Documentation/DMA-API-HOWTO.txt). They continue 11 + (see :doc:`/core-api/dma-api-howto`). They continue 12 12 to be documented below for historical purposes, but new code 13 13 must not use them. --davidm 00/12/12 14 14
+3 -3
Documentation/core-api/dma-api.rst
··· 5 5 :Author: James E.J. Bottomley <James.Bottomley@HansenPartnership.com> 6 6 7 7 This document describes the DMA API. For a more gentle introduction 8 - of the API (and actual examples), see Documentation/DMA-API-HOWTO.txt. 8 + of the API (and actual examples), see :doc:`/core-api/dma-api-howto`. 9 9 10 10 This API is split into two pieces. Part I describes the basic API. 11 11 Part II describes extensions for supporting non-consistent memory ··· 471 471 dma_attrs. 472 472 473 473 The interpretation of DMA attributes is architecture-specific, and 474 - each attribute should be documented in Documentation/DMA-attributes.txt. 474 + each attribute should be documented in :doc:`/core-api/dma-attributes`. 475 475 476 476 If dma_attrs are 0, the semantics of each of these functions 477 477 is identical to those of the corresponding function ··· 484 484 485 485 #include <linux/dma-mapping.h> 486 486 /* DMA_ATTR_FOO should be defined in linux/dma-mapping.h and 487 - * documented in Documentation/DMA-attributes.txt */ 487 + * documented in Documentation/core-api/dma-attributes.rst */ 488 488 ... 489 489 490 490 unsigned long attr;
+1 -1
Documentation/core-api/dma-isa-lpc.rst
··· 17 17 #include <asm/dma.h> 18 18 19 19 The first is the generic DMA API used to convert virtual addresses to 20 - bus addresses (see Documentation/DMA-API.txt for details). 20 + bus addresses (see :doc:`/core-api/dma-api` for details). 21 21 22 22 The second contains the routines specific to ISA DMA transfers. Since 23 23 this is not present on all platforms make sure you construct your
+3
Documentation/core-api/index.rst
··· 39 39 rbtree 40 40 generic-radix-tree 41 41 packing 42 + bus-virt-phys-mapping 43 + this_cpu_ops 42 44 timekeeping 43 45 errseq 44 46 ··· 84 82 :maxdepth: 1 85 83 86 84 memory-allocation 85 + unaligned-memory-access 87 86 dma-api 88 87 dma-api-howto 89 88 dma-attributes
+163 -131
Documentation/devicetree/booting-without-of.txt Documentation/devicetree/booting-without-of.rst
··· 1 - Booting the Linux/ppc kernel without Open Firmware 2 - -------------------------------------------------- 1 + .. SPDX-License-Identifier: GPL-2.0 3 2 4 - (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, 5 - IBM Corp. 6 - (c) 2005 Becky Bruce <becky.bruce at freescale.com>, 7 - Freescale Semiconductor, FSL SOC and 32-bit additions 8 - (c) 2006 MontaVista Software, Inc. 9 - Flash chip node definition 3 + ================================================== 4 + Booting the Linux/ppc kernel without Open Firmware 5 + ================================================== 10 6 11 - Table of Contents 12 - ================= 7 + Copyright (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, 8 + IBM Corp. 9 + 10 + Copyright (c) 2005 Becky Bruce <becky.bruce at freescale.com>, 11 + Freescale Semiconductor, FSL SOC and 32-bit additions 12 + 13 + Copyright (c) 2006 MontaVista Software, Inc. 14 + Flash chip node definition 15 + 16 + .. Table of Contents 13 17 14 18 I - Introduction 15 19 1) Entry point for arch/arm ··· 65 61 Revision Information 66 62 ==================== 67 63 68 - May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. 64 + May 18, 2005: Rev 0.1 65 + - Initial draft, no chapter III yet. 69 66 70 - May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or 67 + May 19, 2005: Rev 0.2 68 + - Add chapter III and bits & pieces here or 71 69 clarifies the fact that a lot of things are 72 70 optional, the kernel only requires a very 73 71 small device tree, though it is encouraged 74 72 to provide an as complete one as possible. 75 73 76 - May 24, 2005: Rev 0.3 - Precise that DT block has to be in RAM 74 + May 24, 2005: Rev 0.3 75 + - Precise that DT block has to be in RAM 77 76 - Misc fixes 78 77 - Define version 3 and new format version 16 79 78 for the DT block (version 16 needs kernel ··· 89 82 "name" property is now automatically 90 83 deduced from the unit name 91 84 92 - June 1, 2005: Rev 0.4 - Correct confusion between OF_DT_END and 85 + June 1, 2005: Rev 0.4 86 + - Correct confusion between OF_DT_END and 93 87 OF_DT_END_NODE in structure definition. 94 88 - Change version 16 format to always align 95 89 property data to 4 bytes. Since tokens are ··· 123 115 - Compare FSL SOC use of PCI to standard and make sure no new 124 116 node definition required. 125 117 - Add more information about node definitions for SOC devices 126 - that currently have no standard, like the FSL CPM. 118 + that currently have no standard, like the FSL CPM. 127 119 128 120 129 121 I - Introduction ··· 268 260 269 261 b) create your main platform file as 270 262 "arch/powerpc/platforms/myplatform/myboard_setup.c" and add it 271 - to the Makefile under the condition of your CONFIG_ 263 + to the Makefile under the condition of your ``CONFIG_`` 272 264 option. This file will define a structure of type "ppc_md" 273 265 containing the various callbacks that the generic code will 274 266 use to get to your platform specific code ··· 279 271 with classic Powerpc architectures. 280 272 281 273 3) Entry point for arch/x86 282 - ------------------------------- 274 + --------------------------- 283 275 284 276 There is one single 32bit entry point to the kernel at code32_start, 285 277 the decompressor (the real mode entry point goes to the same 32bit ··· 288 280 Documentation/x86/boot.rst 289 281 The physical pointer to the device-tree block (defined in chapter II) 290 282 is passed via setup_data which requires at least boot protocol 2.09. 291 - The type filed is defined as 283 + The type filed is defined as:: 292 284 293 - #define SETUP_DTB 2 285 + #define SETUP_DTB 2 294 286 295 287 This device-tree is used as an extension to the "boot page". As such it 296 288 does not parse / consider data which is already covered by the boot ··· 362 354 363 355 The kernel is passed the physical address pointing to an area of memory 364 356 that is roughly described in include/linux/of_fdt.h by the structure 365 - boot_param_header: 357 + boot_param_header::: 366 358 367 - struct boot_param_header { 359 + struct boot_param_header { 368 360 u32 magic; /* magic word OF_DT_HEADER */ 369 361 u32 totalsize; /* total size of DT block */ 370 362 u32 off_dt_struct; /* offset to structure */ ··· 382 374 383 375 /* version 17 fields below */ 384 376 u32 size_dt_struct; /* size of the DT structure block */ 385 - }; 377 + }; 386 378 387 - Along with the constants: 379 + Along with the constants:: 388 380 389 - /* Definitions used by the flattened device tree */ 390 - #define OF_DT_HEADER 0xd00dfeed /* 4: version, 391 - 4: total size */ 392 - #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name 393 - */ 394 - #define OF_DT_END_NODE 0x2 /* End node */ 395 - #define OF_DT_PROP 0x3 /* Property: name off, 396 - size, content */ 397 - #define OF_DT_END 0x9 381 + /* Definitions used by the flattened device tree */ 382 + #define OF_DT_HEADER 0xd00dfeed /* 4: version, 383 + 4: total size */ 384 + #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name 385 + */ 386 + #define OF_DT_END_NODE 0x2 /* End node */ 387 + #define OF_DT_PROP 0x3 /* Property: name off, 388 + size, content */ 389 + #define OF_DT_END 0x9 398 390 399 391 All values in this header are in big endian format, the various 400 392 fields in this header are defined more precisely below. All ··· 438 430 way to avoid overriding critical things like, on Open Firmware 439 431 capable machines, the RTAS instance, or on some pSeries, the TCE 440 432 tables used for the iommu. Typically, the reserve map should 441 - contain _at least_ this DT block itself (header,total_size). If 433 + contain **at least** this DT block itself (header,total_size). If 442 434 you are passing an initrd to the kernel, you should reserve it as 443 435 well. You do not need to reserve the kernel image itself. The map 444 436 should be 64-bit aligned. ··· 493 485 494 486 So the typical layout of a DT block (though the various parts don't 495 487 need to be in that order) looks like this (addresses go from top to 496 - bottom): 488 + bottom):: 497 489 498 490 499 491 ------------------------------ ··· 519 511 | 520 512 --- (base + totalsize) 521 513 522 - (*) The alignment gaps are not necessarily present; their presence 523 - and size are dependent on the various alignment requirements of 524 - the individual data blocks. 514 + (*) The alignment gaps are not necessarily present; their presence 515 + and size are dependent on the various alignment requirements of 516 + the individual data blocks. 525 517 526 518 527 519 2) Device tree generalities ··· 608 600 you a idea of what a device-tree looks like. I have purposefully kept 609 601 the "name" and "linux,phandle" properties which aren't necessary in 610 602 order to give you a better idea of what the tree looks like in 611 - practice. 603 + practice:: 612 604 613 605 / o device-tree 614 606 |- name = "device-tree" ··· 658 650 659 651 660 652 3) Device tree "structure" block 653 + -------------------------------- 661 654 662 655 The structure of the device tree is a linearized tree structure. The 663 656 "OF_DT_BEGIN_NODE" token starts a new node, and the "OF_DT_END_NODE" ··· 675 666 root node) 676 667 * [align gap to next 4 bytes boundary] 677 668 * for each property: 669 + 678 670 * token OF_DT_PROP (that is 0x00000003) 679 671 * 32-bit value of property value size in bytes (or 0 if no 680 672 value) 681 673 * 32-bit value of offset in string block of property name 682 674 * property value data if any 683 675 * [align gap to next 4 bytes boundary] 676 + 684 677 * [child nodes if any] 685 678 * token OF_DT_END_NODE (that is 0x00000002) 686 679 ··· 699 688 constraint. 700 689 701 690 4) Device tree "strings" block 691 + ------------------------------ 702 692 703 693 In order to save space, property names, which are generally redundant, 704 694 are stored separately in the "strings" block. This block is simply the ··· 712 700 III - Required content of the device tree 713 701 ========================================= 714 702 715 - WARNING: All "linux,*" properties defined in this document apply only 716 - to a flattened device-tree. If your platform uses a real 717 - implementation of Open Firmware or an implementation compatible with 718 - the Open Firmware client interface, those properties will be created 719 - by the trampoline code in the kernel's prom_init() file. For example, 720 - that's where you'll have to add code to detect your board model and 721 - set the platform number. However, when using the flattened device-tree 722 - entry point, there is no prom_init() pass, and thus you have to 723 - provide those properties yourself. 703 + .. Warning:: 704 + 705 + All ``linux,*`` properties defined in this document apply only 706 + to a flattened device-tree. If your platform uses a real 707 + implementation of Open Firmware or an implementation compatible with 708 + the Open Firmware client interface, those properties will be created 709 + by the trampoline code in the kernel's prom_init() file. For example, 710 + that's where you'll have to add code to detect your board model and 711 + set the platform number. However, when using the flattened device-tree 712 + entry point, there is no prom_init() pass, and thus you have to 713 + provide those properties yourself. 724 714 725 715 726 716 1) Note about cells and address representation ··· 783 769 "ranges" property is missing at a given level, it's assumed that 784 770 translation isn't possible, i.e., the registers are not visible on the 785 771 parent bus. The format of the "ranges" property for a bus is a list 786 - of: 772 + of:: 787 773 788 774 bus address, parent bus address, size 789 775 ··· 891 877 892 878 This node is the parent of all individual CPU nodes. It doesn't 893 879 have any specific requirements, though it's generally good practice 894 - to have at least: 880 + to have at least:: 895 881 896 882 #address-cells = <00000001> 897 883 #size-cells = <00000000> ··· 901 887 that format when reading the "reg" properties of a CPU node, see 902 888 below 903 889 904 - c) The /cpus/* nodes 890 + c) The ``/cpus/*`` nodes 905 891 906 892 So under /cpus, you are supposed to create a node for every CPU on 907 893 the machine. There is no specific restriction on the name of the ··· 917 903 - reg : This is the physical CPU number, it's a single 32-bit cell 918 904 and is also used as-is as the unit number for constructing the 919 905 unit name in the full path. For example, with 2 CPUs, you would 920 - have the full path: 906 + have the full path:: 907 + 921 908 /cpus/PowerPC,970FX@0 922 909 /cpus/PowerPC,970FX@1 910 + 923 911 (unit addresses do not require leading zeroes) 924 - - d-cache-block-size : one cell, L1 data cache block size in bytes (*) 912 + - d-cache-block-size : one cell, L1 data cache block size in bytes [#]_ 925 913 - i-cache-block-size : one cell, L1 instruction cache block size in 926 914 bytes 927 915 - d-cache-size : one cell, size of L1 data cache in bytes 928 916 - i-cache-size : one cell, size of L1 instruction cache in bytes 929 917 930 - (*) The cache "block" size is the size on which the cache management 931 - instructions operate. Historically, this document used the cache 932 - "line" size here which is incorrect. The kernel will prefer the cache 933 - block size and will fallback to cache line size for backward 934 - compatibility. 918 + .. [#] The cache "block" size is the size on which the cache management 919 + instructions operate. Historically, this document used the cache 920 + "line" size here which is incorrect. The kernel will prefer the cache 921 + block size and will fallback to cache line size for backward 922 + compatibility. 935 923 936 924 Recommended properties: 937 925 ··· 979 963 #address-cells and #size-cells of the root node. For example, 980 964 with both of these properties being 2 like in the example given 981 965 earlier, a 970 based machine with 6Gb of RAM could typically 982 - have a "reg" property here that looks like: 966 + have a "reg" property here that looks like:: 983 967 984 - 00000000 00000000 00000000 80000000 985 - 00000001 00000000 00000001 00000000 968 + 00000000 00000000 00000000 80000000 969 + 00000001 00000000 00000001 00000000 986 970 987 971 That is a range starting at 0 of 0x80000000 bytes and a range 988 972 starting at 0x100000000 and of 0x100000000 bytes. You can see ··· 1063 1047 See 1) above for more details on defining #address-cells. 1064 1048 - #size-cells : Size representation for "soc" devices 1065 1049 - #interrupt-cells : Defines the width of cells used to represent 1066 - interrupts. Typically this value is <2>, which includes a 1067 - 32-bit number that represents the interrupt number, and a 1068 - 32-bit number that represents the interrupt sense and level. 1069 - This field is only needed if the SOC contains an interrupt 1070 - controller. 1050 + interrupts. Typically this value is <2>, which includes a 1051 + 32-bit number that represents the interrupt number, and a 1052 + 32-bit number that represents the interrupt sense and level. 1053 + This field is only needed if the SOC contains an interrupt 1054 + controller. 1071 1055 1072 1056 The SOC node may contain child nodes for each SOC device that the 1073 1057 platform uses. Nodes should not be created for devices which exist 1074 1058 on the SOC but are not used by a particular platform. See chapter VI 1075 1059 for more information on how to specify devices that are part of a SOC. 1076 1060 1077 - Example SOC node for the MPC8540: 1061 + Example SOC node for the MPC8540:: 1078 1062 1079 1063 soc8540@e0000000 { 1080 1064 #address-cells = <1>; ··· 1095 1079 dtc source code can be found at 1096 1080 <http://git.jdl.com/gitweb/?p=dtc.git> 1097 1081 1098 - WARNING: This version is still in early development stage; the 1099 - resulting device-tree "blobs" have not yet been validated with the 1100 - kernel. The current generated block lacks a useful reserve map (it will 1101 - be fixed to generate an empty one, it's up to the bootloader to fill 1102 - it up) among others. The error handling needs work, bugs are lurking, 1103 - etc... 1082 + .. Warning:: 1083 + 1084 + This version is still in early development stage; the 1085 + resulting device-tree "blobs" have not yet been validated with the 1086 + kernel. The current generated block lacks a useful reserve map (it will 1087 + be fixed to generate an empty one, it's up to the bootloader to fill 1088 + it up) among others. The error handling needs work, bugs are lurking, 1089 + etc... 1104 1090 1105 1091 dtc basically takes a device-tree in a given format and outputs a 1106 1092 device-tree in another format. The currently supported formats are: 1107 1093 1108 - Input formats: 1109 - ------------- 1094 + Input formats 1095 + ------------- 1110 1096 1111 1097 - "dtb": "blob" format, that is a flattened device-tree block 1112 1098 with 1113 - header all in a binary blob. 1099 + header all in a binary blob. 1114 1100 - "dts": "source" format. This is a text file containing a 1115 1101 "source" for a device-tree. The format is defined later in this 1116 - chapter. 1102 + chapter. 1117 1103 - "fs" format. This is a representation equivalent to the 1118 - output of /proc/device-tree, that is nodes are directories and 1119 - properties are files 1104 + output of /proc/device-tree, that is nodes are directories and 1105 + properties are files 1120 1106 1121 - Output formats: 1122 - --------------- 1107 + Output formats 1108 + -------------- 1123 1109 1124 1110 - "dtb": "blob" format 1125 1111 - "dts": "source" format ··· 1131 1113 assembly file exports some symbols that can be used. 1132 1114 1133 1115 1134 - The syntax of the dtc tool is 1116 + The syntax of the dtc tool is:: 1135 1117 1136 1118 dtc [-I <input-format>] [-O <output-format>] 1137 1119 [-o output-filename] [-V output_version] input_filename ··· 1145 1127 uniqueness of linux, phandle properties, validity of strings, etc... 1146 1128 1147 1129 The format of the .dts "source" file is "C" like, supports C and C++ 1148 - style comments. 1130 + style comments:: 1149 1131 1150 - / { 1151 - } 1132 + / { 1133 + } 1152 1134 1153 1135 The above is the "device-tree" definition. It's the only statement 1154 1136 supported currently at the toplevel. 1155 1137 1156 - / { 1157 - property1 = "string_value"; /* define a property containing a 0 1158 - * terminated string 1159 - */ 1138 + :: 1160 1139 1161 - property2 = <0x1234abcd>; /* define a property containing a 1162 - * numerical 32-bit value (hexadecimal) 1163 - */ 1140 + / { 1141 + property1 = "string_value"; /* define a property containing a 0 1142 + * terminated string 1143 + */ 1164 1144 1165 - property3 = <0x12345678 0x12345678 0xdeadbeef>; 1166 - /* define a property containing 3 1167 - * numerical 32-bit values (cells) in 1168 - * hexadecimal 1169 - */ 1170 - property4 = [0x0a 0x0b 0x0c 0x0d 0xde 0xea 0xad 0xbe 0xef]; 1171 - /* define a property whose content is 1172 - * an arbitrary array of bytes 1173 - */ 1145 + property2 = <0x1234abcd>; /* define a property containing a 1146 + * numerical 32-bit value (hexadecimal) 1147 + */ 1174 1148 1175 - childnode@address { /* define a child node named "childnode" 1176 - * whose unit name is "childnode at 1177 - * address" 1178 - */ 1149 + property3 = <0x12345678 0x12345678 0xdeadbeef>; 1150 + /* define a property containing 3 1151 + * numerical 32-bit values (cells) in 1152 + * hexadecimal 1153 + */ 1154 + property4 = [0x0a 0x0b 0x0c 0x0d 0xde 0xea 0xad 0xbe 0xef]; 1155 + /* define a property whose content is 1156 + * an arbitrary array of bytes 1157 + */ 1179 1158 1180 - childprop = "hello\n"; /* define a property "childprop" of 1181 - * childnode (in this case, a string) 1182 - */ 1183 - }; 1184 - }; 1159 + childnode@address { /* define a child node named "childnode" 1160 + * whose unit name is "childnode at 1161 + * address" 1162 + */ 1163 + 1164 + childprop = "hello\n"; /* define a property "childprop" of 1165 + * childnode (in this case, a string) 1166 + */ 1167 + }; 1168 + }; 1185 1169 1186 1170 Nodes can contain other nodes etc... thus defining the hierarchical 1187 1171 structure of the tree. ··· 1342 1322 1343 1323 If the interrupt-parent property is not defined for a node, its 1344 1324 interrupt parent is assumed to be an ancestor in the node's 1345 - _device tree_ hierarchy. 1325 + *device tree* hierarchy. 1346 1326 1347 1327 3) OpenPIC Interrupt Controllers 1348 1328 -------------------------------- ··· 1354 1334 1355 1335 Sense and level information should be encoded as follows: 1356 1336 1357 - 0 = low to high edge sensitive type enabled 1358 - 1 = active low level sensitive type enabled 1359 - 2 = active high level sensitive type enabled 1360 - 3 = high to low edge sensitive type enabled 1337 + == ======================================== 1338 + 0 low to high edge sensitive type enabled 1339 + 1 active low level sensitive type enabled 1340 + 2 active high level sensitive type enabled 1341 + 3 high to low edge sensitive type enabled 1342 + == ======================================== 1361 1343 1362 1344 4) ISA Interrupt Controllers 1363 1345 ---------------------------- ··· 1372 1350 ISA PIC interrupt controllers should adhere to the ISA PIC 1373 1351 encodings listed below: 1374 1352 1375 - 0 = active low level sensitive type enabled 1376 - 1 = active high level sensitive type enabled 1377 - 2 = high to low edge sensitive type enabled 1378 - 3 = low to high edge sensitive type enabled 1353 + == ======================================== 1354 + 0 active low level sensitive type enabled 1355 + 1 active high level sensitive type enabled 1356 + 2 high to low edge sensitive type enabled 1357 + 3 low to high edge sensitive type enabled 1358 + == ======================================== 1379 1359 1380 1360 VIII - Specifying Device Power Management Information (sleep property) 1381 - =================================================================== 1361 + ====================================================================== 1382 1362 1383 1363 Devices on SOCs often have mechanisms for placing devices into low-power 1384 1364 states that are decoupled from the devices' own register blocks. Sometimes, ··· 1411 1387 sleep-map should wait until its necessity is demonstrated). 1412 1388 1413 1389 IX - Specifying dma bus information 1390 + =================================== 1414 1391 1415 1392 Some devices may have DMA memory range shifted relatively to the beginning of 1416 1393 RAM, or even placed outside of kernel RAM. For example, the Keystone 2 SoC ··· 1429 1404 for identifying devices supported coherent DMA operations in DT. 1430 1405 1431 1406 * DMA Bus master 1407 + 1432 1408 Optional property: 1409 + 1433 1410 - dma-ranges: <prop-encoded-array> encoded as arbitrary number of triplets of 1434 - (child-bus-address, parent-bus-address, length). Each triplet specified 1435 - describes a contiguous DMA address range. 1436 - The dma-ranges property is used to describe the direct memory access (DMA) 1437 - structure of a memory-mapped bus whose device tree parent can be accessed 1438 - from DMA operations originating from the bus. It provides a means of 1439 - defining a mapping or translation between the physical address space of 1440 - the bus and the physical address space of the parent of the bus. 1441 - (for more information see the Devicetree Specification) 1411 + (child-bus-address, parent-bus-address, length). Each triplet specified 1412 + describes a contiguous DMA address range. 1413 + The dma-ranges property is used to describe the direct memory access (DMA) 1414 + structure of a memory-mapped bus whose device tree parent can be accessed 1415 + from DMA operations originating from the bus. It provides a means of 1416 + defining a mapping or translation between the physical address space of 1417 + the bus and the physical address space of the parent of the bus. 1418 + (for more information see the Devicetree Specification) 1442 1419 1443 1420 * DMA Bus child 1421 + 1444 1422 Optional property: 1423 + 1445 1424 - dma-ranges: <empty> value. if present - It means that DMA addresses 1446 - translation has to be enabled for this device. 1425 + translation has to be enabled for this device. 1447 1426 - dma-coherent: Present if dma operations are coherent 1448 1427 1449 - Example: 1450 - soc { 1428 + Example:: 1429 + 1430 + soc { 1451 1431 compatible = "ti,keystone","simple-bus"; 1452 1432 ranges = <0x0 0x0 0x0 0xc0000000>; 1453 1433 dma-ranges = <0x80000000 0x8 0x00000000 0x80000000>; ··· 1465 1435 [...] 1466 1436 dma-coherent; 1467 1437 }; 1468 - }; 1438 + }; 1469 1439 1470 1440 Appendix A - Sample SOC node for MPC8540 1471 1441 ======================================== 1442 + 1443 + :: 1472 1444 1473 1445 soc@e0000000 { 1474 1446 #address-cells = <1>;
+1
Documentation/devicetree/index.rst
··· 15 15 overlay-notes 16 16 17 17 bindings/index 18 + booting-without-of
-2
Documentation/driver-api/driver-model/driver.rst
··· 228 228 not restricted to that. Use it whenever it makes sense to take an action after 229 229 all the consumers of a device have probed:: 230 230 231 - :: 232 - 233 231 int (*remove) (struct device *dev); 234 232 235 233 remove is called to unbind a driver from a device. This may be
+1
Documentation/driver-api/index.rst
··· 48 48 scsi 49 49 libata 50 50 target 51 + mailbox 51 52 mtdnand 52 53 miscellaneous 53 54 mei/index
+3 -3
Documentation/driver-api/usb/dma.rst
··· 10 10 11 11 The big picture is that USB drivers can continue to ignore most DMA issues, 12 12 though they still must provide DMA-ready buffers (see 13 - ``Documentation/DMA-API-HOWTO.txt``). That's how they've worked through 13 + :doc:`/core-api/dma-api-howto`). That's how they've worked through 14 14 the 2.4 (and earlier) kernels, or they can now be DMA-aware. 15 15 16 16 DMA-aware usb drivers: ··· 60 60 force a consistent memory access ordering by using memory barriers. It's 61 61 not using a streaming DMA mapping, so it's good for small transfers on 62 62 systems where the I/O would otherwise thrash an IOMMU mapping. (See 63 - ``Documentation/DMA-API-HOWTO.txt`` for definitions of "coherent" and 63 + :doc:`/core-api/dma-api-howto` for definitions of "coherent" and 64 64 "streaming" DMA mappings.) 65 65 66 66 Asking for 1/Nth of a page (as well as asking for N pages) is reasonably ··· 91 91 Existing buffers aren't usable for DMA without first being mapped into the 92 92 DMA address space of the device. However, most buffers passed to your 93 93 driver can safely be used with such DMA mapping. (See the first section 94 - of Documentation/DMA-API-HOWTO.txt, titled "What memory is DMA-able?") 94 + of :doc:`/core-api/dma-api-howto`, titled "What memory is DMA-able?") 95 95 96 96 - When you're using scatterlists, you can map everything at once. On some 97 97 systems, this kicks in an IOMMU and turns the scatterlists into single
+21 -23
Documentation/filesystems/proc.rst
··· 2179 2179 are not related to tasks. 2180 2180 2181 2181 5 Filesystem behavior 2182 - ---------------------------- 2182 + --------------------------- 2183 2183 2184 2184 Originally, before the advent of pid namepsace, procfs was a global file 2185 2185 system. It means that there was only one procfs instance in the system. 2186 2186 2187 2187 When pid namespace was added, a separate procfs instance was mounted in 2188 2188 each pid namespace. So, procfs mount options are global among all 2189 - mountpoints within the same namespace. 2189 + mountpoints within the same namespace:: 2190 2190 2191 - :: 2191 + # grep ^proc /proc/mounts 2192 + proc /proc proc rw,relatime,hidepid=2 0 0 2192 2193 2193 - # grep ^proc /proc/mounts 2194 - proc /proc proc rw,relatime,hidepid=2 0 0 2194 + # strace -e mount mount -o hidepid=1 -t proc proc /tmp/proc 2195 + mount("proc", "/tmp/proc", "proc", 0, "hidepid=1") = 0 2196 + +++ exited with 0 +++ 2195 2197 2196 - # strace -e mount mount -o hidepid=1 -t proc proc /tmp/proc 2197 - mount("proc", "/tmp/proc", "proc", 0, "hidepid=1") = 0 2198 - +++ exited with 0 +++ 2199 - 2200 - # grep ^proc /proc/mounts 2201 - proc /proc proc rw,relatime,hidepid=2 0 0 2202 - proc /tmp/proc proc rw,relatime,hidepid=2 0 0 2198 + # grep ^proc /proc/mounts 2199 + proc /proc proc rw,relatime,hidepid=2 0 0 2200 + proc /tmp/proc proc rw,relatime,hidepid=2 0 0 2203 2201 2204 2202 and only after remounting procfs mount options will change at all 2205 - mountpoints. 2203 + mountpoints:: 2206 2204 2207 - # mount -o remount,hidepid=1 -t proc proc /tmp/proc 2205 + # mount -o remount,hidepid=1 -t proc proc /tmp/proc 2208 2206 2209 - # grep ^proc /proc/mounts 2210 - proc /proc proc rw,relatime,hidepid=1 0 0 2211 - proc /tmp/proc proc rw,relatime,hidepid=1 0 0 2207 + # grep ^proc /proc/mounts 2208 + proc /proc proc rw,relatime,hidepid=1 0 0 2209 + proc /tmp/proc proc rw,relatime,hidepid=1 0 0 2212 2210 2213 2211 This behavior is different from the behavior of other filesystems. 2214 2212 2215 2213 The new procfs behavior is more like other filesystems. Each procfs mount 2216 2214 creates a new procfs instance. Mount options affect own procfs instance. 2217 2215 It means that it became possible to have several procfs instances 2218 - displaying tasks with different filtering options in one pid namespace. 2216 + displaying tasks with different filtering options in one pid namespace:: 2219 2217 2220 - # mount -o hidepid=invisible -t proc proc /proc 2221 - # mount -o hidepid=noaccess -t proc proc /tmp/proc 2222 - # grep ^proc /proc/mounts 2223 - proc /proc proc rw,relatime,hidepid=invisible 0 0 2224 - proc /tmp/proc proc rw,relatime,hidepid=noaccess 0 0 2218 + # mount -o hidepid=invisible -t proc proc /proc 2219 + # mount -o hidepid=noaccess -t proc proc /tmp/proc 2220 + # grep ^proc /proc/mounts 2221 + proc /proc proc rw,relatime,hidepid=invisible 0 0 2222 + proc /tmp/proc proc rw,relatime,hidepid=noaccess 0 0
+1 -1
Documentation/gpu/drm-mm.rst
··· 314 314 a pointer on drm_gem_cma_get_unmapped_area(). 315 315 316 316 More detailed information about get_unmapped_area can be found in 317 - Documentation/nommu-mmap.txt 317 + Documentation/admin-guide/mm/nommu-mmap.rst 318 318 319 319 Memory Coherency 320 320 ----------------
Documentation/mailbox.txt Documentation/driver-api/mailbox.rst
Documentation/nommu-mmap.txt Documentation/admin-guide/mm/nommu-mmap.rst
+18 -5
Documentation/powerpc/vas-api.rst
··· 87 87 the vas_id field in the VAS_TX_WIN_OPEN ioctl as detailed below. 88 88 89 89 A userspace library libnxz is available here but still in development: 90 + 90 91 https://github.com/abalib/power-gzip 91 92 92 93 Applications that use inflate / deflate calls can link with libnxz ··· 111 110 a connection with NX co-processor engine: 112 111 113 112 :: 113 + 114 114 struct vas_tx_win_open_attr { 115 115 __u32 version; 116 116 __s16 vas_id; /* specific instance of vas or -1 ··· 121 119 __u64 reserved2[6]; 122 120 }; 123 121 124 - version: The version field must be currently set to 1. 125 - vas_id: If '-1' is passed, kernel will make a best-effort attempt 122 + version: 123 + The version field must be currently set to 1. 124 + vas_id: 125 + If '-1' is passed, kernel will make a best-effort attempt 126 126 to assign an optimal instance of NX for the process. To 127 127 select the specific VAS instance, refer 128 128 "Discovery of available VAS engines" section below. ··· 133 129 and must be set to 0. 134 130 135 131 The attributes attr for the VAS_TX_WIN_OPEN ioctl are defined as 136 - follows: 132 + follows:: 133 + 137 134 #define VAS_MAGIC 'v' 138 135 #define VAS_TX_WIN_OPEN _IOW(VAS_MAGIC, 1, 139 136 struct vas_tx_win_open_attr) ··· 146 141 returns -1 and sets the errno variable to indicate the error. 147 142 148 143 Error conditions: 144 + 145 + ====== ================================================ 149 146 EINVAL fd does not refer to a valid VAS device. 150 147 EINVAL Invalid vas ID 151 148 EINVAL version is not set with proper value ··· 156 149 ENOSPC System has too many active windows (connections) 157 150 opened 158 151 EINVAL reserved fields are not set to 0. 152 + ====== ================================================ 159 153 160 154 See the ioctl(2) man page for more details, error codes and 161 155 restrictions. ··· 166 158 167 159 The mmap() system call for a NX-GZIP device fd returns a paste_address 168 160 that the application can use to copy/paste its CRB to the hardware engines. 161 + 169 162 :: 170 163 171 164 paste_addr = mmap(addr, size, prot, flags, fd, offset); 172 165 173 166 Only restrictions on mmap for a NX-GZIP device fd are: 167 + 174 168 * size should be PAGE_SIZE 175 169 * offset parameter should be 0ULL 176 170 ··· 180 170 In addition to the error conditions listed on the mmap(2) man 181 171 page, can also fail with one of the following error codes: 182 172 173 + ====== ============================================= 183 174 EINVAL fd is not associated with an open window 184 175 (i.e mmap() does not follow a successful call 185 176 to the VAS_TX_WIN_OPEN ioctl). 186 177 EINVAL offset field is not 0ULL. 178 + ====== ============================================= 187 179 188 180 Discovery of available VAS engines 189 181 ================================== ··· 222 210 address or any request buffer, raises an interrupt on the CPU to handle the 223 211 fault. Page fault can happen if an application passes invalid addresses or 224 212 request buffers are not in memory. The operating system handles the fault by 225 - updating CSB with the following data: 213 + updating CSB with the following data:: 226 214 227 215 csb.flags = CSB_V; 228 216 csb.cc = CSB_CC_TRANSLATION; ··· 235 223 236 224 If the OS can not update CSB due to invalid CSB address, sends SEGV signal 237 225 to the process who opened the send window on which the original request was 238 - issued. This signal returns with the following siginfo struct: 226 + issued. This signal returns with the following siginfo struct:: 239 227 240 228 siginfo.si_signo = SIGSEGV; 241 229 siginfo.si_errno = EFAULT; ··· 260 248 ============== 261 249 262 250 :: 251 + 263 252 int use_nx_gzip() 264 253 { 265 254 int rc, fd;
Documentation/process/unaligned-memory-access.rst Documentation/core-api/unaligned-memory-access.rst
+24
Documentation/staging/index.rst
··· 19 19 Atomic Types 20 20 ============ 21 21 22 + .. raw:: latex 23 + 24 + \footnotesize 25 + 22 26 .. include:: ../atomic_t.txt 23 27 :literal: 28 + 29 + .. raw:: latex 30 + 31 + \normalsize 24 32 25 33 Atomic bitops 26 34 ============= 27 35 36 + .. raw:: latex 37 + 38 + \footnotesize 39 + 28 40 .. include:: ../atomic_bitops.txt 29 41 :literal: 42 + 43 + .. raw:: latex 44 + 45 + \normalsize 30 46 31 47 Memory Barriers 32 48 =============== 33 49 50 + .. raw:: latex 51 + 52 + \footnotesize 53 + 34 54 .. include:: ../memory-barriers.txt 35 55 :literal: 56 + 57 + .. raw:: latex 58 + 59 + \normalsize
Documentation/this_cpu_ops.txt Documentation/core-api/this_cpu_ops.rst
+1
Documentation/trace/index.rst
··· 22 22 boottime-trace 23 23 hwlat_detector 24 24 intel_th 25 + ring-buffer-design 25 26 stm 26 27 sys-t 27 28 coresight/index
+431 -379
Documentation/trace/ring-buffer-design.txt Documentation/trace/ring-buffer-design.rst
··· 1 - Lockless Ring Buffer Design 2 - =========================== 1 + .. This file is dual-licensed: you can use it either under the terms 2 + .. of the GPL 2.0 or the GFDL 1.2 license, at your option. Note that this 3 + .. dual licensing only applies to this file, and not this project as a 4 + .. whole. 5 + .. 6 + .. a) This file is free software; you can redistribute it and/or 7 + .. modify it under the terms of the GNU General Public License as 8 + .. published by the Free Software Foundation version 2 of 9 + .. the License. 10 + .. 11 + .. This file is distributed in the hope that it will be useful, 12 + .. but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + .. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + .. GNU General Public License for more details. 15 + .. 16 + .. Or, alternatively, 17 + .. 18 + .. b) Permission is granted to copy, distribute and/or modify this 19 + .. document under the terms of the GNU Free Documentation License, 20 + .. Version 1.2 version published by the Free Software 21 + .. Foundation, with no Invariant Sections, no Front-Cover Texts 22 + .. and no Back-Cover Texts. A copy of the license is included at 23 + .. Documentation/userspace-api/media/fdl-appendix.rst. 24 + .. 25 + .. TODO: replace it to GPL-2.0 OR GFDL-1.2 WITH no-invariant-sections 26 + 27 + =========================== 28 + Lockless Ring Buffer Design 29 + =========================== 3 30 4 31 Copyright 2009 Red Hat Inc. 5 - Author: Steven Rostedt <srostedt@redhat.com> 6 - License: The GNU Free Documentation License, Version 1.2 7 - (dual licensed under the GPL v2) 8 - Reviewers: Mathieu Desnoyers, Huang Ying, Hidetoshi Seto, 32 + 33 + :Author: Steven Rostedt <srostedt@redhat.com> 34 + :License: The GNU Free Documentation License, Version 1.2 35 + (dual licensed under the GPL v2) 36 + :Reviewers: Mathieu Desnoyers, Huang Ying, Hidetoshi Seto, 9 37 and Frederic Weisbecker. 10 38 11 39 ··· 42 14 Terminology used in this Document 43 15 --------------------------------- 44 16 45 - tail - where new writes happen in the ring buffer. 17 + tail 18 + - where new writes happen in the ring buffer. 46 19 47 - head - where new reads happen in the ring buffer. 20 + head 21 + - where new reads happen in the ring buffer. 48 22 49 - producer - the task that writes into the ring buffer (same as writer) 23 + producer 24 + - the task that writes into the ring buffer (same as writer) 50 25 51 - writer - same as producer 26 + writer 27 + - same as producer 52 28 53 - consumer - the task that reads from the buffer (same as reader) 29 + consumer 30 + - the task that reads from the buffer (same as reader) 54 31 55 - reader - same as consumer. 32 + reader 33 + - same as consumer. 56 34 57 - reader_page - A page outside the ring buffer used solely (for the most part) 58 - by the reader. 35 + reader_page 36 + - A page outside the ring buffer used solely (for the most part) 37 + by the reader. 59 38 60 - head_page - a pointer to the page that the reader will use next 39 + head_page 40 + - a pointer to the page that the reader will use next 61 41 62 - tail_page - a pointer to the page that will be written to next 42 + tail_page 43 + - a pointer to the page that will be written to next 63 44 64 - commit_page - a pointer to the page with the last finished non-nested write. 45 + commit_page 46 + - a pointer to the page with the last finished non-nested write. 65 47 66 - cmpxchg - hardware-assisted atomic transaction that performs the following: 48 + cmpxchg 49 + - hardware-assisted atomic transaction that performs the following:: 67 50 68 - A = B if previous A == C 51 + A = B if previous A == C 69 52 70 - R = cmpxchg(A, C, B) is saying that we replace A with B if and only if 71 - current A is equal to C, and we put the old (current) A into R 53 + R = cmpxchg(A, C, B) is saying that we replace A with B if and only 54 + if current A is equal to C, and we put the old (current) 55 + A into R 72 56 73 - R gets the previous A regardless if A is updated with B or not. 57 + R gets the previous A regardless if A is updated with B or not. 74 58 75 - To see if the update was successful a compare of R == C may be used. 59 + To see if the update was successful a compare of ``R == C`` 60 + may be used. 76 61 77 62 The Generic Ring Buffer 78 63 ----------------------- ··· 105 64 but a writer may interrupt another writer, but it must finish writing 106 65 before the previous writer may continue. This is very important to the 107 66 algorithm. The writers act like a "stack". The way interrupts works 108 - enforces this behavior. 67 + enforces this behavior:: 109 68 110 69 111 70 writer1 start ··· 155 114 A sample of how the reader page is swapped: Note this does not 156 115 show the head page in the buffer, it is for demonstrating a swap 157 116 only. 117 + 118 + :: 158 119 159 120 +------+ 160 121 |reader| RING BUFFER ··· 215 172 It is possible that the page swapped is the commit page and the tail page, 216 173 if what is in the ring buffer is less than what is held in a buffer page. 217 174 175 + :: 218 176 219 - reader page commit page tail page 220 - | | | 221 - v | | 222 - +---+ | | 223 - | |<----------+ | 224 - | |<------------------------+ 225 - | |------+ 226 - +---+ | 227 - | 228 - v 229 - +---+ +---+ +---+ +---+ 230 - <---| |--->| |--->| |--->| |---> 231 - --->| |<---| |<---| |<---| |<--- 232 - +---+ +---+ +---+ +---+ 177 + reader page commit page tail page 178 + | | | 179 + v | | 180 + +---+ | | 181 + | |<----------+ | 182 + | |<------------------------+ 183 + | |------+ 184 + +---+ | 185 + | 186 + v 187 + +---+ +---+ +---+ +---+ 188 + <---| |--->| |--->| |--->| |---> 189 + --->| |<---| |<---| |<---| |<--- 190 + +---+ +---+ +---+ +---+ 233 191 234 192 This case is still valid for this algorithm. 235 193 When the writer leaves the page, it simply goes into the ring buffer ··· 240 196 241 197 The main pointers: 242 198 243 - reader page - The page used solely by the reader and is not part 244 - of the ring buffer (may be swapped in) 199 + reader page 200 + - The page used solely by the reader and is not part 201 + of the ring buffer (may be swapped in) 245 202 246 - head page - the next page in the ring buffer that will be swapped 203 + head page 204 + - the next page in the ring buffer that will be swapped 247 205 with the reader page. 248 206 249 - tail page - the page where the next write will take place. 207 + tail page 208 + - the page where the next write will take place. 250 209 251 - commit page - the page that last finished a write. 210 + commit page 211 + - the page that last finished a write. 252 212 253 213 The commit page only is updated by the outermost writer in the 254 214 writer stack. A writer that preempts another writer will not move the ··· 267 219 with the previous write. 268 220 269 221 270 - Write reserve: 222 + Write reserve:: 271 223 272 224 Buffer page 273 225 +---------+ ··· 278 230 | empty | 279 231 +---------+ 280 232 281 - Write commit: 233 + Write commit:: 282 234 283 235 Buffer page 284 236 +---------+ ··· 290 242 +---------+ 291 243 292 244 293 - If a write happens after the first reserve: 245 + If a write happens after the first reserve:: 294 246 295 247 Buffer page 296 248 +---------+ ··· 301 253 |reserved | 302 254 +---------+ <--- tail pointer 303 255 304 - After second writer commits: 256 + After second writer commits:: 305 257 306 258 307 259 Buffer page ··· 314 266 |commit | 315 267 +---------+ <--- tail pointer 316 268 317 - When the first writer commits: 269 + When the first writer commits:: 318 270 319 271 Buffer page 320 272 +---------+ ··· 340 292 page then no more writes may take place (regardless of the mode 341 293 of the ring buffer: overwrite and produce/consumer). 342 294 343 - The order of pages is: 295 + The order of pages is:: 344 296 345 297 head page 346 298 commit page 347 299 tail page 348 300 349 - Possible scenario: 350 - tail page 351 - head page commit page | 352 - | | | 353 - v v v 354 - +---+ +---+ +---+ +---+ 355 - <---| |--->| |--->| |--->| |---> 356 - --->| |<---| |<---| |<---| |<--- 357 - +---+ +---+ +---+ +---+ 301 + Possible scenario:: 302 + 303 + tail page 304 + head page commit page | 305 + | | | 306 + v v v 307 + +---+ +---+ +---+ +---+ 308 + <---| |--->| |--->| |--->| |---> 309 + --->| |<---| |<---| |<---| |<--- 310 + +---+ +---+ +---+ +---+ 358 311 359 312 There is a special case that the head page is after either the commit page 360 313 and possibly the tail page. That is when the commit (and tail) page has been ··· 364 315 has been less than a full page that has been committed inside the ring buffer, 365 316 and a reader swaps out a page, it will be swapping out the commit page. 366 317 318 + :: 367 319 368 - reader page commit page tail page 369 - | | | 370 - v | | 371 - +---+ | | 372 - | |<----------+ | 373 - | |<------------------------+ 374 - | |------+ 375 - +---+ | 376 - | 377 - v 378 - +---+ +---+ +---+ +---+ 379 - <---| |--->| |--->| |--->| |---> 380 - --->| |<---| |<---| |<---| |<--- 381 - +---+ +---+ +---+ +---+ 382 - ^ 383 - | 384 - head page 320 + reader page commit page tail page 321 + | | | 322 + v | | 323 + +---+ | | 324 + | |<----------+ | 325 + | |<------------------------+ 326 + | |------+ 327 + +---+ | 328 + | 329 + v 330 + +---+ +---+ +---+ +---+ 331 + <---| |--->| |--->| |--->| |---> 332 + --->| |<---| |<---| |<---| |<--- 333 + +---+ +---+ +---+ +---+ 334 + ^ 335 + | 336 + head page 385 337 386 338 387 339 In this case, the head page will not move when the tail and commit ··· 397 347 the head page will be pushed ahead one. If the buffer is in producer/consumer 398 348 mode, the write will fail. 399 349 400 - Overwrite mode: 350 + Overwrite mode:: 401 351 402 - tail page 403 - | 404 - v 405 - +---+ +---+ +---+ +---+ 406 - <---| |--->| |--->| |--->| |---> 407 - --->| |<---| |<---| |<---| |<--- 408 - +---+ +---+ +---+ +---+ 409 - ^ 410 - | 411 - head page 412 - 413 - 414 - tail page 415 - | 416 - v 417 - +---+ +---+ +---+ +---+ 418 - <---| |--->| |--->| |--->| |---> 419 - --->| |<---| |<---| |<---| |<--- 420 - +---+ +---+ +---+ +---+ 421 - ^ 422 - | 423 - head page 352 + tail page 353 + | 354 + v 355 + +---+ +---+ +---+ +---+ 356 + <---| |--->| |--->| |--->| |---> 357 + --->| |<---| |<---| |<---| |<--- 358 + +---+ +---+ +---+ +---+ 359 + ^ 360 + | 361 + head page 424 362 425 363 426 - tail page 427 - | 428 - v 429 - +---+ +---+ +---+ +---+ 430 - <---| |--->| |--->| |--->| |---> 431 - --->| |<---| |<---| |<---| |<--- 432 - +---+ +---+ +---+ +---+ 433 - ^ 434 - | 435 - head page 364 + tail page 365 + | 366 + v 367 + +---+ +---+ +---+ +---+ 368 + <---| |--->| |--->| |--->| |---> 369 + --->| |<---| |<---| |<---| |<--- 370 + +---+ +---+ +---+ +---+ 371 + ^ 372 + | 373 + head page 374 + 375 + 376 + tail page 377 + | 378 + v 379 + +---+ +---+ +---+ +---+ 380 + <---| |--->| |--->| |--->| |---> 381 + --->| |<---| |<---| |<---| |<--- 382 + +---+ +---+ +---+ +---+ 383 + ^ 384 + | 385 + head page 436 386 437 387 Note, the reader page will still point to the previous head page. 438 388 But when a swap takes place, it will use the most recent head page. ··· 447 397 each page must be aligned in memory by 4 bytes. This will allow the 2 448 398 least significant bits of the address to be used as flags, since 449 399 they will always be zero for the address. To get the address, 450 - simply mask out the flags. 400 + simply mask out the flags:: 451 401 452 402 MASK = ~3 453 403 ··· 455 405 456 406 Two flags will be kept by these two bits: 457 407 458 - HEADER - the page being pointed to is a head page 408 + HEADER 409 + - the page being pointed to is a head page 459 410 460 - UPDATE - the page being pointed to is being updated by a writer 411 + UPDATE 412 + - the page being pointed to is being updated by a writer 461 413 and was or is about to be a head page. 462 414 415 + :: 463 416 464 - reader page 465 - | 466 - v 467 - +---+ 468 - | |------+ 469 - +---+ | 470 - | 471 - v 472 - +---+ +---+ +---+ +---+ 473 - <---| |--->| |-H->| |--->| |---> 474 - --->| |<---| |<---| |<---| |<--- 475 - +---+ +---+ +---+ +---+ 417 + reader page 418 + | 419 + v 420 + +---+ 421 + | |------+ 422 + +---+ | 423 + | 424 + v 425 + +---+ +---+ +---+ +---+ 426 + <---| |--->| |-H->| |--->| |---> 427 + --->| |<---| |<---| |<---| |<--- 428 + +---+ +---+ +---+ +---+ 476 429 477 430 478 431 The above pointer "-H->" would have the HEADER flag set. That is ··· 483 430 This pointer means the next page is the head page. 484 431 485 432 When the tail page meets the head pointer, it will use cmpxchg to 486 - change the pointer to the UPDATE state: 433 + change the pointer to the UPDATE state:: 487 434 488 435 489 - tail page 490 - | 491 - v 492 - +---+ +---+ +---+ +---+ 493 - <---| |--->| |-H->| |--->| |---> 494 - --->| |<---| |<---| |<---| |<--- 495 - +---+ +---+ +---+ +---+ 436 + tail page 437 + | 438 + v 439 + +---+ +---+ +---+ +---+ 440 + <---| |--->| |-H->| |--->| |---> 441 + --->| |<---| |<---| |<---| |<--- 442 + +---+ +---+ +---+ +---+ 496 443 497 - tail page 498 - | 499 - v 500 - +---+ +---+ +---+ +---+ 501 - <---| |--->| |-U->| |--->| |---> 502 - --->| |<---| |<---| |<---| |<--- 503 - +---+ +---+ +---+ +---+ 444 + tail page 445 + | 446 + v 447 + +---+ +---+ +---+ +---+ 448 + <---| |--->| |-U->| |--->| |---> 449 + --->| |<---| |<---| |<---| |<--- 450 + +---+ +---+ +---+ +---+ 504 451 505 452 "-U->" represents a pointer in the UPDATE state. 506 453 ··· 515 462 and the reader will need to look for the new head page and try again. 516 463 Note, the flags UPDATE and HEADER are never set at the same time. 517 464 518 - The reader swaps the reader page as follows: 465 + The reader swaps the reader page as follows:: 519 466 520 467 +------+ 521 468 |reader| RING BUFFER ··· 530 477 +-----H-------------+ 531 478 532 479 The reader sets the reader page next pointer as HEADER to the page after 533 - the head page. 480 + the head page:: 534 481 535 482 536 483 +------+ ··· 548 495 549 496 It does a cmpxchg with the pointer to the previous head page to make it 550 497 point to the reader page. Note that the new pointer does not have the HEADER 551 - flag set. This action atomically moves the head page forward. 498 + flag set. This action atomically moves the head page forward:: 552 499 553 500 +------+ 554 501 |reader| RING BUFFER ··· 564 511 +------------------------------------+ 565 512 566 513 After the new head page is set, the previous pointer of the head page is 567 - updated to the reader page. 514 + updated to the reader page:: 568 515 569 516 +------+ 570 517 |reader| RING BUFFER ··· 601 548 602 549 Note, the way to determine a reader page is simply by examining the previous 603 550 pointer of the page. If the next pointer of the previous page does not 604 - point back to the original page, then the original page is a reader page: 551 + point back to the original page, then the original page is a reader page:: 605 552 606 553 607 554 +--------+ ··· 625 572 move the head page, until the writer is finished with the move. 626 573 627 574 This eliminates any races that the reader can have on the writer. The reader 628 - must spin, and this is why the reader cannot preempt the writer. 575 + must spin, and this is why the reader cannot preempt the writer:: 629 576 630 - tail page 631 - | 632 - v 633 - +---+ +---+ +---+ +---+ 634 - <---| |--->| |-H->| |--->| |---> 635 - --->| |<---| |<---| |<---| |<--- 636 - +---+ +---+ +---+ +---+ 577 + tail page 578 + | 579 + v 580 + +---+ +---+ +---+ +---+ 581 + <---| |--->| |-H->| |--->| |---> 582 + --->| |<---| |<---| |<---| |<--- 583 + +---+ +---+ +---+ +---+ 637 584 638 - tail page 639 - | 640 - v 641 - +---+ +---+ +---+ +---+ 642 - <---| |--->| |-U->| |--->| |---> 643 - --->| |<---| |<---| |<---| |<--- 644 - +---+ +---+ +---+ +---+ 585 + tail page 586 + | 587 + v 588 + +---+ +---+ +---+ +---+ 589 + <---| |--->| |-U->| |--->| |---> 590 + --->| |<---| |<---| |<---| |<--- 591 + +---+ +---+ +---+ +---+ 645 592 646 - The following page will be made into the new head page. 593 + The following page will be made into the new head page:: 647 594 648 - tail page 649 - | 650 - v 651 - +---+ +---+ +---+ +---+ 652 - <---| |--->| |-U->| |-H->| |---> 653 - --->| |<---| |<---| |<---| |<--- 654 - +---+ +---+ +---+ +---+ 595 + tail page 596 + | 597 + v 598 + +---+ +---+ +---+ +---+ 599 + <---| |--->| |-U->| |-H->| |---> 600 + --->| |<---| |<---| |<---| |<--- 601 + +---+ +---+ +---+ +---+ 655 602 656 603 After the new head page has been set, we can set the old head page 657 - pointer back to NORMAL. 604 + pointer back to NORMAL:: 658 605 659 - tail page 660 - | 661 - v 662 - +---+ +---+ +---+ +---+ 663 - <---| |--->| |--->| |-H->| |---> 664 - --->| |<---| |<---| |<---| |<--- 665 - +---+ +---+ +---+ +---+ 606 + tail page 607 + | 608 + v 609 + +---+ +---+ +---+ +---+ 610 + <---| |--->| |--->| |-H->| |---> 611 + --->| |<---| |<---| |<---| |<--- 612 + +---+ +---+ +---+ +---+ 666 613 667 - After the head page has been moved, the tail page may now move forward. 614 + After the head page has been moved, the tail page may now move forward:: 668 615 669 - tail page 670 - | 671 - v 672 - +---+ +---+ +---+ +---+ 673 - <---| |--->| |--->| |-H->| |---> 674 - --->| |<---| |<---| |<---| |<--- 675 - +---+ +---+ +---+ +---+ 616 + tail page 617 + | 618 + v 619 + +---+ +---+ +---+ +---+ 620 + <---| |--->| |--->| |-H->| |---> 621 + --->| |<---| |<---| |<---| |<--- 622 + +---+ +---+ +---+ +---+ 676 623 677 624 678 625 The above are the trivial updates. Now for the more complex scenarios. ··· 683 630 page. At this time, we must start dropping writes (usually with some kind 684 631 of warning to the user). But what happens if the commit was still on the 685 632 reader page? The commit page is not part of the ring buffer. The tail page 686 - must account for this. 633 + must account for this:: 687 634 688 635 689 - reader page commit page 690 - | | 691 - v | 692 - +---+ | 693 - | |<----------+ 694 - | | 695 - | |------+ 696 - +---+ | 697 - | 698 - v 699 - +---+ +---+ +---+ +---+ 700 - <---| |--->| |-H->| |--->| |---> 701 - --->| |<---| |<---| |<---| |<--- 702 - +---+ +---+ +---+ +---+ 703 - ^ 704 - | 705 - tail page 636 + reader page commit page 637 + | | 638 + v | 639 + +---+ | 640 + | |<----------+ 641 + | | 642 + | |------+ 643 + +---+ | 644 + | 645 + v 646 + +---+ +---+ +---+ +---+ 647 + <---| |--->| |-H->| |--->| |---> 648 + --->| |<---| |<---| |<---| |<--- 649 + +---+ +---+ +---+ +---+ 650 + ^ 651 + | 652 + tail page 706 653 707 654 If the tail page were to simply push the head page forward, the commit when 708 655 leaving the reader page would not be pointing to the correct page. ··· 729 676 is not the next page, the tail page is simply updated with a cmpxchg. 730 677 731 678 Only writers move the tail page. This must be done atomically to protect 732 - against nested writers. 679 + against nested writers:: 733 680 734 681 temp_page = tail_page 735 682 next_page = temp_page->next ··· 737 684 738 685 The above will update the tail page if it is still pointing to the expected 739 686 page. If this fails, a nested write pushed it forward, the current write 740 - does not need to push it. 687 + does not need to push it:: 741 688 742 689 743 - temp page 744 - | 745 - v 746 - tail page 747 - | 748 - v 749 - +---+ +---+ +---+ +---+ 750 - <---| |--->| |--->| |--->| |---> 751 - --->| |<---| |<---| |<---| |<--- 752 - +---+ +---+ +---+ +---+ 690 + temp page 691 + | 692 + v 693 + tail page 694 + | 695 + v 696 + +---+ +---+ +---+ +---+ 697 + <---| |--->| |--->| |--->| |---> 698 + --->| |<---| |<---| |<---| |<--- 699 + +---+ +---+ +---+ +---+ 753 700 754 - Nested write comes in and moves the tail page forward: 701 + Nested write comes in and moves the tail page forward:: 755 702 756 - tail page (moved by nested writer) 757 - temp page | 758 - | | 759 - v v 760 - +---+ +---+ +---+ +---+ 761 - <---| |--->| |--->| |--->| |---> 762 - --->| |<---| |<---| |<---| |<--- 763 - +---+ +---+ +---+ +---+ 703 + tail page (moved by nested writer) 704 + temp page | 705 + | | 706 + v v 707 + +---+ +---+ +---+ +---+ 708 + <---| |--->| |--->| |--->| |---> 709 + --->| |<---| |<---| |<---| |<--- 710 + +---+ +---+ +---+ +---+ 764 711 765 712 The above would fail the cmpxchg, but since the tail page has already 766 713 been moved forward, the writer will just try again to reserve storage 767 714 on the new tail page. 768 715 769 - But the moving of the head page is a bit more complex. 716 + But the moving of the head page is a bit more complex:: 770 717 771 - tail page 772 - | 773 - v 774 - +---+ +---+ +---+ +---+ 775 - <---| |--->| |-H->| |--->| |---> 776 - --->| |<---| |<---| |<---| |<--- 777 - +---+ +---+ +---+ +---+ 718 + tail page 719 + | 720 + v 721 + +---+ +---+ +---+ +---+ 722 + <---| |--->| |-H->| |--->| |---> 723 + --->| |<---| |<---| |<---| |<--- 724 + +---+ +---+ +---+ +---+ 778 725 779 - The write converts the head page pointer to UPDATE. 726 + The write converts the head page pointer to UPDATE:: 780 727 781 - tail page 782 - | 783 - v 784 - +---+ +---+ +---+ +---+ 785 - <---| |--->| |-U->| |--->| |---> 786 - --->| |<---| |<---| |<---| |<--- 787 - +---+ +---+ +---+ +---+ 728 + tail page 729 + | 730 + v 731 + +---+ +---+ +---+ +---+ 732 + <---| |--->| |-U->| |--->| |---> 733 + --->| |<---| |<---| |<---| |<--- 734 + +---+ +---+ +---+ +---+ 788 735 789 736 But if a nested writer preempts here, it will see that the next 790 737 page is a head page, but it is also nested. It will detect that ··· 792 739 fact that it sees the UPDATE flag instead of a HEADER or NORMAL 793 740 pointer. 794 741 795 - The nested writer will set the new head page pointer. 742 + The nested writer will set the new head page pointer:: 796 743 797 - tail page 798 - | 799 - v 800 - +---+ +---+ +---+ +---+ 801 - <---| |--->| |-U->| |-H->| |---> 802 - --->| |<---| |<---| |<---| |<--- 803 - +---+ +---+ +---+ +---+ 744 + tail page 745 + | 746 + v 747 + +---+ +---+ +---+ +---+ 748 + <---| |--->| |-U->| |-H->| |---> 749 + --->| |<---| |<---| |<---| |<--- 750 + +---+ +---+ +---+ +---+ 804 751 805 752 But it will not reset the update back to normal. Only the writer 806 753 that converted a pointer from HEAD to UPDATE will convert it back 807 - to NORMAL. 754 + to NORMAL:: 808 755 809 - tail page 810 - | 811 - v 812 - +---+ +---+ +---+ +---+ 813 - <---| |--->| |-U->| |-H->| |---> 814 - --->| |<---| |<---| |<---| |<--- 815 - +---+ +---+ +---+ +---+ 756 + tail page 757 + | 758 + v 759 + +---+ +---+ +---+ +---+ 760 + <---| |--->| |-U->| |-H->| |---> 761 + --->| |<---| |<---| |<---| |<--- 762 + +---+ +---+ +---+ +---+ 816 763 817 764 After the nested writer finishes, the outermost writer will convert 818 - the UPDATE pointer to NORMAL. 765 + the UPDATE pointer to NORMAL:: 819 766 820 767 821 - tail page 822 - | 823 - v 824 - +---+ +---+ +---+ +---+ 825 - <---| |--->| |--->| |-H->| |---> 826 - --->| |<---| |<---| |<---| |<--- 827 - +---+ +---+ +---+ +---+ 768 + tail page 769 + | 770 + v 771 + +---+ +---+ +---+ +---+ 772 + <---| |--->| |--->| |-H->| |---> 773 + --->| |<---| |<---| |<---| |<--- 774 + +---+ +---+ +---+ +---+ 828 775 829 776 830 777 It can be even more complex if several nested writes came in and moved 831 - the tail page ahead several pages: 778 + the tail page ahead several pages:: 832 779 833 780 834 - (first writer) 781 + (first writer) 835 782 836 - tail page 837 - | 838 - v 839 - +---+ +---+ +---+ +---+ 840 - <---| |--->| |-H->| |--->| |---> 841 - --->| |<---| |<---| |<---| |<--- 842 - +---+ +---+ +---+ +---+ 783 + tail page 784 + | 785 + v 786 + +---+ +---+ +---+ +---+ 787 + <---| |--->| |-H->| |--->| |---> 788 + --->| |<---| |<---| |<---| |<--- 789 + +---+ +---+ +---+ +---+ 843 790 844 - The write converts the head page pointer to UPDATE. 791 + The write converts the head page pointer to UPDATE:: 845 792 846 - tail page 847 - | 848 - v 849 - +---+ +---+ +---+ +---+ 850 - <---| |--->| |-U->| |--->| |---> 851 - --->| |<---| |<---| |<---| |<--- 852 - +---+ +---+ +---+ +---+ 793 + tail page 794 + | 795 + v 796 + +---+ +---+ +---+ +---+ 797 + <---| |--->| |-U->| |--->| |---> 798 + --->| |<---| |<---| |<---| |<--- 799 + +---+ +---+ +---+ +---+ 853 800 854 801 Next writer comes in, and sees the update and sets up the new 855 - head page. 802 + head page:: 856 803 857 - (second writer) 804 + (second writer) 858 805 859 - tail page 860 - | 861 - v 862 - +---+ +---+ +---+ +---+ 863 - <---| |--->| |-U->| |-H->| |---> 864 - --->| |<---| |<---| |<---| |<--- 865 - +---+ +---+ +---+ +---+ 806 + tail page 807 + | 808 + v 809 + +---+ +---+ +---+ +---+ 810 + <---| |--->| |-U->| |-H->| |---> 811 + --->| |<---| |<---| |<---| |<--- 812 + +---+ +---+ +---+ +---+ 866 813 867 814 The nested writer moves the tail page forward. But does not set the old 868 - update page to NORMAL because it is not the outermost writer. 815 + update page to NORMAL because it is not the outermost writer:: 869 816 870 - tail page 871 - | 872 - v 873 - +---+ +---+ +---+ +---+ 874 - <---| |--->| |-U->| |-H->| |---> 875 - --->| |<---| |<---| |<---| |<--- 876 - +---+ +---+ +---+ +---+ 817 + tail page 818 + | 819 + v 820 + +---+ +---+ +---+ +---+ 821 + <---| |--->| |-U->| |-H->| |---> 822 + --->| |<---| |<---| |<---| |<--- 823 + +---+ +---+ +---+ +---+ 877 824 878 825 Another writer preempts and sees the page after the tail page is a head page. 879 - It changes it from HEAD to UPDATE. 826 + It changes it from HEAD to UPDATE:: 880 827 881 - (third writer) 828 + (third writer) 882 829 883 - tail page 884 - | 885 - v 886 - +---+ +---+ +---+ +---+ 887 - <---| |--->| |-U->| |-U->| |---> 888 - --->| |<---| |<---| |<---| |<--- 889 - +---+ +---+ +---+ +---+ 830 + tail page 831 + | 832 + v 833 + +---+ +---+ +---+ +---+ 834 + <---| |--->| |-U->| |-U->| |---> 835 + --->| |<---| |<---| |<---| |<--- 836 + +---+ +---+ +---+ +---+ 890 837 891 - The writer will move the head page forward: 838 + The writer will move the head page forward:: 892 839 893 840 894 - (third writer) 841 + (third writer) 895 842 896 - tail page 897 - | 898 - v 899 - +---+ +---+ +---+ +---+ 900 - <---| |--->| |-U->| |-U->| |-H-> 901 - --->| |<---| |<---| |<---| |<--- 902 - +---+ +---+ +---+ +---+ 843 + tail page 844 + | 845 + v 846 + +---+ +---+ +---+ +---+ 847 + <---| |--->| |-U->| |-U->| |-H-> 848 + --->| |<---| |<---| |<---| |<--- 849 + +---+ +---+ +---+ +---+ 903 850 904 851 But now that the third writer did change the HEAD flag to UPDATE it 905 - will convert it to normal: 852 + will convert it to normal:: 906 853 907 854 908 - (third writer) 855 + (third writer) 909 856 910 - tail page 911 - | 912 - v 913 - +---+ +---+ +---+ +---+ 914 - <---| |--->| |-U->| |--->| |-H-> 915 - --->| |<---| |<---| |<---| |<--- 916 - +---+ +---+ +---+ +---+ 917 - 918 - 919 - Then it will move the tail page, and return back to the second writer. 857 + tail page 858 + | 859 + v 860 + +---+ +---+ +---+ +---+ 861 + <---| |--->| |-U->| |--->| |-H-> 862 + --->| |<---| |<---| |<---| |<--- 863 + +---+ +---+ +---+ +---+ 920 864 921 865 922 - (second writer) 866 + Then it will move the tail page, and return back to the second writer:: 923 867 924 - tail page 925 - | 926 - v 927 - +---+ +---+ +---+ +---+ 928 - <---| |--->| |-U->| |--->| |-H-> 929 - --->| |<---| |<---| |<---| |<--- 930 - +---+ +---+ +---+ +---+ 868 + 869 + (second writer) 870 + 871 + tail page 872 + | 873 + v 874 + +---+ +---+ +---+ +---+ 875 + <---| |--->| |-U->| |--->| |-H-> 876 + --->| |<---| |<---| |<---| |<--- 877 + +---+ +---+ +---+ +---+ 931 878 932 879 933 880 The second writer will fail to move the tail page because it was already 934 881 moved, so it will try again and add its data to the new tail page. 935 - It will return to the first writer. 882 + It will return to the first writer:: 936 883 937 884 938 - (first writer) 885 + (first writer) 939 886 940 - tail page 941 - | 942 - v 943 - +---+ +---+ +---+ +---+ 944 - <---| |--->| |-U->| |--->| |-H-> 945 - --->| |<---| |<---| |<---| |<--- 946 - +---+ +---+ +---+ +---+ 887 + tail page 888 + | 889 + v 890 + +---+ +---+ +---+ +---+ 891 + <---| |--->| |-U->| |--->| |-H-> 892 + --->| |<---| |<---| |<---| |<--- 893 + +---+ +---+ +---+ +---+ 947 894 948 895 The first writer cannot know atomically if the tail page moved 949 896 while it updates the HEAD page. It will then update the head page to 950 - what it thinks is the new head page. 897 + what it thinks is the new head page:: 951 898 952 899 953 - (first writer) 900 + (first writer) 954 901 955 - tail page 956 - | 957 - v 958 - +---+ +---+ +---+ +---+ 959 - <---| |--->| |-U->| |-H->| |-H-> 960 - --->| |<---| |<---| |<---| |<--- 961 - +---+ +---+ +---+ +---+ 902 + tail page 903 + | 904 + v 905 + +---+ +---+ +---+ +---+ 906 + <---| |--->| |-U->| |-H->| |-H-> 907 + --->| |<---| |<---| |<---| |<--- 908 + +---+ +---+ +---+ +---+ 962 909 963 910 Since the cmpxchg returns the old value of the pointer the first writer 964 911 will see it succeeded in updating the pointer from NORMAL to HEAD. 965 912 But as we can see, this is not good enough. It must also check to see 966 - if the tail page is either where it use to be or on the next page: 913 + if the tail page is either where it use to be or on the next page:: 967 914 968 915 969 - (first writer) 916 + (first writer) 970 917 971 - A B tail page 972 - | | | 973 - v v v 974 - +---+ +---+ +---+ +---+ 975 - <---| |--->| |-U->| |-H->| |-H-> 976 - --->| |<---| |<---| |<---| |<--- 977 - +---+ +---+ +---+ +---+ 918 + A B tail page 919 + | | | 920 + v v v 921 + +---+ +---+ +---+ +---+ 922 + <---| |--->| |-U->| |-H->| |-H-> 923 + --->| |<---| |<---| |<---| |<--- 924 + +---+ +---+ +---+ +---+ 978 925 979 926 If tail page != A and tail page != B, then it must reset the pointer 980 927 back to NORMAL. The fact that it only needs to worry about nested 981 - writers means that it only needs to check this after setting the HEAD page. 928 + writers means that it only needs to check this after setting the HEAD page:: 982 929 983 930 984 - (first writer) 931 + (first writer) 985 932 986 - A B tail page 987 - | | | 988 - v v v 989 - +---+ +---+ +---+ +---+ 990 - <---| |--->| |-U->| |--->| |-H-> 991 - --->| |<---| |<---| |<---| |<--- 992 - +---+ +---+ +---+ +---+ 933 + A B tail page 934 + | | | 935 + v v v 936 + +---+ +---+ +---+ +---+ 937 + <---| |--->| |-U->| |--->| |-H-> 938 + --->| |<---| |<---| |<---| |<--- 939 + +---+ +---+ +---+ +---+ 993 940 994 941 Now the writer can update the head page. This is also why the head page must 995 942 remain in UPDATE and only reset by the outermost writer. This prevents 996 - the reader from seeing the incorrect head page. 943 + the reader from seeing the incorrect head page:: 997 944 998 945 999 - (first writer) 946 + (first writer) 1000 947 1001 - A B tail page 1002 - | | | 1003 - v v v 1004 - +---+ +---+ +---+ +---+ 1005 - <---| |--->| |--->| |--->| |-H-> 1006 - --->| |<---| |<---| |<---| |<--- 1007 - +---+ +---+ +---+ +---+ 1008 - 948 + A B tail page 949 + | | | 950 + v v v 951 + +---+ +---+ +---+ +---+ 952 + <---| |--->| |--->| |--->| |-H-> 953 + --->| |<---| |<---| |<---| |<--- 954 + +---+ +---+ +---+ +---+
+3 -3
Documentation/translations/ko_KR/memory-barriers.txt
··· 570 570 [*] 버스 마스터링 DMA 와 일관성에 대해서는 다음을 참고하시기 바랍니다: 571 571 572 572 Documentation/driver-api/pci/pci.rst 573 - Documentation/DMA-API-HOWTO.txt 574 - Documentation/DMA-API.txt 573 + Documentation/core-api/dma-api-howto.rst 574 + Documentation/core-api/dma-api.rst 575 575 576 576 577 577 데이터 의존성 배리어 (역사적) ··· 1907 1907 1908 1908 writel_relaxed() 와 같은 완화된 I/O 접근자들에 대한 자세한 내용을 위해서는 1909 1909 "커널 I/O 배리어의 효과" 섹션을, consistent memory 에 대한 자세한 내용을 1910 - 위해선 Documentation/DMA-API.txt 문서를 참고하세요. 1910 + 위해선 Documentation/core-api/dma-api.rst 문서를 참고하세요. 1911 1911 1912 1912 1913 1913 =========================
+1 -1
Documentation/translations/zh_CN/arm/Booting
··· 124 124 125 125 bootloader 必须以 64bit 地址对齐的形式加载一个设备树映像(dtb)到系统 126 126 RAM 中,并用启动数据初始化它。dtb 格式在文档 127 - Documentation/devicetree/booting-without-of.txt 中。内核将会在 127 + Documentation/devicetree/booting-without-of.rst 中。内核将会在 128 128 dtb 物理地址处查找 dtb 魔数值(0xd00dfeed),以确定 dtb 是否已经代替 129 129 标签列表被传递进来。 130 130
+1 -1
arch/Kconfig
··· 147 147 problems with received packets if doing so would not help 148 148 much. 149 149 150 - See Documentation/unaligned-memory-access.txt for more 150 + See Documentation/core-api/unaligned-memory-access.rst for more 151 151 information on the topic of unaligned memory accesses. 152 152 153 153 config ARCH_USE_BUILTIN_BSWAP
+6 -6
arch/ia64/hp/common/sba_iommu.c
··· 907 907 * @dir: dma direction 908 908 * @attrs: optional dma attributes 909 909 * 910 - * See Documentation/DMA-API-HOWTO.txt 910 + * See Documentation/core-api/dma-api-howto.rst 911 911 */ 912 912 static dma_addr_t sba_map_page(struct device *dev, struct page *page, 913 913 unsigned long poff, size_t size, ··· 1028 1028 * @dir: R/W or both. 1029 1029 * @attrs: optional dma attributes 1030 1030 * 1031 - * See Documentation/DMA-API-HOWTO.txt 1031 + * See Documentation/core-api/dma-api-howto.rst 1032 1032 */ 1033 1033 static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, 1034 1034 enum dma_data_direction dir, unsigned long attrs) ··· 1105 1105 * @size: number of bytes mapped in driver buffer. 1106 1106 * @dma_handle: IOVA of new buffer. 1107 1107 * 1108 - * See Documentation/DMA-API-HOWTO.txt 1108 + * See Documentation/core-api/dma-api-howto.rst 1109 1109 */ 1110 1110 static void * 1111 1111 sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, ··· 1162 1162 * @vaddr: virtual address IOVA of "consistent" buffer. 1163 1163 * @dma_handler: IO virtual address of "consistent" buffer. 1164 1164 * 1165 - * See Documentation/DMA-API-HOWTO.txt 1165 + * See Documentation/core-api/dma-api-howto.rst 1166 1166 */ 1167 1167 static void sba_free_coherent(struct device *dev, size_t size, void *vaddr, 1168 1168 dma_addr_t dma_handle, unsigned long attrs) ··· 1425 1425 * @dir: R/W or both. 1426 1426 * @attrs: optional dma attributes 1427 1427 * 1428 - * See Documentation/DMA-API-HOWTO.txt 1428 + * See Documentation/core-api/dma-api-howto.rst 1429 1429 */ 1430 1430 static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, 1431 1431 int nents, enum dma_data_direction dir, ··· 1524 1524 * @dir: R/W or both. 1525 1525 * @attrs: optional dma attributes 1526 1526 * 1527 - * See Documentation/DMA-API-HOWTO.txt 1527 + * See Documentation/core-api/dma-api-howto.rst 1528 1528 */ 1529 1529 static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, 1530 1530 int nents, enum dma_data_direction dir,
+1 -1
arch/parisc/kernel/pci-dma.c
··· 3 3 ** PARISC 1.1 Dynamic DMA mapping support. 4 4 ** This implementation is for PA-RISC platforms that do not support 5 5 ** I/O TLBs (aka DMA address translation hardware). 6 - ** See Documentation/DMA-API-HOWTO.txt for interface definitions. 6 + ** See Documentation/core-api/dma-api-howto.rst for interface definitions. 7 7 ** 8 8 ** (c) Copyright 1999,2000 Hewlett-Packard Company 9 9 ** (c) Copyright 2000 Grant Grundler
+2 -2
arch/x86/include/asm/dma-mapping.h
··· 3 3 #define _ASM_X86_DMA_MAPPING_H 4 4 5 5 /* 6 - * IOMMU interface. See Documentation/DMA-API-HOWTO.txt and 7 - * Documentation/DMA-API.txt for documentation. 6 + * IOMMU interface. See Documentation/core-api/dma-api-howto.rst and 7 + * Documentation/core-api/dma-api.rst for documentation. 8 8 */ 9 9 10 10 #include <linux/scatterlist.h>
+1 -1
arch/x86/kernel/amd_gart_64.c
··· 6 6 * This allows to use PCI devices that only support 32bit addresses on systems 7 7 * with more than 4GB. 8 8 * 9 - * See Documentation/DMA-API-HOWTO.txt for the interface specification. 9 + * See Documentation/core-api/dma-api-howto.rst for the interface specification. 10 10 * 11 11 * Copyright 2002 Andi Kleen, SuSE Labs. 12 12 */
+7 -7
drivers/parisc/sba_iommu.c
··· 666 666 * @dev: instance of PCI owned by the driver that's asking 667 667 * @mask: number of address bits this PCI device can handle 668 668 * 669 - * See Documentation/DMA-API-HOWTO.txt 669 + * See Documentation/core-api/dma-api-howto.rst 670 670 */ 671 671 static int sba_dma_supported( struct device *dev, u64 mask) 672 672 { ··· 698 698 * @size: number of bytes to map in driver buffer. 699 699 * @direction: R/W or both. 700 700 * 701 - * See Documentation/DMA-API-HOWTO.txt 701 + * See Documentation/core-api/dma-api-howto.rst 702 702 */ 703 703 static dma_addr_t 704 704 sba_map_single(struct device *dev, void *addr, size_t size, ··· 788 788 * @size: number of bytes mapped in driver buffer. 789 789 * @direction: R/W or both. 790 790 * 791 - * See Documentation/DMA-API-HOWTO.txt 791 + * See Documentation/core-api/dma-api-howto.rst 792 792 */ 793 793 static void 794 794 sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, ··· 867 867 * @size: number of bytes mapped in driver buffer. 868 868 * @dma_handle: IOVA of new buffer. 869 869 * 870 - * See Documentation/DMA-API-HOWTO.txt 870 + * See Documentation/core-api/dma-api-howto.rst 871 871 */ 872 872 static void *sba_alloc(struct device *hwdev, size_t size, dma_addr_t *dma_handle, 873 873 gfp_t gfp, unsigned long attrs) ··· 898 898 * @vaddr: virtual address IOVA of "consistent" buffer. 899 899 * @dma_handler: IO virtual address of "consistent" buffer. 900 900 * 901 - * See Documentation/DMA-API-HOWTO.txt 901 + * See Documentation/core-api/dma-api-howto.rst 902 902 */ 903 903 static void 904 904 sba_free(struct device *hwdev, size_t size, void *vaddr, ··· 933 933 * @nents: number of entries in list 934 934 * @direction: R/W or both. 935 935 * 936 - * See Documentation/DMA-API-HOWTO.txt 936 + * See Documentation/core-api/dma-api-howto.rst 937 937 */ 938 938 static int 939 939 sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, ··· 1017 1017 * @nents: number of entries in list 1018 1018 * @direction: R/W or both. 1019 1019 * 1020 - * See Documentation/DMA-API-HOWTO.txt 1020 + * See Documentation/core-api/dma-api-howto.rst 1021 1021 */ 1022 1022 static void 1023 1023 sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents,
+1 -1
include/linux/dma-mapping.h
··· 14 14 15 15 /** 16 16 * List of possible attributes associated with a DMA mapping. The semantics 17 - * of each attribute should be defined in Documentation/DMA-attributes.txt. 17 + * of each attribute should be defined in Documentation/core-api/dma-attributes.rst. 18 18 */ 19 19 20 20 /*
+1 -1
include/linux/fs.h
··· 2829 2829 2830 2830 /** 2831 2831 * file_sample_sb_err - sample the current errseq_t to test for later errors 2832 - * @mapping: mapping to be sampled 2832 + * @file: file pointer to be sampled 2833 2833 * 2834 2834 * Grab the most current superblock-level errseq_t value for the given 2835 2835 * struct file.
+6 -4
include/linux/kcsan-checks.h
··· 337 337 * release_for_reuse(obj); 338 338 * } 339 339 * 340 - * Note: ASSERT_EXCLUSIVE_ACCESS_SCOPED(), if applicable, performs more thorough 341 - * checking if a clear scope where no concurrent accesses are expected exists. 340 + * Note: 342 341 * 343 - * Note: For cases where the object is freed, `KASAN <kasan.html>`_ is a better 344 - * fit to detect use-after-free bugs. 342 + * 1. ASSERT_EXCLUSIVE_ACCESS_SCOPED(), if applicable, performs more thorough 343 + * checking if a clear scope where no concurrent accesses are expected exists. 344 + * 345 + * 2. For cases where the object is freed, `KASAN <kasan.html>`_ is a better 346 + * fit to detect use-after-free bugs. 345 347 * 346 348 * @var: variable to assert on 347 349 */
+2
include/linux/netdevice.h
··· 1742 1742 * @real_num_rx_queues: Number of RX queues currently active in device 1743 1743 * @xdp_prog: XDP sockets filter program pointer 1744 1744 * @gro_flush_timeout: timeout for GRO layer in NAPI 1745 + * @napi_defer_hard_irqs: If not zero, provides a counter that would 1746 + * allow to avoid NIC hard IRQ, on busy queues. 1745 1747 * 1746 1748 * @rx_handler: handler for received packets 1747 1749 * @rx_handler_data: XXX: need comments on this one
+4
include/linux/phylink.h
··· 62 62 * @dev: a pointer to a struct device associated with the MAC 63 63 * @type: operation type of PHYLINK instance 64 64 * @pcs_poll: MAC PCS cannot provide link change interrupt 65 + * @poll_fixed_state: if true, starts link_poll, 66 + * if MAC link is at %MLO_AN_FIXED mode. 67 + * @get_fixed_state: callback to execute to determine the fixed link state, 68 + * if MAC link is at %MLO_AN_FIXED mode. 65 69 */ 66 70 struct phylink_config { 67 71 struct device *dev;
+1 -1
include/media/videobuf-dma-sg.h
··· 31 31 * does memory allocation too using vmalloc_32(). 32 32 * 33 33 * videobuf_dma_*() 34 - * see Documentation/DMA-API-HOWTO.txt, these functions to 34 + * see Documentation/core-api/dma-api-howto.rst, these functions to 35 35 * basically the same. The map function does also build a 36 36 * scatterlist for the buffer (and unmap frees it ...) 37 37 *
+1 -1
init/Kconfig
··· 1957 1957 userspace. Since that isn't generally a problem on no-MMU systems, 1958 1958 it is normally safe to say Y here. 1959 1959 1960 - See Documentation/nommu-mmap.txt for more information. 1960 + See Documentation/mm/nommu-mmap.rst for more information. 1961 1961 1962 1962 config SYSTEM_DATA_VERIFICATION 1963 1963 def_bool n
+1 -1
kernel/dma/debug.c
··· 1071 1071 /* 1072 1072 * Drivers should use dma_mapping_error() to check the returned 1073 1073 * addresses of dma_map_single() and dma_map_page(). 1074 - * If not, print this warning message. See Documentation/DMA-API.txt. 1074 + * If not, print this warning message. See Documentation/core-api/dma-api.rst. 1075 1075 */ 1076 1076 if (entry->map_err_type == MAP_ERR_NOT_CHECKED) { 1077 1077 err_printk(ref->dev, entry,
+1 -1
mm/Kconfig
··· 387 387 This option specifies the initial value of this option. The default 388 388 of 1 says that all excess pages should be trimmed. 389 389 390 - See Documentation/nommu-mmap.txt for more information. 390 + See Documentation/mm/nommu-mmap.rst for more information. 391 391 392 392 config TRANSPARENT_HUGEPAGE 393 393 bool "Transparent Hugepage Support"
+1 -1
mm/nommu.c
··· 5 5 * Replacement code for mm functions to support CPU's that don't 6 6 * have any form of memory management unit (thus no virtual memory). 7 7 * 8 - * See Documentation/nommu-mmap.txt 8 + * See Documentation/mm/nommu-mmap.rst 9 9 * 10 10 * Copyright (c) 2004-2008 David Howells <dhowells@redhat.com> 11 11 * Copyright (c) 2000-2003 David McCullough <davidm@snapgear.com>
+1
net/core/dev.c
··· 7898 7898 7899 7899 /** 7900 7900 * netdev_get_xmit_slave - Get the xmit slave of master device 7901 + * @dev: device 7901 7902 * @skb: The packet 7902 7903 * @all_slaves: assume all the slaves are active 7903 7904 *
+7
scripts/kernel-doc
··· 1083 1083 $members =~ s/\s*__packed\s*/ /gos; 1084 1084 $members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos; 1085 1085 $members =~ s/\s*____cacheline_aligned_in_smp/ /gos; 1086 + 1086 1087 # replace DECLARE_BITMAP 1088 + $members =~ s/__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, __ETHTOOL_LINK_MODE_MASK_NBITS)/gos; 1087 1089 $members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos; 1088 1090 # replace DECLARE_HASHTABLE 1089 1091 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; ··· 1771 1769 $prototype =~ s@/\*.*?\*/@@gos; # strip comments. 1772 1770 $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. 1773 1771 $prototype =~ s@^\s+@@gos; # strip leading spaces 1772 + 1773 + # Handle prototypes for function pointers like: 1774 + # int (*pcs_config)(struct foo) 1775 + $prototype =~ s@^(\S+\s+)\(\s*\*(\S+)\)@$1$2@gos; 1776 + 1774 1777 if ($prototype =~ /SYSCALL_DEFINE/) { 1775 1778 syscall_munge(); 1776 1779 }
+1 -1
tools/testing/selftests/vm/protection_keys.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * Tests Memory Protection Keys (see Documentation/vm/protection-keys.txt) 3 + * Tests Memory Protection Keys (see Documentation/core-api/protection-keys.rst) 4 4 * 5 5 * There are examples in here of: 6 6 * * how to set protection keys on memory