Loading Documentation/DocBook/device-drivers.tmpl +32 −4 Original line number Original line Diff line number Diff line Loading @@ -128,16 +128,44 @@ X!Edrivers/base/interface.c !Edrivers/base/platform.c !Edrivers/base/platform.c !Edrivers/base/bus.c !Edrivers/base/bus.c </sect1> </sect1> <sect1><title>Device Drivers DMA Management</title> <sect1> <title>Buffer Sharing and Synchronization</title> <para> The dma-buf subsystem provides the framework for sharing buffers for hardware (DMA) access across multiple device drivers and subsystems, and for synchronizing asynchronous hardware access. </para> <para> This is used, for example, by drm "prime" multi-GPU support, but is of course not limited to GPU use cases. </para> <para> The three main components of this are: (1) dma-buf, representing a sg_table and exposed to userspace as a file descriptor to allow passing between devices, (2) fence, which provides a mechanism to signal when one device as finished access, and (3) reservation, which manages the shared or exclusive fence(s) associated with the buffer. </para> <sect2><title>dma-buf</title> !Edrivers/dma-buf/dma-buf.c !Edrivers/dma-buf/dma-buf.c !Iinclude/linux/dma-buf.h </sect2> <sect2><title>reservation</title> !Pdrivers/dma-buf/reservation.c Reservation Object Overview !Edrivers/dma-buf/reservation.c !Iinclude/linux/reservation.h </sect2> <sect2><title>fence</title> !Edrivers/dma-buf/fence.c !Edrivers/dma-buf/fence.c !Edrivers/dma-buf/seqno-fence.c !Iinclude/linux/fence.h !Iinclude/linux/fence.h !Edrivers/dma-buf/seqno-fence.c !Iinclude/linux/seqno-fence.h !Iinclude/linux/seqno-fence.h !Edrivers/dma-buf/reservation.c !Iinclude/linux/reservation.h !Edrivers/dma-buf/sync_file.c !Edrivers/dma-buf/sync_file.c !Iinclude/linux/sync_file.h !Iinclude/linux/sync_file.h </sect2> </sect1> <sect1><title>Device Drivers DMA Management</title> !Edrivers/base/dma-coherent.c !Edrivers/base/dma-coherent.c !Edrivers/base/dma-mapping.c !Edrivers/base/dma-mapping.c </sect1> </sect1> Loading Documentation/arm64/silicon-errata.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,7 @@ stable kernels. | ARM | MMU-500 | #841119,#826419 | N/A | | ARM | MMU-500 | #841119,#826419 | N/A | | | | | | | | | | | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | | Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | | Cavium | ThunderX SMMUv2 | #27704 | N/A | | Cavium | ThunderX SMMUv2 | #27704 | N/A | Documentation/devicetree/bindings/display/imx/ldb.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -62,6 +62,7 @@ Required properties: display-timings are used instead. display-timings are used instead. Optional properties (required if display-timings are used): Optional properties (required if display-timings are used): - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing - display-timings : A node that describes the display timings as defined in - display-timings : A node that describes the display timings as defined in Documentation/devicetree/bindings/display/display-timing.txt. Documentation/devicetree/bindings/display/display-timing.txt. - fsl,data-mapping : should be "spwg" or "jeida" - fsl,data-mapping : should be "spwg" or "jeida" Loading Documentation/filesystems/devpts.txt +15 −130 Original line number Original line Diff line number Diff line Each mount of the devpts filesystem is now distinct such that ptys and their indicies allocated in one mount are independent from ptys and their indicies in all other mounts. To support containers, we now allow multiple instances of devpts filesystem, All mounts of the devpts filesystem now create a /dev/pts/ptmx node such that indices of ptys allocated in one instance are independent of indices with permissions 0000. allocated in other instances of devpts. To preserve backward compatibility, this support for multiple instances is To retain backwards compatibility the a ptmx device node (aka any node enabled only if: created with "mknod name c 5 2") when opened will look for an instance of devpts under the name "pts" in the same directory as the ptmx device node. - CONFIG_DEVPTS_MULTIPLE_INSTANCES=y, and As an option instead of placing a /dev/ptmx device node at /dev/ptmx - '-o newinstance' mount option is specified while mounting devpts it is possible to place a symlink to /dev/pts/ptmx at /dev/ptmx or to bind mount /dev/ptx/ptmx to /dev/ptmx. If you opt for using IOW, devpts now supports both single-instance and multi-instance semantics. the devpts filesystem in this manner devpts should be mounted with the ptmxmode=0666, or chmod 0666 /dev/pts/ptmx should be called. If CONFIG_DEVPTS_MULTIPLE_INSTANCES=n, there is no change in behavior and this referred to as the "legacy" mode. In this mode, the new mount options (-o newinstance and -o ptmxmode) will be ignored with a 'bogus option' message on console. If CONFIG_DEVPTS_MULTIPLE_INSTANCES=y and devpts is mounted without the 'newinstance' option (as in current start-up scripts) the new mount binds to the initial kernel mount of devpts. This mode is referred to as the 'single-instance' mode and the current, single-instance semantics are preserved, i.e PTYs are common across the system. The only difference between this single-instance mode and the legacy mode is the presence of new, '/dev/pts/ptmx' node with permissions 0000, which can safely be ignored. If CONFIG_DEVPTS_MULTIPLE_INSTANCES=y and 'newinstance' option is specified, the mount is considered to be in the multi-instance mode and a new instance of the devpts fs is created. Any ptys created in this instance are independent of ptys in other instances of devpts. Like in the single-instance mode, the /dev/pts/ptmx node is present. To effectively use the multi-instance mode, open of /dev/ptmx must be a redirected to '/dev/pts/ptmx' using a symlink or bind-mount. Eg: A container startup script could do the following: $ chmod 0666 /dev/pts/ptmx $ rm /dev/ptmx $ ln -s pts/ptmx /dev/ptmx $ ns_exec -cm /bin/bash # We are now in new container $ umount /dev/pts $ mount -t devpts -o newinstance lxcpts /dev/pts $ sshd -p 1234 where 'ns_exec -cm /bin/bash' calls clone() with CLONE_NEWNS flag and execs /bin/bash in the child process. A pty created by the sshd is not visible in the original mount of /dev/pts. Total count of pty pairs in all instances is limited by sysctls: Total count of pty pairs in all instances is limited by sysctls: kernel.pty.max = 4096 - global limit kernel.pty.max = 4096 - global limit kernel.pty.reserve = 1024 - reserve for initial instance kernel.pty.reserve = 1024 - reserved for filesystems mounted from the initial mount namespace kernel.pty.nr - current count of ptys kernel.pty.nr - current count of ptys Per-instance limit could be set by adding mount option "max=<count>". Per-instance limit could be set by adding mount option "max=<count>". This feature was added in kernel 3.4 together with sysctl kernel.pty.reserve. This feature was added in kernel 3.4 together with sysctl kernel.pty.reserve. In kernels older than 3.4 sysctl kernel.pty.max works as per-instance limit. In kernels older than 3.4 sysctl kernel.pty.max works as per-instance limit. User-space changes ------------------ In multi-instance mode (i.e '-o newinstance' mount option is specified at least once), following user-space issues should be noted. 1. If -o newinstance mount option is never used, /dev/pts/ptmx can be ignored and no change is needed to system-startup scripts. 2. To effectively use multi-instance mode (i.e -o newinstance is specified) administrators or startup scripts should "redirect" open of /dev/ptmx to /dev/pts/ptmx using either a bind mount or symlink. $ mount -t devpts -o newinstance devpts /dev/pts followed by either $ rm /dev/ptmx $ ln -s pts/ptmx /dev/ptmx $ chmod 666 /dev/pts/ptmx or $ mount -o bind /dev/pts/ptmx /dev/ptmx 3. The '/dev/ptmx -> pts/ptmx' symlink is the preferred method since it enables better error-reporting and treats both single-instance and multi-instance mounts similarly. But this method requires that system-startup scripts set the mode of /dev/pts/ptmx correctly (default mode is 0000). The scripts can set the mode by, either - adding ptmxmode mount option to devpts entry in /etc/fstab, or - using 'chmod 0666 /dev/pts/ptmx' 4. If multi-instance mode mount is needed for containers, but the system startup scripts have not yet been updated, container-startup scripts should bind mount /dev/ptmx to /dev/pts/ptmx to avoid breaking single- instance mounts. Or, in general, container-startup scripts should use: mount -t devpts -o newinstance -o ptmxmode=0666 devpts /dev/pts if [ ! -L /dev/ptmx ]; then mount -o bind /dev/pts/ptmx /dev/ptmx fi When all devpts mounts are multi-instance, /dev/ptmx can permanently be a symlink to pts/ptmx and the bind mount can be ignored. 5. A multi-instance mount that is not accompanied by the /dev/ptmx to /dev/pts/ptmx redirection would result in an unusable/unreachable pty. mount -t devpts -o newinstance lxcpts /dev/pts immediately followed by: open("/dev/ptmx") would create a pty, say /dev/pts/7, in the initial kernel mount. But /dev/pts/7 would be invisible in the new mount. 6. The permissions for /dev/pts/ptmx node should be specified when mounting /dev/pts, using the '-o ptmxmode=%o' mount option (default is 0000). mount -t devpts -o newinstance -o ptmxmode=0644 devpts /dev/pts The permissions can be later be changed as usual with 'chmod'. chmod 666 /dev/pts/ptmx 7. A mount of devpts without the 'newinstance' option results in binding to initial kernel mount. This behavior while preserving legacy semantics, does not provide strict isolation in a container environment. i.e by mounting devpts without the 'newinstance' option, a container could get visibility into the 'host' or root container's devpts. To workaround this and have strict isolation, all mounts of devpts, including the mount in the root container, should use the newinstance option. Documentation/kdump/gdbmacros.txt +82 −11 Original line number Original line Diff line number Diff line Loading @@ -170,21 +170,92 @@ document trapinfo address the kernel panicked. address the kernel panicked. end end define dump_log_idx set $idx = $arg0 if ($argc > 1) set $prev_flags = $arg1 else set $prev_flags = 0 end set $msg = ((struct printk_log *) (log_buf + $idx)) set $prefix = 1 set $newline = 1 set $log = log_buf + $idx + sizeof(*$msg) define dmesg # prev & LOG_CONT && !(msg->flags & LOG_PREIX) set $i = 0 if (($prev_flags & 8) && !($msg->flags & 4)) set $end_idx = (log_end - 1) & (log_buf_len - 1) set $prefix = 0 end while ($i < logged_chars) # msg->flags & LOG_CONT set $idx = (log_end - 1 - logged_chars + $i) & (log_buf_len - 1) if ($msg->flags & 8) # (prev & LOG_CONT && !(prev & LOG_NEWLINE)) if (($prev_flags & 8) && !($prev_flags & 2)) set $prefix = 0 end # (!(msg->flags & LOG_NEWLINE)) if (!($msg->flags & 2)) set $newline = 0 end end if ($idx + 100 <= $end_idx) || \ if ($prefix) ($end_idx <= $idx && $idx + 100 < log_buf_len) printf "[%5lu.%06lu] ", $msg->ts_nsec / 1000000000, $msg->ts_nsec % 1000000000 printf "%.100s", &log_buf[$idx] end set $i = $i + 100 if ($msg->text_len != 0) eval "printf \"%%%d.%ds\", $log", $msg->text_len, $msg->text_len end if ($newline) printf "\n" end if ($msg->dict_len > 0) set $dict = $log + $msg->text_len set $idx = 0 set $line = 1 while ($idx < $msg->dict_len) if ($line) printf " " set $line = 0 end set $c = $dict[$idx] if ($c == '\0') printf "\n" set $line = 1 else if ($c < ' ' || $c >= 127 || $c == '\\') printf "\\x%02x", $c else else printf "%c", log_buf[$idx] printf "%c", $c set $i = $i + 1 end end set $idx = $idx + 1 end printf "\n" end end document dump_log_idx Dump a single log given its index in the log buffer. The first parameter is the index into log_buf, the second is optional and specified the previous log buffer's flags, used for properly formatting continued lines. end define dmesg set $i = log_first_idx set $end_idx = log_first_idx set $prev_flags = 0 while (1) set $msg = ((struct printk_log *) (log_buf + $i)) if ($msg->len == 0) set $i = 0 else dump_log_idx $i $prev_flags set $i = $i + $msg->len set $prev_flags = $msg->flags end if ($i == $end_idx) loop_break end end end end end end Loading Loading
Documentation/DocBook/device-drivers.tmpl +32 −4 Original line number Original line Diff line number Diff line Loading @@ -128,16 +128,44 @@ X!Edrivers/base/interface.c !Edrivers/base/platform.c !Edrivers/base/platform.c !Edrivers/base/bus.c !Edrivers/base/bus.c </sect1> </sect1> <sect1><title>Device Drivers DMA Management</title> <sect1> <title>Buffer Sharing and Synchronization</title> <para> The dma-buf subsystem provides the framework for sharing buffers for hardware (DMA) access across multiple device drivers and subsystems, and for synchronizing asynchronous hardware access. </para> <para> This is used, for example, by drm "prime" multi-GPU support, but is of course not limited to GPU use cases. </para> <para> The three main components of this are: (1) dma-buf, representing a sg_table and exposed to userspace as a file descriptor to allow passing between devices, (2) fence, which provides a mechanism to signal when one device as finished access, and (3) reservation, which manages the shared or exclusive fence(s) associated with the buffer. </para> <sect2><title>dma-buf</title> !Edrivers/dma-buf/dma-buf.c !Edrivers/dma-buf/dma-buf.c !Iinclude/linux/dma-buf.h </sect2> <sect2><title>reservation</title> !Pdrivers/dma-buf/reservation.c Reservation Object Overview !Edrivers/dma-buf/reservation.c !Iinclude/linux/reservation.h </sect2> <sect2><title>fence</title> !Edrivers/dma-buf/fence.c !Edrivers/dma-buf/fence.c !Edrivers/dma-buf/seqno-fence.c !Iinclude/linux/fence.h !Iinclude/linux/fence.h !Edrivers/dma-buf/seqno-fence.c !Iinclude/linux/seqno-fence.h !Iinclude/linux/seqno-fence.h !Edrivers/dma-buf/reservation.c !Iinclude/linux/reservation.h !Edrivers/dma-buf/sync_file.c !Edrivers/dma-buf/sync_file.c !Iinclude/linux/sync_file.h !Iinclude/linux/sync_file.h </sect2> </sect1> <sect1><title>Device Drivers DMA Management</title> !Edrivers/base/dma-coherent.c !Edrivers/base/dma-coherent.c !Edrivers/base/dma-mapping.c !Edrivers/base/dma-mapping.c </sect1> </sect1> Loading
Documentation/arm64/silicon-errata.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -56,6 +56,7 @@ stable kernels. | ARM | MMU-500 | #841119,#826419 | N/A | | ARM | MMU-500 | #841119,#826419 | N/A | | | | | | | | | | | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | | Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | | Cavium | ThunderX SMMUv2 | #27704 | N/A | | Cavium | ThunderX SMMUv2 | #27704 | N/A |
Documentation/devicetree/bindings/display/imx/ldb.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -62,6 +62,7 @@ Required properties: display-timings are used instead. display-timings are used instead. Optional properties (required if display-timings are used): Optional properties (required if display-timings are used): - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing - display-timings : A node that describes the display timings as defined in - display-timings : A node that describes the display timings as defined in Documentation/devicetree/bindings/display/display-timing.txt. Documentation/devicetree/bindings/display/display-timing.txt. - fsl,data-mapping : should be "spwg" or "jeida" - fsl,data-mapping : should be "spwg" or "jeida" Loading
Documentation/filesystems/devpts.txt +15 −130 Original line number Original line Diff line number Diff line Each mount of the devpts filesystem is now distinct such that ptys and their indicies allocated in one mount are independent from ptys and their indicies in all other mounts. To support containers, we now allow multiple instances of devpts filesystem, All mounts of the devpts filesystem now create a /dev/pts/ptmx node such that indices of ptys allocated in one instance are independent of indices with permissions 0000. allocated in other instances of devpts. To preserve backward compatibility, this support for multiple instances is To retain backwards compatibility the a ptmx device node (aka any node enabled only if: created with "mknod name c 5 2") when opened will look for an instance of devpts under the name "pts" in the same directory as the ptmx device node. - CONFIG_DEVPTS_MULTIPLE_INSTANCES=y, and As an option instead of placing a /dev/ptmx device node at /dev/ptmx - '-o newinstance' mount option is specified while mounting devpts it is possible to place a symlink to /dev/pts/ptmx at /dev/ptmx or to bind mount /dev/ptx/ptmx to /dev/ptmx. If you opt for using IOW, devpts now supports both single-instance and multi-instance semantics. the devpts filesystem in this manner devpts should be mounted with the ptmxmode=0666, or chmod 0666 /dev/pts/ptmx should be called. If CONFIG_DEVPTS_MULTIPLE_INSTANCES=n, there is no change in behavior and this referred to as the "legacy" mode. In this mode, the new mount options (-o newinstance and -o ptmxmode) will be ignored with a 'bogus option' message on console. If CONFIG_DEVPTS_MULTIPLE_INSTANCES=y and devpts is mounted without the 'newinstance' option (as in current start-up scripts) the new mount binds to the initial kernel mount of devpts. This mode is referred to as the 'single-instance' mode and the current, single-instance semantics are preserved, i.e PTYs are common across the system. The only difference between this single-instance mode and the legacy mode is the presence of new, '/dev/pts/ptmx' node with permissions 0000, which can safely be ignored. If CONFIG_DEVPTS_MULTIPLE_INSTANCES=y and 'newinstance' option is specified, the mount is considered to be in the multi-instance mode and a new instance of the devpts fs is created. Any ptys created in this instance are independent of ptys in other instances of devpts. Like in the single-instance mode, the /dev/pts/ptmx node is present. To effectively use the multi-instance mode, open of /dev/ptmx must be a redirected to '/dev/pts/ptmx' using a symlink or bind-mount. Eg: A container startup script could do the following: $ chmod 0666 /dev/pts/ptmx $ rm /dev/ptmx $ ln -s pts/ptmx /dev/ptmx $ ns_exec -cm /bin/bash # We are now in new container $ umount /dev/pts $ mount -t devpts -o newinstance lxcpts /dev/pts $ sshd -p 1234 where 'ns_exec -cm /bin/bash' calls clone() with CLONE_NEWNS flag and execs /bin/bash in the child process. A pty created by the sshd is not visible in the original mount of /dev/pts. Total count of pty pairs in all instances is limited by sysctls: Total count of pty pairs in all instances is limited by sysctls: kernel.pty.max = 4096 - global limit kernel.pty.max = 4096 - global limit kernel.pty.reserve = 1024 - reserve for initial instance kernel.pty.reserve = 1024 - reserved for filesystems mounted from the initial mount namespace kernel.pty.nr - current count of ptys kernel.pty.nr - current count of ptys Per-instance limit could be set by adding mount option "max=<count>". Per-instance limit could be set by adding mount option "max=<count>". This feature was added in kernel 3.4 together with sysctl kernel.pty.reserve. This feature was added in kernel 3.4 together with sysctl kernel.pty.reserve. In kernels older than 3.4 sysctl kernel.pty.max works as per-instance limit. In kernels older than 3.4 sysctl kernel.pty.max works as per-instance limit. User-space changes ------------------ In multi-instance mode (i.e '-o newinstance' mount option is specified at least once), following user-space issues should be noted. 1. If -o newinstance mount option is never used, /dev/pts/ptmx can be ignored and no change is needed to system-startup scripts. 2. To effectively use multi-instance mode (i.e -o newinstance is specified) administrators or startup scripts should "redirect" open of /dev/ptmx to /dev/pts/ptmx using either a bind mount or symlink. $ mount -t devpts -o newinstance devpts /dev/pts followed by either $ rm /dev/ptmx $ ln -s pts/ptmx /dev/ptmx $ chmod 666 /dev/pts/ptmx or $ mount -o bind /dev/pts/ptmx /dev/ptmx 3. The '/dev/ptmx -> pts/ptmx' symlink is the preferred method since it enables better error-reporting and treats both single-instance and multi-instance mounts similarly. But this method requires that system-startup scripts set the mode of /dev/pts/ptmx correctly (default mode is 0000). The scripts can set the mode by, either - adding ptmxmode mount option to devpts entry in /etc/fstab, or - using 'chmod 0666 /dev/pts/ptmx' 4. If multi-instance mode mount is needed for containers, but the system startup scripts have not yet been updated, container-startup scripts should bind mount /dev/ptmx to /dev/pts/ptmx to avoid breaking single- instance mounts. Or, in general, container-startup scripts should use: mount -t devpts -o newinstance -o ptmxmode=0666 devpts /dev/pts if [ ! -L /dev/ptmx ]; then mount -o bind /dev/pts/ptmx /dev/ptmx fi When all devpts mounts are multi-instance, /dev/ptmx can permanently be a symlink to pts/ptmx and the bind mount can be ignored. 5. A multi-instance mount that is not accompanied by the /dev/ptmx to /dev/pts/ptmx redirection would result in an unusable/unreachable pty. mount -t devpts -o newinstance lxcpts /dev/pts immediately followed by: open("/dev/ptmx") would create a pty, say /dev/pts/7, in the initial kernel mount. But /dev/pts/7 would be invisible in the new mount. 6. The permissions for /dev/pts/ptmx node should be specified when mounting /dev/pts, using the '-o ptmxmode=%o' mount option (default is 0000). mount -t devpts -o newinstance -o ptmxmode=0644 devpts /dev/pts The permissions can be later be changed as usual with 'chmod'. chmod 666 /dev/pts/ptmx 7. A mount of devpts without the 'newinstance' option results in binding to initial kernel mount. This behavior while preserving legacy semantics, does not provide strict isolation in a container environment. i.e by mounting devpts without the 'newinstance' option, a container could get visibility into the 'host' or root container's devpts. To workaround this and have strict isolation, all mounts of devpts, including the mount in the root container, should use the newinstance option.
Documentation/kdump/gdbmacros.txt +82 −11 Original line number Original line Diff line number Diff line Loading @@ -170,21 +170,92 @@ document trapinfo address the kernel panicked. address the kernel panicked. end end define dump_log_idx set $idx = $arg0 if ($argc > 1) set $prev_flags = $arg1 else set $prev_flags = 0 end set $msg = ((struct printk_log *) (log_buf + $idx)) set $prefix = 1 set $newline = 1 set $log = log_buf + $idx + sizeof(*$msg) define dmesg # prev & LOG_CONT && !(msg->flags & LOG_PREIX) set $i = 0 if (($prev_flags & 8) && !($msg->flags & 4)) set $end_idx = (log_end - 1) & (log_buf_len - 1) set $prefix = 0 end while ($i < logged_chars) # msg->flags & LOG_CONT set $idx = (log_end - 1 - logged_chars + $i) & (log_buf_len - 1) if ($msg->flags & 8) # (prev & LOG_CONT && !(prev & LOG_NEWLINE)) if (($prev_flags & 8) && !($prev_flags & 2)) set $prefix = 0 end # (!(msg->flags & LOG_NEWLINE)) if (!($msg->flags & 2)) set $newline = 0 end end if ($idx + 100 <= $end_idx) || \ if ($prefix) ($end_idx <= $idx && $idx + 100 < log_buf_len) printf "[%5lu.%06lu] ", $msg->ts_nsec / 1000000000, $msg->ts_nsec % 1000000000 printf "%.100s", &log_buf[$idx] end set $i = $i + 100 if ($msg->text_len != 0) eval "printf \"%%%d.%ds\", $log", $msg->text_len, $msg->text_len end if ($newline) printf "\n" end if ($msg->dict_len > 0) set $dict = $log + $msg->text_len set $idx = 0 set $line = 1 while ($idx < $msg->dict_len) if ($line) printf " " set $line = 0 end set $c = $dict[$idx] if ($c == '\0') printf "\n" set $line = 1 else if ($c < ' ' || $c >= 127 || $c == '\\') printf "\\x%02x", $c else else printf "%c", log_buf[$idx] printf "%c", $c set $i = $i + 1 end end set $idx = $idx + 1 end printf "\n" end end document dump_log_idx Dump a single log given its index in the log buffer. The first parameter is the index into log_buf, the second is optional and specified the previous log buffer's flags, used for properly formatting continued lines. end define dmesg set $i = log_first_idx set $end_idx = log_first_idx set $prev_flags = 0 while (1) set $msg = ((struct printk_log *) (log_buf + $i)) if ($msg->len == 0) set $i = 0 else dump_log_idx $i $prev_flags set $i = $i + $msg->len set $prev_flags = $msg->flags end if ($i == $end_idx) loop_break end end end end end end Loading