Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3016830pxa; Tue, 18 Aug 2020 04:33:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfQBR+SY/4RUoAJlmyKxd9ewcr4n8pC/7QrB/c/yEPzzZlDRfY3bnCsRZhscosn32DJOrY X-Received: by 2002:a17:906:cb0a:: with SMTP id lk10mr19351366ejb.209.1597750381503; Tue, 18 Aug 2020 04:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597750381; cv=none; d=google.com; s=arc-20160816; b=qvSHGlIRHTaKNX9xxjYkj2tCaHk0d/spbNpPQQaK0uICevyNchaDo7ew6Mm9K89iQZ gjUl9xILuve70yzPjkKPo41aqfHLOblfcSDOpvc56ZsTRCmIIZcpUHDoKWlGi+cVSuZi QBslK1JEQ1u+2+WtrzgtD91ZGkhsum2ySYuFGW4qgW/OPXmHwk6h+1gMpOCVXpfDKGZh S8CtzGLpoz1Y+40EfbTi+SYvEbrn5DCB+kaRlEWJ5u1QzjA1V1C4Z+dAigSXQVF7XRBS XZAk01KBrxpMN0zHaL7+vJy39fb7e9rGRUInnNr48+gUerqX+zEiJpoChCPNe1fgbMs+ zj4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=L8Ci13hAYeGsQw2zyd6+6DHCs28U/aFeZSg4PjC6nyc=; b=EK3oGUoYL/PMG9JaHJDLgKMe85Uyr7PLei5MymXM2JPn58SBgj7EoBBQuRh2goUl5V iPlZpBSea8clxMIE/IAaCWLW5aEmT57LNByGJagw1bCTZzjrcUJiK3TgvBLE1TbgDIgf mH7OlYoMUFYdvxknEGl2nIXBGtmQ3LQgtHanwEKZjDmeHl7vOPLppvW/Ap3ODEA9QV14 yr06SpgOgTH/Ar4HlIsadmOj1CHOPTepuX8iABNblPvVJf+brd0C+mT6FxwlKl9K19in 7I2vWbxKS4eztuW1vQzfC2DBW8h1Iof0DEOSuwo4EmXMQb8P1A5zPOfMZasGMKSIUsKN ilmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si13034150ejf.508.2020.08.18.04.32.37; Tue, 18 Aug 2020 04:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726422AbgHRLbe (ORCPT + 99 others); Tue, 18 Aug 2020 07:31:34 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:57382 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726633AbgHRLaS (ORCPT ); Tue, 18 Aug 2020 07:30:18 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 85A4A298D0A From: Andrzej Pietrasiewicz To: linux-kernel@vger.kernel.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Greg Kroah-Hartman , Jiri Slaby , Dmitry Torokhov , Andrzej Pietrasiewicz , linux-input@vger.kernel.org, dri-devel@lists.freedesktop.org, kernel@collabora.com Subject: [PATCH v3 0/2] Add configurable handler to execute a compound action Date: Tue, 18 Aug 2020 13:28:23 +0200 Message-Id: <20200818112825.6445-1-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a follow-up of this thread: https://www.spinics.net/lists/linux-input/msg68446.html It only touches DRM (dri-devel) in such a way that it changes the help message of sysrq_drm_fb_helper_restore_op, otherwise it is unrelated to DRM. Patch 2/2 adds a configurable handler to execute a compound action. Userland might want to execute e.g. 'w' (show blocked tasks), followed by 's' (sync), followed by 1000 ms delay and then followed by 'c' (crash) upon a single magic SysRq. Or one might want to execute the famous "Raising Elephants Is So Utterly Boring" action. This patch adds a configurable handler, triggered with 'C', for this exact purpose. The user specifies the composition of the compound action using syntax similar to getopt, where each letter corresponds to an individual action and a colon followed by a number corresponds to a delay of that many milliseconds, e.g.: ws:1000c or r:100eis:1000ub An example of userspace that wants to perform a compound action is Chrome OS, where SysRq-X (pressed for the second time within a certain time period from the first time) causes showing the locked tasks, syncing, waiting a 1000 ms delay and crashing the system. Since all the slots in the sysrq_key_table[] are already taken or reserved, patch 1/2 extends it to cover also capital letter versions. v2..v3: - eliminated compile error in !CONFIG_INPUT case (kernel test robot) v1..v2: - used toupper() instead of opencoding it (Jiri Slaby) - updated help message of sysrq_drm_fb_helper_restore_op (Jiri Slaby) - used unsigned int for specifying delays (Jiri Slaby) - improved printed messages formatting (Jiri Slaby) Andrzej Pietrasiewicz (2): tty/sysrq: Extend the sysrq_key_table to cover capital letters tty/sysrq: Add configurable handler to execute a compound action Documentation/admin-guide/sysrq.rst | 11 +++ drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/tty/sysrq.c | 129 +++++++++++++++++++++++++++- include/linux/sysrq.h | 1 + 4 files changed, 140 insertions(+), 3 deletions(-) base-commit: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5 -- 2.17.1