From: Timur Tabi <timur@freescale.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: kumar.gala@freescale.com, benh@kernel.crashing.org,
greg@kroah.com, akpm@kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-console@vger.kernel.org
Subject: Re: [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver
Date: Wed, 1 Jun 2011 15:24:51 -0500 [thread overview]
Message-ID: <4DE6A013.409@freescale.com> (raw)
In-Reply-To: <20110601204618.32190be9@lxorguk.ukuu.org.uk>
Alan Cox wrote:
> O> + /* One partition must be local, the other must be remote. In other
>> + words, if source and target are both -1, or are both not -1, then
>> + return an error. */
>> + if ((param.source == -1) == (param.target == -1))
>> + return -EINVAL;
>
> Excess brackets (I just mention that one in passing)'
Do you mean excess parentheses? If so, then I don't see how. "(param.source ==
-1)" and "(param.target == -1)" are expressions that return a boolean. I'm
comparing the two boolean results to see if they're equal. I want to make sure
that the compiler doesn't do something like this:
if (param.source == (-1 == (param.target == -1)))
I don't even know what that means, but it's not what I want.
>> +static char *strdup_from_user(const char __user *ustr, size_t max)
>> +{
>> + size_t len;
>> + char *str;
>> +
>> + len = strnlen_user(ustr, max);
>> + if (len > max)
>> + return ERR_PTR(-ENAMETOOLONG);
>> +
>> + str = kmalloc(len, GFP_KERNEL);
>> + if (!str)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + if (copy_from_user(str, ustr, len))
>> + return ERR_PTR(-EFAULT);
>> +
>> + return str;
>> +}
>
> This belongs on lib/ if its of general use which I think it perhaps is
> and if we don't have one already.
Where exactly in lib/ should it go? lib/strings.c seems too low-level for a
function like this. lib/string_helpers.c is for sprintf-like functions. And
it's too generic for lib/powerpc/
>> + default:
>> + pr_debug("fsl-hv: unknown ioctl %u\n", cmd);
>> + ret = -ENOIOCTLCMD;
>
> -ENOTTY
>
> (-ENOIOCTLCMD is an internal indicator designed so driver layers can say
> 'dunno, try the next layer up')
>
>> +/* Linked list of processes that have us open */
>> +struct list_head db_list;
>
> static ?
>
>
>> + * We use the same interrupt handler for all doorbells. Whenever a doorbell
>> + * is rung, and we receive an interrupt, we just put the handle for that
>> + * doorbell (passed to us as *data) into all of the queues.
>
> I wonder if these should be presented as IRQs or whether that makes no
> sense ?
Well, the "handles" are supposed to be just unique numbers. In this case, they
are IRQs, but we don't want to expose that. The application is supposed to scan
the device tree looking for the doorbell nodes that it wants, and in those nodes
there is a 'reg' property that contains the handle for that doorbell. So the
numbers just need to match. What they represent is not relevant.
>> +static irqreturn_t fsl_hv_state_change_isr(int irq, void *data)
>> +{
>> + unsigned int status;
>> + struct doorbell_isr *dbisr = data;
>> + int ret;
>> +
>> + /* Determine the new state, and if it's stopped, notify the clients. */
>> + ret = fh_partition_get_status(dbisr->partition, &status);
>> + if (!ret && (status == FH_PARTITION_STOPPED))
>> + schedule_work(&dbisr->work);
>> +
>> + /* Call the normal handler */
>> + return fsl_hv_isr(irq, (void *) (uintptr_t) dbisr->doorbell);
>> +}
>
> Would a threaded IRQ clean this up by avoiding the queue/work stuff ?
Yes, I think so. V3 coming up.
--
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2011-06-01 20:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 18:35 [PATCH 7/7] [v2] drivers/misc: introduce Freescale hypervisor management driver Timur Tabi
2011-06-01 19:46 ` Alan Cox
2011-06-01 20:24 ` Timur Tabi [this message]
2011-06-01 20:34 ` Alan Cox
2011-06-01 20:54 ` Scott Wood
2011-06-01 21:45 ` Alan Cox
2011-06-01 21:40 ` Arnd Bergmann
2011-06-01 22:24 ` Scott Wood
2011-06-03 15:28 ` Arnd Bergmann
2011-06-03 16:22 ` Scott Wood
2011-06-06 15:53 ` Arnd Bergmann
2011-06-06 18:15 ` Scott Wood
2011-06-06 19:48 ` Arnd Bergmann
2011-06-02 21:28 ` Timur Tabi
2011-06-03 15:24 ` Arnd Bergmann
2011-06-03 15:28 ` Timur Tabi
2011-06-06 15:42 ` Arnd Bergmann
2011-06-06 15:48 ` Timur Tabi
2011-06-06 16:03 ` Arnd Bergmann
2011-06-06 16:09 ` Timur Tabi
2011-06-06 16:24 ` Arnd Bergmann
2011-06-06 16:27 ` Timur Tabi
2011-06-06 21:01 ` Chris Metcalf
2011-06-06 21:23 ` Konrad Rzeszutek Wilk
2011-06-06 23:04 ` Chris Metcalf
2011-06-07 7:08 ` Arnd Bergmann
2011-06-07 16:49 ` Chris Metcalf
2011-06-07 19:16 ` Arnd Bergmann
2011-06-07 19:20 ` Timur Tabi
2011-06-07 19:34 ` Arnd Bergmann
2011-06-03 14:44 ` Timur Tabi
2011-06-03 15:17 ` Arnd Bergmann
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=4DE6A013.409@freescale.com \
--to=timur@freescale.com \
--cc=akpm@kernel.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=greg@kroah.com \
--cc=kumar.gala@freescale.com \
--cc=linux-console@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/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).