All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomas Racek <tracek@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
	kvm-devel <kvm@vger.kernel.org>,
	qemu-devel@nongnu.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	linux-kernel@vger.kernel.org,
	Borislav Petkov <borislav.petkov@amd.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH] x86, alternative: fix p6 nops on non-modular kernels
Date: Wed, 22 Aug 2012 06:33:40 -0400 (EDT)	[thread overview]
Message-ID: <1406258973.2560632.1345631620655.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5034AE84.90708@redhat.com>

----- Original Message -----
> On 08/22/2012 12:54 PM, Avi Kivity wrote:
> > On 08/21/2012 12:28 PM, Tomas Racek wrote:
> >> 
> >> http://fi.muni.cz/~xracek/debian2.img.bz2
> >> 
> >> Other things are the same.
> >> 
> >> The runtest.sh sets environment for xfstests and runs test 285
> >> which I wrote and and which should test if FS sends discard
> >> requests only on free sectors:
> >> 285:
> >> 1. Create loop device and FS on it.
> >> 2. Populate it with some garbage.
> >> 3. Get free sectors from FS.
> >> 4. Run fstrim and look for discard requests via blk tracer.
> >> 5. Compare free sectors to discard requests.
> >> 
> >> The test itself can have some issues but I'm pretty sure it
> >> shouldn't crash the system. ;-)
> > 
> > Does the following patch help?
> > 
> 
> It's obvious that it should.  You're running a non-modular kernel,
> and those nops are discarded (probably a leftover from the days
> patching was a boot-only activity), so the kernel patched garbage
> over its own code.
> 

Works fine. Thank you!

Tom


