From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25C96C00A89 for ; Fri, 30 Oct 2020 10:41:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3A8B221EB for ; Fri, 30 Oct 2020 10:41:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="AA0N4PoN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbgJ3Kle (ORCPT ); Fri, 30 Oct 2020 06:41:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:39262 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbgJ3Kld (ORCPT ); Fri, 30 Oct 2020 06:41:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1604054491; 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: in-reply-to:in-reply-to:references:references; bh=p/BtQ++5zS+WPjtM1dDZdlm+h9v0/VVu9/G1z1EDdzU=; b=AA0N4PoNb6MlvO++SZr0bFnfX/1FNrhcT2/AdQ69oGGuqQIkpv3ZWKWOuflfxV0DVx65XL xhO/pviHTaXMKMiBUMxXeDO3yBoLJlrnar1T2x5KQsLMM4xj3zyW9Z09QWH/7SCefQNDQg nYFCxkvzrNdsUYN1x++SjyLSTk+D14U= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D0ABEAC53; Fri, 30 Oct 2020 10:41:31 +0000 (UTC) Date: Fri, 30 Oct 2020 11:41:30 +0100 From: Petr Mladek To: Miroslav Benes Cc: Steven Rostedt , linux-kernel@vger.kernel.org, Masami Hiramatsu , Andrew Morton , Josh Poimboeuf , Jiri Kosina , Joe Lawrence , live-patching@vger.kernel.org Subject: Re: [PATCH 6/9] livepatch/ftrace: Add recursion protection to the ftrace callback Message-ID: <20201030104130.GA1602@alley> References: <20201028115244.995788961@goodmis.org> <20201028115613.291169246@goodmis.org> <20201029145709.GD16774@alley> <20201029142406.3c46855a@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2020-10-30 10:48:58, Miroslav Benes wrote: > > > > > + bit = ftrace_test_recursion_trylock(); > > > > > + if (bit < 0) > > > > > + return; > > > > > > > > This means that the original function will be called in case of recursion. > > > > That's probably fair, but I'm wondering if we should at least WARN about > > > > it. > > > > > > Yeah, the early return might break the consistency model and > > > unexpected things might happen. We should be aware of it. > > > Please use: > > > > > > if (WARN_ON_ONCE(bit < 0)) > > > return; > > > > > > WARN_ON_ONCE() might be part of the recursion. But it should happen > > > only once. IMHO, it is worth the risk. > > > > > > Otherwise it looks good. > > > > Perhaps we can add that as a separate patch, because this patch doesn't add > > any real functionality change. It only moves the recursion testing from the > > helper function (which ftrace wraps all callbacks that do not have the > > RECURSION flags set, including this one) down to your callback. > > > > In keeping with one patch to do one thing principle, the added of > > WARN_ON_ONCE() should be a separate patch, as that will change the > > functionality. > > > > If that WARN_ON_ONCE() breaks things, I'd like it to be bisected to another > > patch other than this one. > > Works for me. +1 So, with the updated commit message: Reviewed-by: Petr Mladek Best Regards, Petr