Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1373363ybl; Tue, 3 Dec 2019 06:15:54 -0800 (PST) X-Google-Smtp-Source: APXvYqxuvOWV0Lh7EeIvdV7hZIhPM58SmNKgxZs+Y4OumtbrSPwbibHeXmalSnYRTsiwhSOuvvPa X-Received: by 2002:a05:6808:218:: with SMTP id l24mr3737042oie.75.1575382554708; Tue, 03 Dec 2019 06:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575382554; cv=none; d=google.com; s=arc-20160816; b=GFBBSxjRQQRq132BLLPl4qUbIz9Bk7CBPb4Uff0MtiT/ZlzTq7BT38+Np5lJcj7LAp tBOpWAIp1m71qmGlN9j22BXqbNtyJ/utSw04sO8op++XY02sMgObgJVuB5MLWa8qeZZw sJ1a3PczfAdlx7jmNoH4LTkujPq5eOUf76haOfe2kpxL/JFmizciLeLL2mZwD0w1alW2 yLb1Bq3UB3oJg13vHpvsAD1MCwEntsFQtZTXPBQ4P8BLRP7zuWdedJzHCemHfv4YICPd ObOR/++bCyYUFLuQDB4B29Teq/X9rSpvQ2czuqwmj4DDQidB4joZr7Kz14jUMyXzDh1U 3MaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1YGNeo9sIm5raPrVI5CnFHmE5Tuq8fy9YiFNIx3zIos=; b=Ca5LL5xKXwULfpQpzx9JL53ij3XWCbyXIiaU62pj/wsI25rWF4G2EzVX2H+uGU4T0g emb9a5/ODpsI35K35bKxIX3582Qg1MwziYIt75hXVnnjaxe91j8RXS00UTzgmao+6oer CZmXzbAIM554XEpgNo8cu2jT2nsPgInub7yWqehrl/HqwdGQrV9yKpVxscwOebNu+04J 16xcZMPetiAfBP5OITBm8mJ9tPBIn39ESTYAZ2nGcByuzFGCCqUOv7ZLEr1tGTr+isEH hN9bYt7HWrDEpTuirWEjRKIAKQP9cHELw1regMrx+Jj3JO0hobSTdsyE7QJQomNDl5J1 9dxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="f/o1SxMa"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u190si1313036oie.117.2019.12.03.06.15.36; Tue, 03 Dec 2019 06:15:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="f/o1SxMa"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727287AbfLCOO3 (ORCPT + 99 others); Tue, 3 Dec 2019 09:14:29 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:52788 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726567AbfLCOO0 (ORCPT ); Tue, 3 Dec 2019 09:14:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575382465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1YGNeo9sIm5raPrVI5CnFHmE5Tuq8fy9YiFNIx3zIos=; b=f/o1SxMawCu9EBCtusUqkDy2u1YOQ8H9kvresv0DRGjhTGuxRlS/ORtWPFs6vDcToFThaW XK8Esd+Ntj8ZrVQCttWtOf1LvaBsdU3aKMIOFctetX/toHrmUTYouC5H7ZOq/Z/2OrpNsJ FU3/YP9jsZUCAG7OLgWSKBC9nZXIAFI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-348-QrnM8yCQN8OpepUaOcfvPg-1; Tue, 03 Dec 2019 09:14:20 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09F93102CB8F; Tue, 3 Dec 2019 14:14:19 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.44]) by smtp.corp.redhat.com (Postfix) with SMTP id 8528D610E0; Tue, 3 Dec 2019 14:14:14 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 3 Dec 2019 15:14:17 +0100 (CET) Date: Tue, 3 Dec 2019 15:14:12 +0100 From: Oleg Nesterov To: Andrew Morton Cc: Andy Lutomirski , Borislav Petkov , Ingo Molnar , Jan Kratochvil , Linus Torvalds , Pedro Alves , Peter Anvin , Thomas Gleixner , linux-kernel@vger.kernel.org, x86@kernel.org Subject: [PATCH v2 4/4] x86: introduce restart_block->arch_data to kill TS_COMPAT_RESTART Message-ID: <20191203141412.GE30688@redhat.com> References: <20191126110659.GA14042@redhat.com> <20191203141239.GA30688@redhat.com> MIME-Version: 1.0 In-Reply-To: <20191203141239.GA30688@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: QrnM8yCQN8OpepUaOcfvPg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With this patch x86 just saves current_thread_info()->status in the new restart_block->arch_data field, TS_COMPAT_RESTART can be removed. Rather than saving "status" we could shift the code from get_nr_restart_syscall() to arch_set_restart_data() and save the syscall number in ->arch_data. Signed-off-by: Oleg Nesterov --- arch/x86/include/asm/thread_info.h | 12 ++---------- arch/x86/kernel/signal.c | 2 +- include/linux/restart_block.h | 1 + 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thre= ad_info.h index a4de7aa..75c4a0a 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h @@ -233,18 +233,10 @@ static inline int arch_within_stack_frames(const void= * const stack, #ifndef __ASSEMBLY__ #ifdef CONFIG_COMPAT #define TS_I386_REGS_POKED=090x0004=09/* regs poked by 32-bit ptracer */ -#define TS_COMPAT_RESTART=090x0008 =20 -#define arch_set_restart_data=09arch_set_restart_data +#define arch_set_restart_data(restart)=09\ +=09do { restart->arch_data =3D current_thread_info()->status; } while (0) =20 -static inline void arch_set_restart_data(struct restart_block *restart) -{ -=09struct thread_info *ti =3D current_thread_info(); -=09if (ti->status & TS_COMPAT) -=09=09ti->status |=3D TS_COMPAT_RESTART; -=09else -=09=09ti->status &=3D ~TS_COMPAT_RESTART; -} #endif =20 #ifdef CONFIG_X86_32 diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 2fdbf5e..2e52767 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c @@ -771,7 +771,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *reg= s) static inline unsigned long get_nr_restart_syscall(const struct pt_regs *r= egs) { #ifdef CONFIG_IA32_EMULATION -=09if (current_thread_info()->status & TS_COMPAT_RESTART) +=09if (current->restart_block.arch_data & TS_COMPAT) =09=09return __NR_ia32_restart_syscall; #endif #ifdef CONFIG_X86_X32_ABI diff --git a/include/linux/restart_block.h b/include/linux/restart_block.h index bba2920..980a655 100644 --- a/include/linux/restart_block.h +++ b/include/linux/restart_block.h @@ -23,6 +23,7 @@ enum timespec_type { * System call restart block. */ struct restart_block { +=09unsigned long arch_data; =09long (*fn)(struct restart_block *); =09union { =09=09/* For futex_wait and futex_wait_requeue_pi */ --=20 2.5.0