All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@citrix.com>
To: Insu Yun <wuninsu@gmail.com>, David Vrabel <david.vrabel@citrix.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	huaixin.chx@alibaba-inc.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, Taesoo Kim <taesoo@gatech.edu>,
	Yeongjin Jang <yeongjin.jang@gatech.edu>,
	"Yun, Insu" <insu@gatech.edu>
Subject: Re: [PATCH] xen: check return value of xenbus_printf
Date: Thu, 15 Oct 2015 19:20:16 +0100	[thread overview]
Message-ID: <561FEE60.7080308@citrix.com> (raw)
In-Reply-To: <CAGoFzNeiu0sNXUh_JtGp8_HWA+k5xq9s-D4qFqU43Vgm=bYiiA@mail.gmail.com>

Hi Insu,

On 15/10/15 19:12, Insu Yun wrote:
> 
> 
> On Thu, Oct 15, 2015 at 12:40 PM, David Vrabel <david.vrabel@citrix.com
> <mailto:david.vrabel@citrix.com>> wrote:
> 
>     On 15/10/15 17:25, Insu Yun wrote:
>     > Internally, xenbus_printf uses memory allocation, so it can be failed in
>     > memory pressure.Therefore, xenbus_printf's return should be checked
>     > and properly handled.
>     [...]
>     > --- a/drivers/input/misc/xen-kbdfront.c
>     > +++ b/drivers/input/misc/xen-kbdfront.c
>     > @@ -129,8 +129,11 @@ static int xenkbd_probe(struct xenbus_device *dev,
>     >
>     >       if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
>     >               abs = 0;
>     > -     if (abs)
>     > -             xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
>     > +     if (abs) {
>     > +             ret = xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
>     > +             if (ret)
> 
>     > +                     pr_warning("xenkbd: can't request abs-pointer");
> 
> 
> This error handling is from other code .
> I am not sure that it is right error handling.
>  
> 
> 
>     I think you want abs = 0 here or input device will be configured as
>     absolute but the backend will supply relative coordinates.
> 
> 
> I cannot understand

If the frontend is not able to write the node "request-abs-pointer" in
the xenstore, the backend will always supply relative coordinates.

Although, as abs = 1, the frontend will be configured to handle absolute
coordinate. So the backend and frontend won't be able to understand each
other.

So you have to set abs to 0 if xebus_printf fails.

Regards,

-- 
Julien Grall

WARNING: multiple messages have this Message-ID (diff)
From: Julien Grall <julien.grall@citrix.com>
To: Insu Yun <wuninsu@gmail.com>, David Vrabel <david.vrabel@citrix.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	<huaixin.chx@alibaba-inc.com>, <linux-input@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Taesoo Kim <taesoo@gatech.edu>,
	Yeongjin Jang <yeongjin.jang@gatech.edu>,
	"Yun, Insu" <insu@gatech.edu>
Subject: Re: [PATCH] xen: check return value of xenbus_printf
Date: Thu, 15 Oct 2015 19:20:16 +0100	[thread overview]
Message-ID: <561FEE60.7080308@citrix.com> (raw)
In-Reply-To: <CAGoFzNeiu0sNXUh_JtGp8_HWA+k5xq9s-D4qFqU43Vgm=bYiiA@mail.gmail.com>

Hi Insu,

On 15/10/15 19:12, Insu Yun wrote:
> 
> 
> On Thu, Oct 15, 2015 at 12:40 PM, David Vrabel <david.vrabel@citrix.com
> <mailto:david.vrabel@citrix.com>> wrote:
> 
>     On 15/10/15 17:25, Insu Yun wrote:
>     > Internally, xenbus_printf uses memory allocation, so it can be failed in
>     > memory pressure.Therefore, xenbus_printf's return should be checked
>     > and properly handled.
>     [...]
>     > --- a/drivers/input/misc/xen-kbdfront.c
>     > +++ b/drivers/input/misc/xen-kbdfront.c
>     > @@ -129,8 +129,11 @@ static int xenkbd_probe(struct xenbus_device *dev,
>     >
>     >       if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
>     >               abs = 0;
>     > -     if (abs)
>     > -             xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
>     > +     if (abs) {
>     > +             ret = xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
>     > +             if (ret)
> 
>     > +                     pr_warning("xenkbd: can't request abs-pointer");
> 
> 
> This error handling is from other code .
> I am not sure that it is right error handling.
>  
> 
> 
>     I think you want abs = 0 here or input device will be configured as
>     absolute but the backend will supply relative coordinates.
> 
> 
> I cannot understand

If the frontend is not able to write the node "request-abs-pointer" in
the xenstore, the backend will always supply relative coordinates.

Although, as abs = 1, the frontend will be configured to handle absolute
coordinate. So the backend and frontend won't be able to understand each
other.

So you have to set abs to 0 if xebus_printf fails.

Regards,

-- 
Julien Grall

  parent reply	other threads:[~2015-10-15 18:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 16:25 [PATCH] xen: check return value of xenbus_printf Insu Yun
2015-10-15 16:40 ` David Vrabel
2015-10-15 16:40   ` David Vrabel
     [not found]   ` <CAGoFzNeiu0sNXUh_JtGp8_HWA+k5xq9s-D4qFqU43Vgm=bYiiA@mail.gmail.com>
2015-10-15 18:20     ` Julien Grall [this message]
2015-10-15 18:20       ` Julien Grall
  -- strict thread matches above, loose matches on Subject: below --
2015-10-15 18:40 Insu Yun
2015-10-16  0:01 ` Dmitry Torokhov
2015-10-19 14:10 Insu Yun
2015-10-19 14:30 ` Julien Grall
2015-10-19 14:30   ` Julien Grall
2015-10-19 16:02 Insu Yun
2015-10-19 16:46 ` Dmitry Torokhov

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=561FEE60.7080308@citrix.com \
    --to=julien.grall@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=huaixin.chx@alibaba-inc.com \
    --cc=insu@gatech.edu \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=taesoo@gatech.edu \
    --cc=wei.liu2@citrix.com \
    --cc=wuninsu@gmail.com \
    --cc=yeongjin.jang@gatech.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.