All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Richard Henderson <rth@twiddle.net>
Cc: Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Paul Brook <paul@codesourcery.com>,
	Kevin Wolf <kwolf@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Riku Voipio <riku.voipio@iki.fi>, Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Blue Swirl <blauwirbel@gmail.com>,
	Stefan Weil <weil@mail.berlios.de>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 10/10] linux-user: remove unused variables
Date: Wed, 15 Jun 2011 21:40:54 +0300	[thread overview]
Message-ID: <20110615184054.GC7197@redhat.com> (raw)
In-Reply-To: <4DF8C292.7080900@twiddle.net>

On Wed, Jun 15, 2011 at 07:32:50AM -0700, Richard Henderson wrote:
> On 06/15/2011 01:35 AM, Alexander Graf wrote:
> >> -                abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
> >> +                abi_ulong arg5 = 0, arg6 = 0;
> >>
> >>                 nb_args = mips_syscall_args[syscall_num];
> >>                 sp_reg = env->active_tc.gpr[29];
> >>                 switch (nb_args) {
> >>                 /* these arguments are taken from the stack */
> >>                 /* FIXME - what to do if get_user() fails? */
> >> -                case 8: get_user_ual(arg8, sp_reg + 28);
> >> -                case 7: get_user_ual(arg7, sp_reg + 24);
> >> +                case 8: /* get_user_ual(arg8, sp_reg + 28); */
> >> +                case 7: /* get_user_ual(arg7, sp_reg + 24); */
> > 
> > I'd prefer to see these and the respective variable definitions #if
> > 0'd with a comment, stating that they're currently unused.
> 
> I'd prefer not to see if 0 code.  Better, I think, to mark the
> variables as __attribute__((unused)) with that same comment.

Why keep dead code around? If it's for documentation pruposes
comment or if 0 seems more appropriate than attributes.

> >> @@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> >>     case TARGET_NR_osf_sigprocmask:
> >>         {
> >>             abi_ulong mask;
> >> -            int how = arg1;
> >>             sigset_t set, oldset;
> >>
> >>             switch(arg1) {
> >>             case TARGET_SIG_BLOCK:
> >> -                how = SIG_BLOCK;
> >>                 break;
> >>             case TARGET_SIG_UNBLOCK:
> >> -                how = SIG_UNBLOCK;
> >>                 break;
> >>             case TARGET_SIG_SETMASK:
> >> -                how = SIG_SETMASK;
> > 
> > why go through the effort of setting "how" and then not using it? I'm
> > pretty sure this is a bug as well. A few lines down is the following
> > code:
> > 
> >    sigprocmask(arg1, &set, &oldset);
> > 
> > which in TARGET_NR_sigprocmask would be:
> > 
> >   ret = get_errno(sigprocmask(how, &set, &oldset));
> > 
> > So we end up sending guest masks to the host. Richard, this is Alpha
> > specific code. Mind to double-check?
> 
> I remember fixing this before.  Perhaps it was in a patch tree that 
> never got pulled...
> 
> 
> r~

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Richard Henderson <rth@twiddle.net>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	kvm@vger.kernel.org, Isaku Yamahata <yamahata@valinux.co.jp>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Riku Voipio <riku.voipio@iki.fi>, Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Blue Swirl <blauwirbel@gmail.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Paul Brook <paul@codesourcery.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Christoph Hellwig <hch@lst.de>, Avi Kivity <avi@redhat.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 10/10] linux-user: remove unused variables
Date: Wed, 15 Jun 2011 21:40:54 +0300	[thread overview]
Message-ID: <20110615184054.GC7197@redhat.com> (raw)
In-Reply-To: <4DF8C292.7080900@twiddle.net>

On Wed, Jun 15, 2011 at 07:32:50AM -0700, Richard Henderson wrote:
> On 06/15/2011 01:35 AM, Alexander Graf wrote:
> >> -                abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
> >> +                abi_ulong arg5 = 0, arg6 = 0;
> >>
> >>                 nb_args = mips_syscall_args[syscall_num];
> >>                 sp_reg = env->active_tc.gpr[29];
> >>                 switch (nb_args) {
> >>                 /* these arguments are taken from the stack */
> >>                 /* FIXME - what to do if get_user() fails? */
> >> -                case 8: get_user_ual(arg8, sp_reg + 28);
> >> -                case 7: get_user_ual(arg7, sp_reg + 24);
> >> +                case 8: /* get_user_ual(arg8, sp_reg + 28); */
> >> +                case 7: /* get_user_ual(arg7, sp_reg + 24); */
> > 
> > I'd prefer to see these and the respective variable definitions #if
> > 0'd with a comment, stating that they're currently unused.
> 
> I'd prefer not to see if 0 code.  Better, I think, to mark the
> variables as __attribute__((unused)) with that same comment.

Why keep dead code around? If it's for documentation pruposes
comment or if 0 seems more appropriate than attributes.

> >> @@ -7058,18 +7056,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> >>     case TARGET_NR_osf_sigprocmask:
> >>         {
> >>             abi_ulong mask;
> >> -            int how = arg1;
> >>             sigset_t set, oldset;
> >>
> >>             switch(arg1) {
> >>             case TARGET_SIG_BLOCK:
> >> -                how = SIG_BLOCK;
> >>                 break;
> >>             case TARGET_SIG_UNBLOCK:
> >> -                how = SIG_UNBLOCK;
> >>                 break;
> >>             case TARGET_SIG_SETMASK:
> >> -                how = SIG_SETMASK;
> > 
> > why go through the effort of setting "how" and then not using it? I'm
> > pretty sure this is a bug as well. A few lines down is the following
> > code:
> > 
> >    sigprocmask(arg1, &set, &oldset);
> > 
> > which in TARGET_NR_sigprocmask would be:
> > 
> >   ret = get_errno(sigprocmask(how, &set, &oldset));
> > 
> > So we end up sending guest masks to the host. Richard, this is Alpha
> > specific code. Mind to double-check?
> 
> I remember fixing this before.  Perhaps it was in a patch tree that 
> never got pulled...
> 
> 
> r~

  reply	other threads:[~2011-06-15 18:41 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 17:35 [PATCH 00/10] qemu: remove set but unused variables Michael S. Tsirkin
2011-06-14 17:35 ` [Qemu-devel] " Michael S. Tsirkin
2011-06-14 17:35 ` [PATCH 01/10] ppce500: move device/vendor/class id to qdev Michael S. Tsirkin
2011-06-14 17:35   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-14 22:42   ` Isaku Yamahata
2011-06-14 22:42     ` [Qemu-devel] " Isaku Yamahata
2011-06-14 17:35 ` [PATCH 02/10] usb-ehci: " Michael S. Tsirkin
2011-06-14 17:35   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-14 17:35 ` [PATCH 03/10] usb-ehci: remove unused variables Michael S. Tsirkin
2011-06-14 17:35   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-15  6:45   ` Gerd Hoffmann
2011-06-15  6:45     ` [Qemu-devel] " Gerd Hoffmann
2011-06-14 17:35 ` [PATCH 04/10] lsi53c895a: " Michael S. Tsirkin
2011-06-14 17:35   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-15  9:23   ` Stefan Hajnoczi
2011-06-15  9:23     ` [Qemu-devel] " Stefan Hajnoczi
2011-06-14 17:35 ` [PATCH 05/10] wdt: " Michael S. Tsirkin
2011-06-14 17:35   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-14 22:47   ` Isaku Yamahata
2011-06-14 22:47     ` [Qemu-devel] " Isaku Yamahata
2011-06-14 17:36 ` [PATCH 06/10] kvm: " Michael S. Tsirkin
2011-06-14 17:36   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-15  7:38   ` Kevin Wolf
2011-06-15  7:38     ` [Qemu-devel] " Kevin Wolf
2011-06-15  8:25     ` Michael S. Tsirkin
2011-06-15  8:25       ` [Qemu-devel] " Michael S. Tsirkin
2011-06-15  8:42       ` Jan Kiszka
2011-06-15  8:42         ` [Qemu-devel] " Jan Kiszka
2011-06-15 12:44   ` Chris Krumme
2011-06-15 12:44     ` Chris Krumme
2011-06-15 18:29     ` Michael S. Tsirkin
2011-06-15 18:29       ` Michael S. Tsirkin
2011-06-14 17:36 ` [PATCH 07/10] alpha/translate: remve " Michael S. Tsirkin
2011-06-14 17:36   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-14 17:47   ` Richard Henderson
2011-06-14 17:47     ` [Qemu-devel] " Richard Henderson
2011-06-14 17:36 ` [PATCH 08/10] alpha: remove unused variable Michael S. Tsirkin
2011-06-14 17:36   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-14 17:47   ` Richard Henderson
2011-06-14 17:47     ` [Qemu-devel] " Richard Henderson
2011-06-23 11:47     ` Peter Maydell
2011-06-23 15:25       ` Richard Henderson
2011-06-14 17:36 ` [PATCH 09/10] exec: " Michael S. Tsirkin
2011-06-14 17:36   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-26 11:08   ` Michael S. Tsirkin
2011-06-26 11:08     ` [Qemu-devel] " Michael S. Tsirkin
2011-06-26 14:32     ` Stefan Hajnoczi
2011-06-26 14:32       ` [Qemu-devel] " Stefan Hajnoczi
2011-06-14 17:36 ` [PATCH 10/10] linux-user: remove unused variables Michael S. Tsirkin
2011-06-14 17:36   ` [Qemu-devel] " Michael S. Tsirkin
2011-06-15  8:35   ` Alexander Graf
2011-06-15  8:35     ` [Qemu-devel] " Alexander Graf
2011-06-15  8:55     ` Michael S. Tsirkin
2011-06-15  8:55       ` [Qemu-devel] " Michael S. Tsirkin
2011-06-15 14:32     ` Richard Henderson
2011-06-15 14:32       ` [Qemu-devel] " Richard Henderson
2011-06-15 18:40       ` Michael S. Tsirkin [this message]
2011-06-15 18:40         ` Michael S. Tsirkin
2011-06-15 23:42       ` Peter Maydell
2011-06-15 16:51     ` Peter Maydell
2011-06-15 16:51       ` Peter Maydell
2011-06-26 11:11   ` Michael S. Tsirkin
2011-06-26 11:11     ` [Qemu-devel] " Michael S. Tsirkin
2011-06-27  9:06     ` Peter Maydell
2011-06-27  9:13       ` Peter Maydell

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=20110615184054.GC7197@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=aurelien@aurel32.net \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=hch@lst.de \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paul@codesourcery.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=rth@twiddle.net \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=weil@mail.berlios.de \
    --cc=yamahata@valinux.co.jp \
    /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.