From: Christoph Hellwig <hch@infradead.org>
To: Haren Myneni <haren@linux.vnet.ibm.com>
Cc: devicetree@vger.kernel.org, mikey@neuling.org,
herbert@gondor.apana.org.au, npiggin@gmail.com,
sukadev@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 09/14] powerpc/vas: Update CSB and notify process for fault CRBs
Date: Wed, 27 Nov 2019 00:46:09 -0800 [thread overview]
Message-ID: <20191127084609.GF17097@infradead.org> (raw)
In-Reply-To: <1574817074.13250.16.camel@hbabu-laptop>
>
> +static void notify_process(pid_t pid, u64 fault_addr)
> +{
> + int rc;
> + struct kernel_siginfo info;
> +
> + memset(&info, 0, sizeof(info));
> +
> + info.si_signo = SIGSEGV;
> + info.si_errno = EFAULT;
> + info.si_code = SEGV_MAPERR;
> +
> + info.si_addr = (void *)fault_addr;
> + rcu_read_lock();
> + rc = kill_pid_info(SIGSEGV, &info, find_vpid(pid));
> + rcu_read_unlock();
> +
> + pr_devel("%s(): pid %d kill_proc_info() rc %d\n", __func__, pid, rc);
> +}
Shouldn't this use force_sig_fault_to_task instead?
> + /*
> + * User space passed invalid CSB address, Notify process with
> + * SEGV signal.
> + */
> + tsk = get_pid_task(window->pid, PIDTYPE_PID);
> + /*
> + * Send window will be closed after processing all NX requests
> + * and process exits after closing all windows. In multi-thread
> + * applications, thread may not exists, but does not close FD
> + * (means send window) upon exit. Parent thread (tgid) can use
> + * and close the window later.
> + */
> + if (tsk) {
> + if (tsk->flags & PF_EXITING)
> + task_exit = 1;
> + put_task_struct(tsk);
> + pid = vas_window_pid(window);
The pid is later used for sending the signal again, why not keep the
reference?
> + } else {
> + pid = vas_window_tgid(window);
> +
> + rcu_read_lock();
> + tsk = find_task_by_vpid(pid);
> + if (!tsk) {
> + rcu_read_unlock();
> + return;
> + }
> + if (tsk->flags & PF_EXITING)
> + task_exit = 1;
> + rcu_read_unlock();
Why does this not need a reference to the task, but the other one does?
next prev parent reply other threads:[~2019-11-27 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 1:11 [PATCH 09/14] powerpc/vas: Update CSB and notify process for fault CRBs Haren Myneni
2019-11-27 8:46 ` Christoph Hellwig [this message]
2019-11-27 10:03 ` Haren Myneni
2019-12-06 9:51 ` Haren Myneni
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=20191127084609.GF17097@infradead.org \
--to=hch@infradead.org \
--cc=devicetree@vger.kernel.org \
--cc=haren@linux.vnet.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=npiggin@gmail.com \
--cc=sukadev@linux.vnet.ibm.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).