Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • stable
  • extraversion
  • early-display
  • variant-emmc-nvme-boot
  • 2024-07-19
  • 2024-06-30
  • 2023-10-18
  • 2023-10-10
  • 2023-07-04
  • 2023-01-25
  • v3
  • variant-emmc-nvme-boot
  • 2020-06-01
14 results

u_boot_console_exec_attach.py

Blame
    • Stephen Warren's avatar
      93134e18
      test/py: handle exceptions in console creation · 93134e18
      Stephen Warren authored
      
      u_boot_console.exec_attach.get_spawn() performs two steps:
      1) Spawn a process to communicate with the serial console.
      2) Reset the board so that U-Boot starts running from scratch.
      
      Currently, if an exception happens in step (2), no cleanup is performed on
      the process created in step (1). That process stays running and may e.g.
      hold serial port locks, or simply continue to read data from the serial
      port, thus preventing it from reaching any other process that attempts to
      read from the same serial port later. While there is error cleanup code in
      u_boot_console_base.ensure_spawned(), this is not triggered since the
      exception prevents assignment to self.p there, and hence the exception
      handler has no object to operate upon in cleanup_spawn().
      
      Solve this by enhancing u_boot_console.exec_attach.get_spawn() to clean
      up any objects it has created.
      
      In theory, u_boot_spawn.Spawn's constructor has a similar issue, so fix
      this too.
      
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarSimon Glass <sjg@chromium.org>
      93134e18
      History
      test/py: handle exceptions in console creation
      Stephen Warren authored
      
      u_boot_console.exec_attach.get_spawn() performs two steps:
      1) Spawn a process to communicate with the serial console.
      2) Reset the board so that U-Boot starts running from scratch.
      
      Currently, if an exception happens in step (2), no cleanup is performed on
      the process created in step (1). That process stays running and may e.g.
      hold serial port locks, or simply continue to read data from the serial
      port, thus preventing it from reaching any other process that attempts to
      read from the same serial port later. While there is error cleanup code in
      u_boot_console_base.ensure_spawned(), this is not triggered since the
      exception prevents assignment to self.p there, and hence the exception
      handler has no object to operate upon in cleanup_spawn().
      
      Solve this by enhancing u_boot_console.exec_attach.get_spawn() to clean
      up any objects it has created.
      
      In theory, u_boot_spawn.Spawn's constructor has a similar issue, so fix
      this too.
      
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarSimon Glass <sjg@chromium.org>