Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1231738pxx; Fri, 30 Oct 2020 05:31:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznYwldQ12T4BrgvthEYrKE7AZHmfNeEN5Q6vIv/NaGBMIYQKHLU6BPnJa4dQS+5hSTeGYz X-Received: by 2002:a17:906:6b92:: with SMTP id l18mr2254855ejr.292.1604061075574; Fri, 30 Oct 2020 05:31:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604061075; cv=none; d=google.com; s=arc-20160816; b=qVrKmATQu8YU5KNS7jhfu6hoPC+yExSJ4LiaiB5TJWN1aaSvX1t4faswkllvddYiFK i2GjnAe2ctI0eLOBsSfpMWkPxjpd9DCpe+4LxMjGJx70RwXnmwCBukybU5WgHrOILZ5v DnjFptiETr6Vd7VQm1RfHagoc8YwrSjILHBRNvZ9xSuYrmQgtoTEAEyKVSyr5OEATEkk xeTeZYFC3VzL3NS9UDXYfwX5ddyGN5glxey8EKyij38n3CWWgx2kg8sXcVq9yFob3iMB brv/5xjzWGJo+bvp3np7Ab2YkS7i/j+Lupjg0nUaoIEplaEJ37H07ByNqvLq4cpUxxf7 n+gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=mgciMQhIDJiq2yPBaGTiSxsTeYiiiIOuPF/rJgTZ/JU=; b=PHguxpArSG8TQkAka8eGJNkkEdeJygtHk4AdljeyLBovZN2mReZlatPfXZ1TzGfIIQ EqeXsPWEd0UllrVVNScBXzZuYtdf9IVjlWM5LMREo6Nw1OOfOg9S1mCWgPGQ0VqYiJox 0g+vB8K+qitBn1j3ddu2cC+t1S95ApjW/Gf4e1Mhuy4M+caPi7bJ3Jbz53nG04PffJYE 12oWbzzRpdQCqqRwcO3J/W7FuWE5eFkWtxPvFuUNmusMRdi1eP8P3Jhopli6hB5fXiGO 05bUNsNtSBdEW5eT0jLJkh2FmpRPMy+3owarLzkESpPl5hJC0e+G/cVE7rBU1DvHzGFh PVlw== 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 c1si4028751ejf.66.2020.10.30.05.30.52; Fri, 30 Oct 2020 05:31:15 -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 S1726576AbgJ3M3C (ORCPT + 99 others); Fri, 30 Oct 2020 08:29:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:51060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbgJ3M2h (ORCPT ); Fri, 30 Oct 2020 08:28:37 -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 55D4820728; Fri, 30 Oct 2020 12:28:34 +0000 (UTC) Date: Fri, 30 Oct 2020 08:28:31 -0400 From: Steven Rostedt To: Miroslav Benes Cc: linux-kernel@vger.kernel.org, Masami Hiramatsu , Andrew Morton , Josh Poimboeuf , Jiri Kosina , Petr Mladek , Joe Lawrence , live-patching@vger.kernel.org Subject: Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback Message-ID: <20201030082831.5142be16@oasis.local.home> In-Reply-To: <20201029103744.0f7f52dc@gandalf.local.home> References: <20201028115244.995788961@goodmis.org> <20201028115613.291169246@goodmis.org> <20201029103744.0f7f52dc@gandalf.local.home> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Oct 2020 10:37:44 -0400 Steven Rostedt wrote: > I also plan on adding code that reports when recursion has happened, > because even if it's not a problem, recursion adds extra overhead. I did the above (will be posting that later, maybe next week), and found two bugs with the recursion code. :-/ One was in the nmi handling, where it never cleared the nmi bit (because it was zero, and thus ignored), and that caused all functions in NMI handlers to not be traced (because it thought it was a recursion). (see https://lore.kernel.org/r/20201030002722.766a22df@oasis.local.home) The second was the recursion algorithm depends on the preempt_count() being accurate, but when it transitions between context, and there's tracing in that transition, it could falsely record it as a recursion. I have a fix for both of these bugs and will be sending them up marked for stable after I finish testing them. This goes to show that the recursion reported should be implemented (but that will be for the next merge window). -- Steve