linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Luis Chamberlain <mcgrof@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Wei Xiao <xiaowei66@huawei.com>
Subject: linux-next: manual merge of the sysctl tree with the bpf-next tree
Date: Wed, 11 May 2022 16:33:00 +1000	[thread overview]
Message-ID: <20220511163300.2647cd22@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 3171 bytes --]

Hi all,

Today's linux-next merge of the sysctl tree got a conflict in:

  kernel/trace/ftrace.c

between commit:

  bed0d9a50dac ("ftrace: Add ftrace_lookup_symbols function")

from the bpf-next tree and commit:

  8e4e83b2278b ("ftrace: move sysctl_ftrace_enabled to ftrace.c")

from the sysctl tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc kernel/trace/ftrace.c
index 07d87c7a525d,1f89039f0feb..000000000000
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@@ -7965,64 -7969,21 +7969,83 @@@ ftrace_enable_sysctl(struct ctl_table *
  	return ret;
  }
  
+ static struct ctl_table ftrace_sysctls[] = {
+ 	{
+ 		.procname       = "ftrace_enabled",
+ 		.data           = &ftrace_enabled,
+ 		.maxlen         = sizeof(int),
+ 		.mode           = 0644,
+ 		.proc_handler   = ftrace_enable_sysctl,
+ 	},
+ 	{}
+ };
+ 
+ static int __init ftrace_sysctl_init(void)
+ {
+ 	register_sysctl_init("kernel", ftrace_sysctls);
+ 	return 0;
+ }
+ late_initcall(ftrace_sysctl_init);
+ #endif
++
 +static int symbols_cmp(const void *a, const void *b)
 +{
 +	const char **str_a = (const char **) a;
 +	const char **str_b = (const char **) b;
 +
 +	return strcmp(*str_a, *str_b);
 +}
 +
 +struct kallsyms_data {
 +	unsigned long *addrs;
 +	const char **syms;
 +	size_t cnt;
 +	size_t found;
 +};
 +
 +static int kallsyms_callback(void *data, const char *name,
 +			     struct module *mod, unsigned long addr)
 +{
 +	struct kallsyms_data *args = data;
 +
 +	if (!bsearch(&name, args->syms, args->cnt, sizeof(*args->syms), symbols_cmp))
 +		return 0;
 +
 +	addr = ftrace_location(addr);
 +	if (!addr)
 +		return 0;
 +
 +	args->addrs[args->found++] = addr;
 +	return args->found == args->cnt ? 1 : 0;
 +}
 +
 +/**
 + * ftrace_lookup_symbols - Lookup addresses for array of symbols
 + *
 + * @sorted_syms: array of symbols pointers symbols to resolve,
 + * must be alphabetically sorted
 + * @cnt: number of symbols/addresses in @syms/@addrs arrays
 + * @addrs: array for storing resulting addresses
 + *
 + * This function looks up addresses for array of symbols provided in
 + * @syms array (must be alphabetically sorted) and stores them in
 + * @addrs array, which needs to be big enough to store at least @cnt
 + * addresses.
 + *
 + * This function returns 0 if all provided symbols are found,
 + * -ESRCH otherwise.
 + */
 +int ftrace_lookup_symbols(const char **sorted_syms, size_t cnt, unsigned long *addrs)
 +{
 +	struct kallsyms_data args;
 +	int err;
 +
 +	args.addrs = addrs;
 +	args.syms = sorted_syms;
 +	args.cnt = cnt;
 +	args.found = 0;
 +	err = kallsyms_on_each_symbol(kallsyms_callback, &args);
 +	if (err < 0)
 +		return err;
 +	return args.found == args.cnt ? 0 : -ESRCH;
 +}

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

                 reply	other threads:[~2022-05-11  6:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220511163300.2647cd22@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiaowei66@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).