> -------8<----cut-here-----8<-----------------------------------
> 
> From: Avi Kivity <avi@redhat.com>
> Date: Wed, 22 Aug 2012 12:58:18 +0300
> Subject: [PATCH] x86, alternative: fix p6 nops on non-modular kernels
> 
> Probably a leftover from the early days of self-patching, p6nops are
> marked __initconst_or_module, which causes them to be discarded in a
> non-modular kernel.  If something later triggers patching, it will
> overwrite kernel code with garbage.
> 
> Reported-by: Tomas Racek <tracek@redhat.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> 
> diff --git a/arch/x86/kernel/alternative.c
> b/arch/x86/kernel/alternative.c
> index afb7ff7..ced4534 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -165,7 +165,7 @@ static int __init setup_noreplace_paravirt(char
> *str)
>  #endif
>  
>  #ifdef P6_NOP1
> -static const unsigned char  __initconst_or_module p6nops[] =
> +static const unsigned char p6nops[] =
>  {
>  	P6_NOP1,
>  	P6_NOP2,
> 
> 
> --
> error compiling committee.c: too many arguments to function
> 

WARNING: multiple messages have this Message-ID (diff)
From: Tomas Racek <tracek@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>,
	Borislav Petkov <borislav.petkov@amd.com>,
	kvm-devel <kvm@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	Anthony Liguori <anthony@codemonkey.ws>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Alan Cox <alan@linux.intel.com>,
	the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [PATCH] x86, alternative: fix p6 nops on non-modular kernels
Date: Wed, 22 Aug 2012 06:33:40 -0400 (EDT)	[thread overview]
Message-ID: <1406258973.2560632.1345631620655.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5034AE84.90708@redhat.com>

----- Original Message -----
> On 08/22/2012 12:54 PM, Avi Kivity wrote:
> > On 08/21/2012 12:28 PM, Tomas Racek wrote:
> >> 
> >> http://fi.muni.cz/~xracek/debian2.img.bz2
> >> 
> >> Other things are the same.
> >> 
> >> The runtest.sh sets environment for xfstests and runs test 285
> >> which I wrote and and which should test if FS sends discard
> >> requests only on free sectors:
> >> 285:
> >> 1. Create loop device and FS on it.
> >> 2. Populate it with some garbage.
> >> 3. Get free sectors from FS.
> >> 4. Run fstrim and look for discard requests via blk tracer.
> >> 5. Compare free sectors to discard requests.
> >> 
> >> The test itself can have some issues but I'm pretty sure it
> >> shouldn't crash the system. ;-)
> > 
> > Does the following patch help?
> > 
> 
> It's obvious that it should.  You're running a non-modular kernel,
> and those nops are discarded (probably a leftover from the days
> patching was a boot-only activity), so the kernel patched garbage
> over its own code.
> 

Works fine. Thank you!

Tom


> -------8<----cut-here-----8<-----------------------------------
> 
> From: Avi Kivity <avi@redhat.com>
> Date: Wed, 22 Aug 2012 12:58:18 +0300
> Subject: [PATCH] x86, alternative: fix p6 nops on non-modular kernels
> 
> Probably a leftover from the early days of self-patching, p6nops are
> marked __initconst_or_module, which causes them to be discarded in a
> non-modular kernel.  If something later triggers patching, it will
> overwrite kernel code with garbage.
> 
> Reported-by: Tomas Racek <tracek@redhat.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> 
> diff --git a/arch/x86/kernel/alternative.c
> b/arch/x86/kernel/alternative.c
> index afb7ff7..ced4534 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -165,7 +165,7 @@ static int __init setup_noreplace_paravirt(char
> *str)
>  #endif
>  
>  #ifdef P6_NOP1
> -static const unsigned char  __initconst_or_module p6nops[] =
> +static const unsigned char p6nops[] =
>  {
>  	P6_NOP1,
>  	P6_NOP2,
> 
> 
> --
> error compiling committee.c: too many arguments to function
> 

WARNING: multiple messages have this Message-ID (diff)
From: Tomas Racek <tracek@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
	kvm-devel <kvm@vger.kernel.org>,
	qemu-devel@nongnu.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Michael Tokarev <mjt@tls.msk.ru>,
	linux-kernel@vger.kernel.org,
	Borislav Petkov <borislav.petkov@amd.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Alan Cox <alan@linux.intel.com>
Subject: Re: [Qemu-devel] [PATCH] x86, alternative: fix p6 nops on non-modular kernels
Date: Wed, 22 Aug 2012 06:33:40 -0400 (EDT)	[thread overview]
Message-ID: <1406258973.2560632.1345631620655.JavaMail.root@redhat.com> (raw)
In-Reply-To: <5034AE84.90708@redhat.com>

----- Original Message -----
> On 08/22/2012 12:54 PM, Avi Kivity wrote:
> > On 08/21/2012 12:28 PM, Tomas Racek wrote:
> >> 
> >> http://fi.muni.cz/~xracek/debian2.img.bz2
> >> 
> >> Other things are the same.
> >> 
> >> The runtest.sh sets environment for xfstests and runs test 285
> >> which I wrote and and which should test if FS sends discard
> >> requests only on free sectors:
> >> 285:
> >> 1. Create loop device and FS on it.
> >> 2. Populate it with some garbage.
> >> 3. Get free sectors from FS.
> >> 4. Run fstrim and look for discard requests via blk tracer.
> >> 5. Compare free sectors to discard requests.
> >> 
> >> The test itself can have some issues but I'm pretty sure it
> >> shouldn't crash the system. ;-)
> > 
> > Does the following patch help?
> > 
> 
> It's obvious that it should.  You're running a non-modular kernel,
> and those nops are discarded (probably a leftover from the days
> patching was a boot-only activity), so the kernel patched garbage
> over its own code.
> 

Works fine. Thank you!

Tom


> -------8<----cut-here-----8<-----------------------------------
> 
> From: Avi Kivity <avi@redhat.com>
> Date: Wed, 22 Aug 2012 12:58:18 +0300
> Subject: [PATCH] x86, alternative: fix p6 nops on non-modular kernels
> 
> Probably a leftover from the early days of self-patching, p6nops are
> marked __initconst_or_module, which causes them to be discarded in a
> non-modular kernel.  If something later triggers patching, it will
> overwrite kernel code with garbage.
> 
> Reported-by: Tomas Racek <tracek@redhat.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> 
> diff --git a/arch/x86/kernel/alternative.c
> b/arch/x86/kernel/alternative.c
> index afb7ff7..ced4534 100644
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -165,7 +165,7 @@ static int __init setup_noreplace_paravirt(char
> *str)
>  #endif
>  
>  #ifdef P6_NOP1
> -static const unsigned char  __initconst_or_module p6nops[] =
> +static const unsigned char p6nops[] =
>  {
>  	P6_NOP1,
>  	P6_NOP2,
> 
> 
> --
> error compiling committee.c: too many arguments to function
> 

  parent reply	other threads:[~2012-08-22 10:33 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1104118228.1760802.1345121009530.JavaMail.root@redhat.com>
2012-08-16 13:35 ` x86, nops settings result in kernel crash Tomas Racek
2012-08-16 13:35   ` [Qemu-devel] " Tomas Racek
2012-08-16 13:48   ` Borislav Petkov
2012-08-16 13:48     ` [Qemu-devel] " Borislav Petkov
2012-08-16 18:45     ` Tomas Racek
2012-08-16 18:45       ` [Qemu-devel] " Tomas Racek
2012-08-16 18:53       ` Alan Cox
2012-08-16 18:53         ` [Qemu-devel] " Alan Cox
2012-08-16 21:30         ` H. Peter Anvin
2012-08-16 21:30           ` [Qemu-devel] " H. Peter Anvin
2012-08-17  7:42           ` Tomas Racek
2012-08-17  7:42             ` [Qemu-devel] " Tomas Racek
2012-08-16 21:51         ` Anthony Liguori
2012-08-16 21:51           ` [Qemu-devel] " Anthony Liguori
2012-08-16 21:51           ` Anthony Liguori
2012-08-17  7:43           ` Tomas Racek
2012-08-17  7:43             ` [Qemu-devel] " Tomas Racek
2012-08-17  7:43             ` Tomas Racek
2012-08-17  8:09             ` Borislav Petkov
2012-08-17  8:09               ` [Qemu-devel] " Borislav Petkov
2012-08-17  8:09               ` Borislav Petkov
2012-08-20 17:13               ` Tomas Racek
2012-08-20 17:13                 ` [Qemu-devel] " Tomas Racek
2012-08-20 17:13                 ` Tomas Racek
2012-08-21  7:22                 ` Michael Tokarev
2012-08-21  7:22                   ` Michael Tokarev
2012-08-21  9:28                   ` Tomas Racek
2012-08-21  9:28                     ` [Qemu-devel] " Tomas Racek
2012-08-21  9:28                     ` Tomas Racek
2012-08-22  9:54                     ` Avi Kivity
2012-08-22  9:54                       ` [Qemu-devel] " Avi Kivity
2012-08-22  9:54                       ` Avi Kivity
2012-08-22 10:03                       ` [PATCH] x86, alternative: fix p6 nops on non-modular kernels Avi Kivity
2012-08-22 10:03                         ` [Qemu-devel] " Avi Kivity
2012-08-22 10:21                         ` [tip:x86/urgent] x86/alternatives: Fix " tip-bot for Avi Kivity
2012-08-22 10:33                         ` Tomas Racek [this message]
2012-08-22 10:33                           ` [Qemu-devel] [PATCH] x86, alternative: fix " Tomas Racek
2012-08-22 10:33                           ` Tomas Racek

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=1406258973.2560632.1345631620655.JavaMail.root@redhat.com \
    --to=tracek@redhat.com \
    --cc=alan@linux.intel.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=borislav.petkov@amd.com \
    --cc=hpa@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=x86@kernel.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 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.