Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1283498ybk; Sun, 10 May 2020 11:51:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW2zu9Xt6g1LlyJpO2+FeiPxyWT6irsI3ptLE8mH2G+v5R05v7+aMvP48EiPCUAAqerRml X-Received: by 2002:a17:906:a88c:: with SMTP id ha12mr1895236ejb.220.1589136699864; Sun, 10 May 2020 11:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589136699; cv=none; d=google.com; s=arc-20160816; b=0YvmTb2KTyQPcjYuaqPvhB5t60uY2/B5Moa++JEBDfTUBHo/74V+9Dr9MZwadfq6Ha VfPFb9BuA2Y12bVgFQYXOu6EiaoHMEDJFI2VyN1hl+xYmzmK+UBKsNNQLgb1yJt+KDio Ru/bMUo7MkbqGe45gJKYrecOHpqGya4pO2yKkB1CRdgQaCjnFt++dzadmF829Rh/BUEf +nYK2kH59aZPG/MQqxl1C1GedMEb3D+Nfyeaz4+XeQ1wTSoPtscGngkWXvN/jH/0yELq DHnrLHoO4kvLc2nXmPeyB4gdDL43pVpbDJDUSpWnZ2Yqc+eLWMsr5CGC0NcSOh+SI6pn LeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=rAPaGvM8/uOLi+vX06KIGvqveeujQC06YMeBsjCL8Zg=; b=bOfAAptugoSBkXq6d9P9itxx/paoh5HGa6D4rGpW9s/jUlG9z2WnApogXcq/r30Vg/ yXQM7LgkS/hVlTh7QKsAz2zvJZXsbL3UVpcZ+DHeE1j+FRJQ7tOtTfohUabZyYYnD69F nJH80uwuZiP6G381GATHjMITrpE91SkFj2yj6mccWZtzm8PT2CuP792fGSLZbNtG/5Ri RXfO4WSsPx7l7Z+Mh3tpDRt0QvI1r7AsAZDA72tkFllsDPp43xrPhLBXGapO9eZ/+/TE nBWysrpfynxZ6hA4JiE/BMiKluRrRnn+gA9SWKIMtqgAFp1akIlFdapqq+12oRG7lRZH j60Q== 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 q6si4468855edb.559.2020.05.10.11.51.16; Sun, 10 May 2020 11:51:39 -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 S1729138AbgEJSrq (ORCPT + 99 others); Sun, 10 May 2020 14:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728555AbgEJSrq (ORCPT ); Sun, 10 May 2020 14:47:46 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2159C061A0C for ; Sun, 10 May 2020 11:47:45 -0700 (PDT) Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jXqyq-00044P-T3; Sun, 10 May 2020 20:47:17 +0200 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 13593100D21; Sun, 10 May 2020 20:47:16 +0200 (CEST) From: Thomas Gleixner To: Andy Lutomirski Cc: LKML , X86 ML , "Paul E. McKenney" , Andy Lutomirski , Alexandre Chartre , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon Subject: Re: [patch V4 part 2 10/18] x86/entry/64: Check IF in __preempt_enable_notrace() thunk In-Reply-To: <87k11l4d7l.fsf@nanos.tec.linutronix.de> References: <20200505134112.272268764@linutronix.de> <20200505134341.087595319@linutronix.de> <87k11l4d7l.fsf@nanos.tec.linutronix.de> Date: Sun, 10 May 2020 20:47:16 +0200 Message-ID: <87k11j4ogb.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thomas Gleixner writes: > Andy Lutomirski writes: >> On Tue, May 5, 2020 at 7:14 AM Thomas Gleixner wrote: >> /** >> * preempt_schedule_notrace - preempt_schedule called by tracing >> * >> * The tracing infrastructure uses preempt_enable_notrace to prevent >> * recursion and tracing preempt enabling caused by the tracing >> * infrastructure itself. But as tracing can happen in areas coming >> * from userspace or just about to enter userspace, a preempt enable >> * can occur before user_exit() is called. This will cause the scheduler >> * to be called when the system is still in usermode. >> * >> * To prevent this, the preempt_enable_notrace will use this function >> * instead of preempt_schedule() to exit user context if needed before >> * calling the scheduler. >> */ >> >> Which is no longer really applicable to x86 -- in the state that this >> comment nonsensically refers to as "userspace", x86 *always* has IRQs >> off, which means that preempt_enable() will not schedule. Yeah. >> So I'm guessing that the issue you're solving is that we have >> redundant preempt disable/enable pairs somewhere in the bowels of >> tracing code that is called with IRQs off, and objtool is now >> complaining. Could the actual code in question be fixed to assert >> that IRQs are off instead of disabling preemption? If not, can you >> fix the $SUBJECT and changelog and perhaps add a comment to the code >> as to *why* you're checking IF? Otherwise some intrepid programmer is >> going to notice it down the road, wonder if it's optimizing anything >> useful at all, and get rid of it. > > Let me stare into that again. There are a few preempt_disable/enable() pairs in some of the helper functions which are called in various places. That means we would have to chase all of them and provide 'naked' helpers for these particular call chains. I'll fix the changelog and add a comment to make clear what this is about. Thanks, tglx