Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1159180pxx; Fri, 30 Oct 2020 03:43:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOaqlmFT20gpywPcxKazzsIYMujRVfdbpI1UKKkEVfV/ypHBWo9qgjDM+JwCQvrSBJ4lHp X-Received: by 2002:a17:906:60d3:: with SMTP id f19mr1809850ejk.141.1604054618307; Fri, 30 Oct 2020 03:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604054618; cv=none; d=google.com; s=arc-20160816; b=TNMftg22Wbwg7RsCq3XhJXh7uucC+MinC8irMYQhiLdCvSkLuGXPiyTo52jrMLBrcq RV74Vm9l7QzRM1AbVZcjuktGv6K7jEV7YlsCV9tH0VswjO70zPaNH9cmlwR5LhfAPM2r nlSExKOUsfpxo91MMZWLel/t9lNPaRVJG524v1749ll2EJVFESvT86qVgPLFclQH9TiJ ye19x8UDXR6aTEYy06354u/wgfOuXNJBd2m5WpR0lioxx3pmgGgj1dhz4dYamZmd8hX4 FPb5YfzCrs2Vnx635QBVDtMSIJskXJi1nVk5g2ci3lpD1U0brnE7SYZgNJHtNJTEWZGl nR+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p/BtQ++5zS+WPjtM1dDZdlm+h9v0/VVu9/G1z1EDdzU=; b=NIu5u1lkUVW1qv1mxYcM0rT9SOrJiLTB3aH1HHqD+9uwZ5C9wYOUnaIVD4uBF3cikJ rmUXEsfkIu4mbnmFlpkcRjv1Y+Obd5CQWc/bd3YasWAB12uyUfdt7AJdar2R8stSb8vV IO0mcWxUJiPhSlDve/2ZeWGl29jfpHLwQfqfV2HqYfWk5LM4fX0ZTj12+pp4qc8QbII5 ZxVc11DPX2Q7Zp34zV6cd8DcCmH+f5zpfE8Mihiv8eQFk3txyBjcSKhObqm6UzwJhoDY n5/fQxfS2b07F+Bl9zPOg0kfAI/M/T94HnrxYCeD2MvO6nCACWumPivScBflU0Sa5c4F tI8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=AA0N4PoN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si3983902edu.307.2020.10.30.03.43.14; Fri, 30 Oct 2020 03:43: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; dkim=pass header.i=@suse.com header.s=susede1 header.b=AA0N4PoN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgJ3Kle (ORCPT + 99 others); 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