Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp79038rwb; Wed, 18 Jan 2023 14:26:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXspDL2U4b0d10eDCgtjRt08+eCYB4cXrqgbhAm4JBlUzd4GzCwiaDGOljFLI3VoRsp7ndo+ X-Received: by 2002:a05:6402:138b:b0:46a:3bd0:4784 with SMTP id b11-20020a056402138b00b0046a3bd04784mr9733705edv.7.1674080771366; Wed, 18 Jan 2023 14:26:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674080771; cv=none; d=google.com; s=arc-20160816; b=OvXyltfyxwKnpLK14sc1jVWH31dpTRePivLsDbWnHO5kPff84x4wge56MjI2ffejw1 OuQbziEkRcoOO5T12qnIWCkppggB2vOebmzSDUf638uhCW6Gvxz8dhhQzBYxdZib1ZfS vQmcIbIgVuJWTD3LKqa1fhjYnV1465oMHyRtQPjbvLZYyxzmldGFA7S1KbDJdgIi/3Rp aHaG5EvaFg8j3DldNOTQxhnHatxeli50S096/aSTixQf2baOP9HFDvdGLkPMvNQiuMiN a8l5j5VQDHP01lNZkT6q+LQ/i+V7NaWAOX5AYPCTmWDJnBQiGHoDVF6yS5qe+LUiPPvM 6Grg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:user-agent:message-id; bh=Y60JBGeD6oLtrNEh0wrDdgpb/hGllJoB29+cxzwjIJY=; b=CYOUjUi+YSLpyV8G2zOZdNwlDOYoaOJNF5SoERP5fsN5c3e1EGN4PJl7g77sKyE1Dv ra/KLuQ5yjKzSGa3zHcSIY6/5n81VAi5j36aOrgbU3ZJzZTIr+Lj761e7kY30h5QxcnW PDB1/X+L2R+vA3qpEt4+vZ+ln8YDG9OFTd0v9ptXtSZaXgKpUOVoFKoi/LyRIPPH2+QY Zs8vjnY5H/d427thfK+Mg7UCqtkn7MiwRsQfariREaZTMJpY1scUGmXXvLtCxpzgaOTM 4zoMVqO9kgeXrOgNALRQA21uQ1Wc3Os0PBPOJntZrHyVyMx3OqGqjUWiCw24Hk67MQh+ 1LUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a056402441100b0046bce131279si17346705eda.13.2023.01.18.14.26.00; Wed, 18 Jan 2023 14:26:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229899AbjARWCX (ORCPT + 44 others); Wed, 18 Jan 2023 17:02:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbjARWBt (ORCPT ); Wed, 18 Jan 2023 17:01:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 699821042E for ; Wed, 18 Jan 2023 14:01:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0549061A30 for ; Wed, 18 Jan 2023 22:01:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E739C433D2; Wed, 18 Jan 2023 22:01:47 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1pIGV8-002H8r-0y; Wed, 18 Jan 2023 17:01:46 -0500 Message-ID: <20230118215435.016435760@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 18 Jan 2023 16:54:35 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: "John Warthog9 Hawley" , Masami Hiramatsu Subject: [for-linus][PATCH 0/3] ktest.pl: Fix ssh hanging and reseting of console X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I've noticed that my ssh sessions would hang during test runs, which is really frustrating when you kick off a 13 hour test before going to bed, and the second test (1 hour into it) hangs, and you need to kick it off again in the morning (wasting all that time over night). I finally figured out the cause. There is a disconnect between the run_command that executes the test, and the "wait_for_input" that monitors the test. The wait_for_input has a default of 2 minute timeout if it doesn't see any output it returns. The run_command takes the empty string from wait_for_input as the test is finished, and then stops monitoring it, and calls waitpid() waiting for the test to exit. The problem is that if the test has a lot of output, it will continue writing into the pipe that was suppose to go to the monitor, which has now exited the loop. When the pipe fills up, it will not finish. When the test is over, it just hangs waiting for the pipe to flush (which never happens). To fix this, change the run_command to by default have an infinite run (which can be overridden by the new RUN_TIMEOUT option), and make the wait_for_input also wait indefinitely in this case. It now Now the tests will have its content continuously read and will exit normally. While debugging this, I also found out why you can lose stdout on the terminal sometimes. Especially if you hit Ctrl^C while the monitor is running. It was due to missing "end_monitor" which gives back the tty to the terminal. The first two patches fix that. git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest.git devel Head SHA1: aa9aba9382884554fe6a303744884866d137422d Steven Rostedt (3): ktest.pl: Fix missing "end_monitor" when machine check fails ktest.pl: Give back console on Ctrt^C on monitor ktest.pl: Add RUN_TIMEOUT option with default unlimited ---- tools/testing/ktest/ktest.pl | 26 +++++++++++++++++++++----- tools/testing/ktest/sample.conf | 5 +++++ 2 files changed, 26 insertions(+), 5 deletions(-)