Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp642181ybx; Wed, 6 Nov 2019 06:18:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzxGmoe9TNSBhZdbrosktR25dfp4uHzHvgPQloFAouMJdBmPFjtHOCQpiJI/TgKX0rXE2qN X-Received: by 2002:a50:a9e3:: with SMTP id n90mr2903537edc.52.1573049916615; Wed, 06 Nov 2019 06:18:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573049916; cv=none; d=google.com; s=arc-20160816; b=oqtSD8ngPQsr5IgXynZdaQJq7mBvzujR3EI9OU2qj4q5DAzM/CHsku/8EXlSEgmTN8 fFkZJTAhn3ANrDMALLq0f880y4hwZeCPZAJN5Y0QY6+vHvMPhzuDl0xReB1BZr7/rIdH uXMf0FcIyOK4X5rOSKR3vk42XYuxBjWwhlbn+fM6Y1FuxdJZ9YvTlALazZ52wAuAwOm7 Z5jHP5ZB1/zyx4WXs0tLyT8VRbTylPESuDk7pvw/2CqJ3cDxWzf3qDukeZ1Fkc24KaUV ZMAy99GSJg/DZ1uSdvUe0JUoJV4qBLzDvfbvfSwIr8vF2DfWQSeZ8XAf2BdtN6xzMr1x GyhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zCBgMsIvus1j5NpsrJQNxWzfa4WuwAj7/SzpKoC10EU=; b=Rd8gp6HxLbWW/d3TwGoA8sVD0AtGy7mF18895dzovrUKXlnGqrQVyByD9aI6+w8gP7 wPzf4JtwYGxONo2zACO6ipllhv8PuaHtsgbuy/V0P1EUgnDV3KeMaG8kJZXlVV+8iADO 1KiHQwAIHQfuXJ3YA6fRMBiVSLktQthKiODYAsXeX3xSFFtlXnG5wfuV9Ebvrnrn70sK yxqk/oWW34hYeEz3Pw3R8bOUnFLdayIn+fP/gh+kGpN5iZiyK2b6BFdaQMy/IatgRZpm jG4fqyM9mZp6NL3j107HdJEhZxUKHPuolA0eAW8e1XY6V2Di0vK4IGVKyxk9mTJ+sdWJ FHZg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e22si13515660ede.163.2019.11.06.06.18.12; Wed, 06 Nov 2019 06:18:36 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731665AbfKFOPg (ORCPT + 99 others); Wed, 6 Nov 2019 09:15:36 -0500 Received: from foss.arm.com ([217.140.110.172]:40580 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbfKFOPf (ORCPT ); Wed, 6 Nov 2019 09:15:35 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2AAD47CD; Wed, 6 Nov 2019 06:15:35 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5A693F6C4; Wed, 6 Nov 2019 06:15:32 -0800 (PST) Date: Wed, 6 Nov 2019 14:15:30 +0000 From: Mark Rutland To: Amit Kachhap Cc: linux-arm-kernel@lists.infradead.org, Steven Rostedt , linux-kernel@vger.kernel.org, catalin.marinas@arm.com, deller@gmx.de, duwe@suse.de, James.Bottomley@HansenPartnership.com, james.morse@arm.com, jeyu@kernel.org, jpoimboe@redhat.com, jthierry@redhat.com, linux-parisc@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, svens@stackframe.org, takahiro.akashi@linaro.org, will@kernel.org Subject: Re: [PATCHv2 1/8] ftrace: add ftrace_init_nop() Message-ID: <20191106141530.GC50610@lakrids.cambridge.arm.com> References: <20191029165832.33606-1-mark.rutland@arm.com> <20191029165832.33606-2-mark.rutland@arm.com> <20191104133657.GE45140@lakrids.cambridge.arm.com> <8e68de1f-f961-752d-9c07-ce41ce624d35@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e68de1f-f961-752d-9c07-ce41ce624d35@arm.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 05, 2019 at 12:17:26PM +0530, Amit Kachhap wrote: > On 11/4/19 7:06 PM, Mark Rutland wrote: > > On Sat, Nov 02, 2019 at 05:49:00PM +0530, Amit Daniel Kachhap wrote: > > > On 10/29/19 10:28 PM, Mark Rutland wrote: > > > > +/** > > > > + * ftrace_init_nop - initialize a nop call site > > > > + * @mod: module structure if called by module load initialization > > > > + * @rec: the call site record (e.g. mcount/fentry) > > > > + * > > > > + * This is a very sensitive operation and great care needs > > > > + * to be taken by the arch. The operation should carefully > > > > + * read the location, check to see if what is read is indeed > > > > + * what we expect it to be, and then on success of the compare, > > > > + * it should write to the location. > > > > + * > > > > + * The code segment at @rec->ip should contain the contents created by > > > > + * the compiler > > > Nit: Will it be better to write it as "@rec->ip should store the adjusted > > > ftrace entry address of the call site" or something like that. > > > > This was the specific wording requested by Steve, and it's trying to > > describe the instructions at rec->ip, rather than the value of rec->ip, > > so I think it's better to leave this as-is. > ok Its fine this way too. Actually from the comment, I could not understand > which one of the compiler contents this points to as in this case there are > 2 nops. We can't say what the compiler contents will be. An architecture may use this callback if it's using mcount, mfentry, patchable-function-entry, or some other mechanism we're not aware of today. Depending on the architecture and mechanism, the callsite could contain a number of distinct things. All the comment is trying to say is that when ftrace_init_nop() is called, the callsite has not been modified in any way since being compiled, so we can expect the contents to be whatever the compiler generated. Thanks, Mark.