[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <f3d066d2-a85a-bd21-d4f9-fc27e59135df@linux.ibm.com>
Date: Mon, 7 May 2018 13:51:21 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: Masami Hiramatsu <mhiramat@...nel.org>, oleg@...hat.com
Cc: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>, peterz@...radead.org,
srikar@...ux.vnet.ibm.com, rostedt@...dmis.org, acme@...nel.org,
ananth@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
alexander.shishkin@...ux.intel.com, alexis.berlemont@...il.com,
corbet@....net, dan.j.williams@...el.com, jolsa@...hat.com,
kan.liang@...el.com, kjlx@...pleofstupid.com,
kstewart@...uxfoundation.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
milian.wolff@...b.com, mingo@...hat.com, namhyung@...nel.org,
naveen.n.rao@...ux.vnet.ibm.com, pc@...ibm.com, tglx@...utronix.de,
yao.jin@...ux.intel.com, fengguang.wu@...el.com, jglisse@...hat.com
Subject: Re: [PATCH v3 6/9] trace_uprobe: Support SDT markers having reference
count (semaphore)
Hi Masami,
On 05/04/2018 07:51 PM, Ravi Bangoria wrote:
>
>>> +}
>>> +
>>> +static void sdt_increment_ref_ctr(struct trace_uprobe *tu)
>>> +{
>>> + struct uprobe_map_info *info;
>>> +
>>> + uprobe_down_write_dup_mmap();
>>> + info = uprobe_build_map_info(tu->inode->i_mapping,
>>> + tu->ref_ctr_offset, false);
>>> + if (IS_ERR(info))
>>> + goto out;
>>> +
>>> + while (info) {
>>> + down_write(&info->mm->mmap_sem);
>>> +
>>> + if (sdt_find_vma(tu, info->mm, info->vaddr))
>>> + sdt_update_ref_ctr(info->mm, info->vaddr, 1);
>> Don't you have to handle the error to map pages here?
> Correct.. I think, I've to feedback error code to probe_event_{enable|disable}
> and handler failure there.
I looked at this. Actually, It looks difficult to feedback errors to
probe_event_{enable|disable}, esp. in the mmap() case.
Is it fine if we just warn sdt_update_ref_ctr() failures in dmesg? I'm
doing this in [PATCH 7]. (Though, it makes more sense to do that in
[PATCH 6], will change it in next version).
Any better ideas?
BTW, same issue exists for normal uprobe. If uprobe_mmap() fails,
there is no feedback to trace_uprobe and no warnigns in dmesg as
well !! There was a patch by Naveen to warn such failures in dmesg
but that didn't go in: https://lkml.org/lkml/2017/9/22/155
Also, I'll add a check in sdt_update_ref_ctr() to make sure reference
counter never goes to negative incase increment fails but decrement
succeeds. OTOH, if increment succeeds but decrement fails, the
counter remains >0 but there is no harm as such, except we will
execute some unnecessary code.
Thanks,
Ravi
Powered by blists - more mailing lists