Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp535164pxb; Tue, 3 Nov 2020 06:12:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyTRP5Ykw5IMRfOnjIVvS6GpXPci9NnnL+4G8iCzT6y+7YqsbtDl5UYwkujFV0xBvFJiHT X-Received: by 2002:a17:906:d7a3:: with SMTP id pk3mr2553786ejb.208.1604412738552; Tue, 03 Nov 2020 06:12:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604412738; cv=none; d=google.com; s=arc-20160816; b=0jmxUVZtj98yPW71vsbhyUcWkgkeCn3Z/Q0UKtu/tP3Xv2FD6PRKX5Gb4RVK0nY/5v tDwdL5N58RGPX9ffe/oNhgPR6/vh/LJofXJ/9d6clc/prUjLMxeUBdAN6QEhmYEOUYji 1wUATpbd26aizD2rGTIBOIAqHkVB87HHZinQcjMabPZOhaHKh+3xqqDgqxbOD0jTM3vr 2JF6SCn/jsxj7mJF6hiu61t7uWAkRr83pZ7LDJXvxoKUsvB1L95GIfHLwBZiOLUHKGwl IQuI185cW7VRuUIhwHYN0dnlN2xjtxkig16kfHZWH9oUNUMjLGmrkXr/uJA5lzDysMmC oGOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=l4FOhOeqEnVDoJ5bRT/ISdT4bxQ89fRTQwVSHjkBPV4=; b=rml6P977WAMfDNqIQKKGYKAb29FPLdLT4IP8g5ZE9jw1XzSn9yYf48Ww5OlydfcHCi iHMKiR+06dxyAS2Jq1L/KZRrfcvmXEh2R/m2GSqX3klhyX9xcdNE7ixUE7ilDDYPqQsL EPV3mt06frJr7atB0MhHAU+PAqN8POIg1gKYEUsbRNcs+xSauBf8f9cfUHAEze3P6s2A S6+fn4b7i4qcfyuBWVksLjno/xqXJefRaiuJYdPuCm2RktVmvScYd90ovL9ezEoz4uMR 41hdd4f1dszGjNR66BiY8fntC+eas6aB+l8WYEyUXwz4gYYgzXYsb0D6tYn9Ymcww8pk ypNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=wCYdVovM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw16si12162323ejb.430.2020.11.03.06.11.53; Tue, 03 Nov 2020 06:12:18 -0800 (PST) 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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=wCYdVovM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729534AbgKCOKc (ORCPT + 99 others); Tue, 3 Nov 2020 09:10:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729502AbgKCOJJ (ORCPT ); Tue, 3 Nov 2020 09:09:09 -0500 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5662BC0613D1 for ; Tue, 3 Nov 2020 06:09:08 -0800 (PST) Received: by mail-io1-xd44.google.com with SMTP id j12so3932145iow.0 for ; Tue, 03 Nov 2020 06:09:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=l4FOhOeqEnVDoJ5bRT/ISdT4bxQ89fRTQwVSHjkBPV4=; b=wCYdVovMWgk50XhjaI6MZEIe+2qazFELy2KweoNTlevdXGalqq+TNcRGcqrJ3jlbCR 9FlLQTcVyeigRJKthVgaTYg61ILCpXVmFsmb9Bd87N4wUhED2MRCzh9TlIt5v3MWSLtg 19Uxm6paNYF3LL38Ltlc/pL387aIUtRGJPt320OkS7aiqLjDPB02HaGZMiu9HHW07d1N HbroL7AjMb3V9olgRYf+B4Op9ZZPWQH7s6TsgsDJ9D9Lu9yrOct6EFEamd/SoOV9jlNH YokGScBs6FeqPbhPRQDnPYByaKjczh/aS5zRU142Jkh+1gS7i+ageCLLotjPAv091Fvi SQtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=l4FOhOeqEnVDoJ5bRT/ISdT4bxQ89fRTQwVSHjkBPV4=; b=oJBRFTB+PwR9snPn6OQXr730pKWNzMD6iBYZvAwHTquyT8/XMYOhSmUKDjgwFCWb06 c0tHXq24nlEeFzAOqtBPDxUzSAJe879pfbk1l3caNGzafL4N8PAXVlnUBVweD6h2eICA lbFtGvG8qDG01FxCAuV6ga4j2YjdspNlw/nID/WLYykH6O3QaC8fOsoallbF/hOAkS7v JnohtPi5NsHxtqjpL/snT+grKoq+oavPxc8/TI3cwPTKzbO/04c1QNbB7f7DSB5NZNUk bhvzPIwJvFRNOkImzeZKtWLe+JbV9KD8GwUcH1nC7PHDjFu67DXhHYUBGIUT0k23chYr Q5xg== X-Gm-Message-State: AOAM533jApCcwYfpJilw0XI93ORIM4dCSUzNtfWX2klQAfd4/0p+RX2D Oe4zyn+pksWOUMX489upvf5fpg== X-Received: by 2002:a6b:bbc6:: with SMTP id l189mr14375899iof.145.1604412547589; Tue, 03 Nov 2020 06:09:07 -0800 (PST) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id t2sm11484264iob.5.2020.11.03.06.09.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 06:09:07 -0800 (PST) Subject: Re: [PATCH] s390: add support for TIF_NOTIFY_SIGNAL To: Sven Schnelle Cc: linux-s390@vger.kernel.org, Heiko Carstens , linux-kernel@vger.kernel.org, peterz@infradead.org, oleg@redhat.com, tglx@linutronix.de, Stephen Rothwell , Linux-Next Mailing List References: From: Jens Axboe Message-ID: <75a238c7-fc37-21dd-bd89-d4c87a206eaa@kernel.dk> Date: Tue, 3 Nov 2020 07:09:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/20 4:00 AM, Sven Schnelle wrote: > Hi Jens, > > Heiko Carstens writes: > >> On Thu, Oct 29, 2020 at 10:21:11AM -0600, Jens Axboe wrote: >>> Wire up TIF_NOTIFY_SIGNAL handling for s390. >>> >>> Cc: linux-s390@vger.kernel.org >>> Signed-off-by: Jens Axboe >>> --- >>> >>> 5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting >>> for details: >>> >>> https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/ >>> >>> As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs, >>> as that will enable a set of cleanups once all of them support it. I'm >>> happy carrying this patch if need be, or it can be funelled through the >>> arch tree. Let me know. >>> >>> arch/s390/include/asm/thread_info.h | 2 ++ >>> arch/s390/kernel/entry.S | 7 ++++++- >>> 2 files changed, 8 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h >>> index 13a04fcf7762..0045341ade48 100644 >>> --- a/arch/s390/include/asm/thread_info.h >>> +++ b/arch/s390/include/asm/thread_info.h >>> @@ -65,6 +65,7 @@ void arch_setup_new_exec(void); >>> #define TIF_GUARDED_STORAGE 4 /* load guarded storage control block */ >>> #define TIF_PATCH_PENDING 5 /* pending live patching update */ >>> #define TIF_PGSTE 6 /* New mm's will use 4K page tables */ >>> +#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ >>> #define TIF_ISOLATE_BP 8 /* Run process with isolated BP */ >>> #define TIF_ISOLATE_BP_GUEST 9 /* Run KVM guests with isolated BP */ >>> >>> @@ -82,6 +83,7 @@ void arch_setup_new_exec(void); >>> #define TIF_SYSCALL_TRACEPOINT 27 /* syscall tracepoint instrumentation */ >>> >>> #define _TIF_NOTIFY_RESUME BIT(TIF_NOTIFY_RESUME) >>> +#define _TIF_NOTIFY_SIGNAL BIT(TIF_NOTIFY_SIGNAL) >>> #define _TIF_SIGPENDING BIT(TIF_SIGPENDING) >>> #define _TIF_NEED_RESCHED BIT(TIF_NEED_RESCHED) >>> #define _TIF_UPROBE BIT(TIF_UPROBE) >>> diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S >>> index 86235919c2d1..a30d891e8045 100644 >>> --- a/arch/s390/kernel/entry.S >>> +++ b/arch/s390/kernel/entry.S >>> @@ -52,7 +52,8 @@ STACK_SIZE = 1 << STACK_SHIFT >>> STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE >>> >>> _TIF_WORK = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ >>> - _TIF_UPROBE | _TIF_GUARDED_STORAGE | _TIF_PATCH_PENDING) >>> + _TIF_UPROBE | _TIF_GUARDED_STORAGE | _TIF_PATCH_PENDING | \ >>> + _TIF_NOTIFY_SIGNAL) >>> _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ >>> _TIF_SYSCALL_TRACEPOINT) >>> _CIF_WORK = (_CIF_ASCE_PRIMARY | _CIF_ASCE_SECONDARY | _CIF_FPU) >>> @@ -463,6 +464,8 @@ ENTRY(system_call) >>> #endif >>> TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART >>> jo .Lsysc_syscall_restart >>> + TSTMSK __TI_flags(%r12),_TIF_NOTIFY_SIGNAL >>> + jo .Lsysc_sigpending >>> TSTMSK __TI_flags(%r12),_TIF_SIGPENDING >>> jo .Lsysc_sigpending >>> TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME >>> @@ -857,6 +860,8 @@ ENTRY(io_int_handler) >>> #endif >>> TSTMSK __TI_flags(%r12),_TIF_SIGPENDING >>> jo .Lio_sigpending >>> + TSTMSK __TI_flags(%r12),_TIF_NOTIFY_SIGNAL >>> + jo .Lio_sigpending >>> TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME >>> jo .Lio_notify_resume >>> TSTMSK __TI_flags(%r12),_TIF_GUARDED_STORAGE >> >> (full quote so you can make sense of the patch below). >> >> Please merge the patch below into this one. With that: >> >> Acked-by: Heiko Carstens >> >> diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S >> index a30d891e8045..31f16d903ef3 100644 >> --- a/arch/s390/kernel/entry.S >> +++ b/arch/s390/kernel/entry.S >> @@ -464,9 +464,7 @@ ENTRY(system_call) >> #endif >> TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART >> jo .Lsysc_syscall_restart >> - TSTMSK __TI_flags(%r12),_TIF_NOTIFY_SIGNAL >> - jo .Lsysc_sigpending >> - TSTMSK __TI_flags(%r12),_TIF_SIGPENDING >> + TSTMSK __TI_flags(%r12),(_TIF_SIGPENDING|_TIF_NOTIFY_SIGNAL) >> jo .Lsysc_sigpending > > We need to also change the jo to jnz - in combination with tm, jo means > 'jump if all tested bits are set' while jnz means 'jump if at least one > bit is set' Ah thanks, good catch. And you also caught the braino in signal.c, here's the end result: commit 0eb7d372d5319970bd15f2dbc18264ea576214d4 Author: Jens Axboe Date: Fri Oct 9 15:34:12 2020 -0600 s390: add support for TIF_NOTIFY_SIGNAL Wire up TIF_NOTIFY_SIGNAL handling for s390. Cc: linux-s390@vger.kernel.org Acked-by: Heiko Carstens Signed-off-by: Jens Axboe diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index 13a04fcf7762..0045341ade48 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h @@ -65,6 +65,7 @@ void arch_setup_new_exec(void); #define TIF_GUARDED_STORAGE 4 /* load guarded storage control block */ #define TIF_PATCH_PENDING 5 /* pending live patching update */ #define TIF_PGSTE 6 /* New mm's will use 4K page tables */ +#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ #define TIF_ISOLATE_BP 8 /* Run process with isolated BP */ #define TIF_ISOLATE_BP_GUEST 9 /* Run KVM guests with isolated BP */ @@ -82,6 +83,7 @@ void arch_setup_new_exec(void); #define TIF_SYSCALL_TRACEPOINT 27 /* syscall tracepoint instrumentation */ #define _TIF_NOTIFY_RESUME BIT(TIF_NOTIFY_RESUME) +#define _TIF_NOTIFY_SIGNAL BIT(TIF_NOTIFY_SIGNAL) #define _TIF_SIGPENDING BIT(TIF_SIGPENDING) #define _TIF_NEED_RESCHED BIT(TIF_NEED_RESCHED) #define _TIF_UPROBE BIT(TIF_UPROBE) diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 86235919c2d1..19a89f292290 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -52,7 +52,8 @@ STACK_SIZE = 1 << STACK_SHIFT STACK_INIT = STACK_SIZE - STACK_FRAME_OVERHEAD - __PT_SIZE _TIF_WORK = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \ - _TIF_UPROBE | _TIF_GUARDED_STORAGE | _TIF_PATCH_PENDING) + _TIF_UPROBE | _TIF_GUARDED_STORAGE | _TIF_PATCH_PENDING | \ + _TIF_NOTIFY_SIGNAL) _TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ _TIF_SYSCALL_TRACEPOINT) _CIF_WORK = (_CIF_ASCE_PRIMARY | _CIF_ASCE_SECONDARY | _CIF_FPU) @@ -463,8 +464,8 @@ ENTRY(system_call) #endif TSTMSK __PT_FLAGS(%r11),_PIF_SYSCALL_RESTART jo .Lsysc_syscall_restart - TSTMSK __TI_flags(%r12),_TIF_SIGPENDING - jo .Lsysc_sigpending + TSTMSK __TI_flags(%r12),(_TIF_SIGPENDING|_TIF_NOTIFY_SIGNAL) + jnz .Lsysc_sigpending TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME jo .Lsysc_notify_resume TSTMSK __LC_CPU_FLAGS,(_CIF_ASCE_PRIMARY|_CIF_ASCE_SECONDARY) @@ -855,8 +856,8 @@ ENTRY(io_int_handler) TSTMSK __TI_flags(%r12),_TIF_PATCH_PENDING jo .Lio_patch_pending #endif - TSTMSK __TI_flags(%r12),_TIF_SIGPENDING - jo .Lio_sigpending + TSTMSK __TI_flags(%r12),(_TIF_SIGPENDING|_TIF_NOTIFY_SIGNAL) + jnz .Lio_sigpending TSTMSK __TI_flags(%r12),_TIF_NOTIFY_RESUME jo .Lio_notify_resume TSTMSK __TI_flags(%r12),_TIF_GUARDED_STORAGE diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 9e900a8977bd..b27b6c1f058d 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c @@ -472,7 +472,7 @@ void do_signal(struct pt_regs *regs) current->thread.system_call = test_pt_regs_flag(regs, PIF_SYSCALL) ? regs->int_code : 0; - if (get_signal(&ksig)) { + if (test_thread_flag(TIF_SIGPENDING) && get_signal(&ksig)) { /* Whee! Actually deliver the signal. */ if (current->thread.system_call) { regs->int_code = current->thread.system_call; -- Jens Axboe