From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754216AbbBLCRN (ORCPT ); Wed, 11 Feb 2015 21:17:13 -0500 Received: from smtprelay0021.hostedemail.com ([216.40.44.21]:43669 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751887AbbBLCRM (ORCPT ); Wed, 11 Feb 2015 21:17:12 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3653:3865:3867:3868:3870:3871:3872:3873:3874:4250:4605:5007:6117:6119:6261:6742:7875:7903:9121:10004:10400:10848:10967:11026:11232:11658:11914:12295:12296:12517:12519:12663:12740:13069:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: man17_3e8af247d6e3b X-Filterd-Recvd-Size: 2879 Date: Wed, 11 Feb 2015 21:17:07 -0500 From: Steven Rostedt To: Andy Lutomirski Cc: Denys Vlasenko , Linus Torvalds , Oleg Nesterov , Borislav Petkov , "H. Peter Anvin" , Frederic Weisbecker , X86 ML , Alexei Starovoitov , Will Drewry , Kees Cook , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 08/11] x86: entry_64.S: fold test_in_nmi macro into its only user Message-ID: <20150211211707.40e5e6db@gandalf.local.home> In-Reply-To: References: <1421272101-16847-1-git-send-email-dvlasenk@redhat.com> <1421272101-16847-8-git-send-email-dvlasenk@redhat.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Feb 2015 12:40:36 -0800 Andy Lutomirski wrote: > On Wed, Jan 14, 2015 at 1:48 PM, Denys Vlasenko wrote: > > No code changes. > > Steven, is this okay with you? Not as is. The reason I created the macro in the first place was to give names to values and labels. That is: - .macro test_in_nmi reg stack nmi_ret normal_ret - cmpq %\reg, \stack - ja \normal_ret - subq $EXCEPTION_STKSZ, %\reg - cmpq %\reg, \stack - jb \normal_ret - jmp \nmi_ret Shows you that we are comparing the reg to a given stack. And it also shows us where to jump as a result (normal_ret vs nmi_ret). We lose that with: + cmpq %rdx, 4*8(%rsp) + ja first_nmi + subq $EXCEPTION_STKSZ, %rdx + cmpq %rdx, 4*8(%rsp) + jb first_nmi + jmp nested_nmi I'm not against the change. I would like to see some descriptive comments along with it. Like adding: /* Compare the NMI stack (rdx) with the stack we came from (4*8(%rsp)) */ cmpq %rdx, 4*8(%rsp) /* If the stack pointer is above the NMI stack, this is a normal NMI */ ja first_nmi subq $EXCEPTION_STKSZ, %rdx cmpq %rdx, 4*8(%rsp) /* If it is below the NMI stack, it is a normal NMI */ jb first_nmi /* Ah, it is within the NMI stack, treat it as nested */ jmp nested_nmi -- Steve