Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp803996ybh; Tue, 10 Mar 2020 08:33:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvm2r6GCvo9wlV5B84/Ot/XJkq87nXTXex+6k7nWQ5oK2i4nbUjEAH915XpQi3l01i//Inu X-Received: by 2002:aca:1903:: with SMTP id l3mr1541936oii.178.1583854392899; Tue, 10 Mar 2020 08:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583854392; cv=none; d=google.com; s=arc-20160816; b=hv+UfrV5acZzdMl3o+aLC4zT7G0INPDJ85s1fFZkwG588/8TOFef3ZHOSFcp0KTB4r NvC4hwYQ4VhFbQRRFLv5ZaQG2d7EDo8nSOjq29zGuSzTdUTnzBzGkHIa+Gp5pY8Wq6Yf YrZqoP5f+qhNZtNp3DfCDaOYsnNuA/2ab4zq2T44z6Poda36L+8cnCgCNvjHTJrmj1hi DPrYgIuJ4a/jwWU9no+23lY1jnnNgDLcu993lGKK7iyuQGUN2SvuTFhRv2XzWmR/Daqn loNNWqgA0W3rO/kfKSL6ySvW3/WqxkVVaB3ZoQ5U7cvhxEaQxhu5arGY1TrZfNRaSXL4 Whdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=nj/SYwwa3H2hKOSm4ou98RXCIxnuTFiGSEBDrOICsp8=; b=p9tAGmtjkVy6n7ZMib3MlIyx2cSmdwnV/BtXNQ9boE/u8lu92MZHvMOmjtjSTaYhIe f+WTMi356MhDBg++7320Spnpe8aSPNdH7WlAmEZvut/jiOMeJ1N2RPVr036MbXUuLGXM 8f12pXcIHbsQswX9ZARMCIOPrzc4RZBkjRFhzUUKy6Smxa6cTkTWb3mhtPHrYVjHAEFT 4bTvJ8JGRhwGaN06Vjn5zMmy4Ped3FiZHUkjM4VEUsNlHXSr4dhlrefQ6vHgbuWjF8QR hTzlt3C5LdE5gyDhrAHVnHh0Pd5uxPfKznDbkUo4VtTw1DgTOvSvtZgKuV8Bo1KADem4 HSFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b="ZeQ/xaYG"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g23si8530424otn.212.2020.03.10.08.33.00; Tue, 10 Mar 2020 08:33:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b="ZeQ/xaYG"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727714AbgCJPbx (ORCPT + 99 others); Tue, 10 Mar 2020 11:31:53 -0400 Received: from mail.efficios.com ([167.114.26.124]:59504 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbgCJPbx (ORCPT ); Tue, 10 Mar 2020 11:31:53 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 7D0152706AE; Tue, 10 Mar 2020 11:31:51 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1cZpvTYtrQgO; Tue, 10 Mar 2020 11:31:51 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 3EDE82704D4; Tue, 10 Mar 2020 11:31:51 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 3EDE82704D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1583854311; bh=nj/SYwwa3H2hKOSm4ou98RXCIxnuTFiGSEBDrOICsp8=; h=Date:From:To:Message-ID:MIME-Version; b=ZeQ/xaYGndMSV9lUtWfMLyF05bj3iZBkxrxj+hrOUTydmCQgXG6u1d63UQQJEKAdM F5wHiyHtjBwncUNvRYkq6W8BSyi5tTOLullW0m7d+S6oobVu/JNEKX8VR6Fn7de8YH CPCH+dELYbffEy4XQBBP8WJWHm4KpKMmM68ikAkRW2Tn6uZP3+CL1LKztAq9WXCRIc Z5rISprbtCcH/5W0ISaJRNvkSc4hm0a7oncXqFWhaTDr0uX/9HbZ4OMilxOpCglYGT ofjwjdWp37o2Cfp8RimZNatxs2CKTR8lliExNk3++lOGYl0ZXzr+pvUiCjij6JaV3b pVW+WoWJphCMQ== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zz7YAcnfyUUG; Tue, 10 Mar 2020 11:31:51 -0400 (EDT) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id 2EA312705C0; Tue, 10 Mar 2020 11:31:51 -0400 (EDT) Date: Tue, 10 Mar 2020 11:31:51 -0400 (EDT) From: Mathieu Desnoyers To: Thomas Gleixner Cc: Masami Hiramatsu , rostedt , linux-kernel , Peter Zijlstra , Alexei Starovoitov , paulmck , "Joel Fernandes, Google" , Frederic Weisbecker , Jason Wessel Message-ID: <450878559.23455.1583854311078.JavaMail.zimbra@efficios.com> In-Reply-To: <87pndk5tb4.fsf@nanos.tec.linutronix.de> References: <87mu8p797b.fsf@nanos.tec.linutronix.de> <20200309141546.5b574908@gandalf.local.home> <87fteh73sp.fsf@nanos.tec.linutronix.de> <20200310170951.87c29e9c1cfbddd93ccd92b3@kernel.org> <87pndk5tb4.fsf@nanos.tec.linutronix.de> Subject: Re: Instrumentation and RCU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_3901 (ZimbraWebClient - FF73 (Linux)/8.8.15_GA_3895) Thread-Topic: Instrumentation and RCU Thread-Index: Vrvuy5XcnfL0kDVv4taSpI5sQV/3Jg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Mar 10, 2020, at 7:43 AM, Thomas Gleixner tglx@linutronix.de wrote: [...] > > That's why we want the sections and the annotation. If something calls > out of a noinstr section into a regular text section and the call is not > annotated at the call site, then objtool can complain and tell you. What > Peter and I came up with looks like this: > > noinstr foo() > do_protected(); <- Safe because in the noinstr section > > instr_begin(); <- Marks the begin of a safe region, ignored > by objtool > > do_stuff(); <- All good > > instr_end(); <- End of the safe region. objtool starts > looking again > > do_other_stuff(); <- Unsafe because do_other_stuff() is > not protected > and: > > noinstr do_protected() > bar(); <- objtool will complain here > > See? I think there are two distinct problems we are trying to solve here, and it would be good to spell them out to see which pieces of technical solution apply to which. Problem #1) Tracer invoked from partially initialized kernel context - Moving the early/late entry/exit points into sections invisible from instrumentation seems to make tons of sense for this. Problem #2) Tracer recursion - I'm much less convinced that hiding entry points from instrumentation works for this. As an example, with the isntr_begin/end() approach you propose above, as soon as you have a tracer recursing into itself because something below do_stuff() has been instrumented, having hidden the entry point did not help at all. So I would be tempted to use the "hide entry/exit points" with explicit instr begin/end annotation to solve Problem #1, but I'm still thinking there is value in the per recursion context "in_tracing" flag to prevent tracer recursion. Thoughts ? Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com