Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp923537ybk; Wed, 13 May 2020 17:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNzbl8NcQztz+ch+Bj/6iuViMy0cStrDclGrtiUcJPjdKHs/x9ljzu6vMPVkCkSYALs/m4 X-Received: by 2002:a17:906:eda3:: with SMTP id sa3mr1445129ejb.253.1589415458383; Wed, 13 May 2020 17:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589415458; cv=none; d=google.com; s=arc-20160816; b=T+A5bk8ZTgMPL8Ipw3hjEtdyZxhF+adzh30QgkAOfoVon13menUkQW2ld8S/6+su98 wKSVMG9L0aIQ7vS8PHQVfsJkk2gdx8NlGpbw9tEO9rbQVHv252JFTC0Hxp67USP236kX OoNh8Tg5fmPz10ebIUEr7ybpvYKRv77FhxPQluuS+5Zl4BBDExjGr5ZQhEY9scWAmsCz 4uCEJ1lyQXWySgMA58IGqTczr9mqitV+k2T5kwkOy3M1J+VXB2B0hHonCmCI/qNc40yE IX1JLftJPkB+2trlv1BSHjCQCVfsnNeaYa2TVXmAikmrJN9aBM7LaAuD7tzvQWaOSk+w 1ZWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=QpFGoVikCliKvjXW85RnGHWsMtXxihqlOpEXIH0bT3A=; b=FbS872LGg138N8ie8EIBnCmy8PUMGuplDZm69r+yg5qXmgiNmX9oYt6nB5lmsthPUf I13KlM4mAWTJPV2HTKsofWjPmEl3mu6/AZOMTtlff/8OXpiqwSbho62+E15ufEY5P80E T7evqw3Q5oNsildKTwyNeyr4nY4vXZQZveiISBvCHKKd+zcG3JaA8T/MXnp1j0zbtmU4 zwodyMOOACaK72CSNB02Ujxsp1K+Jw4L8eTD4B5tjmZIgkwRCvQOiV4QzRfVYzaJ6ccK b/slktOMS0t+8VX5eqOyco+xNi6GQMQLXawsOXlvSXC8PQQAoKmj2aofgl2C3nB3BVFZ Muhw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si805589ejr.274.2020.05.13.17.17.15; Wed, 13 May 2020 17:17:38 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733028AbgENANy (ORCPT + 99 others); Wed, 13 May 2020 20:13:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:41786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732981AbgENANx (ORCPT ); Wed, 13 May 2020 20:13:53 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D0362065C; Thu, 14 May 2020 00:13:51 +0000 (UTC) Date: Wed, 13 May 2020 20:13:49 -0400 From: Steven Rostedt To: Mathieu Desnoyers Cc: Thomas Gleixner , linux-kernel , x86 , paulmck , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , "Joel Fernandes, Google" , Boris Ostrovsky , Juergen Gross , Brian Gerst , Josh Poimboeuf , Will Deacon Subject: Re: [patch V4 part 1 14/36] x86/entry: Get rid of ist_begin/end_non_atomic() Message-ID: <20200513201349.35132f23@oasis.local.home> In-Reply-To: <1777514130.20137.1589410645669.JavaMail.zimbra@efficios.com> References: <20200505131602.633487962@linutronix.de> <20200505134059.462640294@linutronix.de> <1777514130.20137.1589410645669.JavaMail.zimbra@efficios.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 May 2020 18:57:25 -0400 (EDT) Mathieu Desnoyers wrote: > ----- On May 5, 2020, at 9:16 AM, Thomas Gleixner tglx@linutronix.de wrote: > > > This is completely overengineered and definitely not an interface which > > should be made available to anything else than this particular MCE case. > > This patch introduces a significant change under the radar (not explained > in the changelog): it turns preempt_enable_no_resched() into preempt_enable(). > > Why, and why was it a no_resched() in the first place ? Was it for performance > or correctness reasons ? I believe the reason for no_resched, is because it was within a local_irq_disable() section, which means it couldn't schedule anyway. -- Steve > > --- a/arch/x86/kernel/cpu/mce/core.c > > +++ b/arch/x86/kernel/cpu/mce/core.c > > @@ -1352,13 +1352,15 @@ void notrace do_machine_check(struct pt_ > > > > /* Fault was in user mode and we need to take some action */ > > if ((m.cs & 3) == 3) { > > - ist_begin_non_atomic(regs); > > + /* If this triggers there is no way to recover. > > Die hard. */ > > + BUG_ON(!on_thread_stack() || !user_mode(regs)); > > local_irq_enable(); > > + preempt_enable(); > > > > if (kill_it || do_memory_failure(&m)) > > force_sig(SIGBUS); > > + preempt_disable(); > > local_irq_disable(); > > - ist_end_non_atomic(); > > } else { > > if (!fixup_exception(regs, X86_TRAP_MC, error_code, > > -void ist_begin_non_atomic(struct pt_regs *regs) > > -{ > > - BUG_ON(!user_mode(regs)); > > - > > - /* > > - * Sanity check: we need to be on the normal thread > > stack. This > > - * will catch asm bugs and any attempt to use > > ist_preempt_enable > > - * from double_fault. > > - */ > > - BUG_ON(!on_thread_stack()); > > - > > - preempt_enable_no_resched(); > > -} > > - > > -/** > > - * ist_end_non_atomic() - begin a non-atomic section in an IST > > exception > > - * > > - * Ends a non-atomic section started with ist_begin_non_atomic(). > > - */ > > -void ist_end_non_atomic(void) > > -{ > > - preempt_disable(); > > -} > > - > > int is_valid_bugaddr(unsigned long addr) > > { > > unsigned short ud; >