2006-12-07 08:14:07 +07:00
|
|
|
/* Paravirtualization interfaces
|
|
|
|
Copyright (C) 2006 Rusty Russell IBM Corporation
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2008-01-30 19:32:04 +07:00
|
|
|
|
|
|
|
2007 - x86_64 support added by Glauber de Oliveira Costa, Red Hat Inc
|
2006-12-07 08:14:07 +07:00
|
|
|
*/
|
2008-01-30 19:32:04 +07:00
|
|
|
|
2006-12-07 08:14:07 +07:00
|
|
|
#include <linux/errno.h>
|
2016-07-14 07:18:56 +07:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/export.h>
|
2006-12-07 08:14:07 +07:00
|
|
|
#include <linux/efi.h>
|
|
|
|
#include <linux/bcd.h>
|
2007-05-03 00:27:15 +07:00
|
|
|
#include <linux/highmem.h>
|
2014-04-17 15:17:05 +07:00
|
|
|
#include <linux/kprobes.h>
|
2006-12-07 08:14:07 +07:00
|
|
|
|
|
|
|
#include <asm/bug.h>
|
|
|
|
#include <asm/paravirt.h>
|
2012-01-21 06:35:53 +07:00
|
|
|
#include <asm/debugreg.h>
|
2006-12-07 08:14:07 +07:00
|
|
|
#include <asm/desc.h>
|
|
|
|
#include <asm/setup.h>
|
2008-07-09 05:06:23 +07:00
|
|
|
#include <asm/pgtable.h>
|
2006-12-07 08:14:07 +07:00
|
|
|
#include <asm/time.h>
|
2008-06-25 11:19:12 +07:00
|
|
|
#include <asm/pgalloc.h>
|
2006-12-07 08:14:07 +07:00
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/delay.h>
|
2006-12-07 08:14:08 +07:00
|
|
|
#include <asm/fixmap.h>
|
|
|
|
#include <asm/apic.h>
|
2006-12-07 08:14:08 +07:00
|
|
|
#include <asm/tlbflush.h>
|
2007-03-05 15:30:35 +07:00
|
|
|
#include <asm/timer.h>
|
2012-03-29 00:11:12 +07:00
|
|
|
#include <asm/special_insns.h>
|
2006-12-07 08:14:07 +07:00
|
|
|
|
x86/paravirt: Replace the paravirt nop with a bona fide empty function
PARAVIRT_ADJUST_EXCEPTION_FRAME generates this code (using nmi as an
example, trimmed for readability):
ff 15 00 00 00 00 callq *0x0(%rip) # 2796 <nmi+0x6>
2792: R_X86_64_PC32 pv_irq_ops+0x2c
That's a call through a function pointer to regular C function that
does nothing on native boots, but that function isn't protected
against kprobes, isn't marked notrace, and is certainly not
guaranteed to preserve any registers if the compiler is feeling
perverse. This is bad news for a CLBR_NONE operation.
Of course, if everything works correctly, once paravirt ops are
patched, it gets nopped out, but what if we hit this code before
paravirt ops are patched in? This can potentially cause breakage
that is very difficult to debug.
A more subtle failure is possible here, too: if _paravirt_nop uses
the stack at all (even just to push RBP), it will overwrite the "NMI
executing" variable if it's called in the NMI prologue.
The Xen case, perhaps surprisingly, is fine, because it's already
written in asm.
Fix all of the cases that default to paravirt_nop (including
adjust_exception_frame) with a big hammer: replace paravirt_nop with
an asm function that is just a ret instruction.
The Xen case may have other problems, so document them.
This is part of a fix for some random crashes that Sasha saw.
Reported-and-tested-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/8f5d2ba295f9d73751c33d97fda03e0495d9ade0.1442791737.git.luto@kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2015-09-21 06:32:04 +07:00
|
|
|
/*
|
|
|
|
* nop stub, which must not clobber anything *including the stack* to
|
|
|
|
* avoid confusing the entry prologues.
|
|
|
|
*/
|
|
|
|
extern void _paravirt_nop(void);
|
|
|
|
asm (".pushsection .entry.text, \"ax\"\n"
|
|
|
|
".global _paravirt_nop\n"
|
|
|
|
"_paravirt_nop:\n\t"
|
|
|
|
"ret\n\t"
|
|
|
|
".size _paravirt_nop, . - _paravirt_nop\n\t"
|
|
|
|
".type _paravirt_nop, @function\n\t"
|
|
|
|
".popsection");
|
2006-12-07 08:14:07 +07:00
|
|
|
|
2009-01-29 05:35:02 +07:00
|
|
|
/* identity function, which can be inlined */
|
2016-05-26 00:47:26 +07:00
|
|
|
u32 notrace _paravirt_ident_32(u32 x)
|
2009-01-29 05:35:02 +07:00
|
|
|
{
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2016-05-26 00:47:26 +07:00
|
|
|
u64 notrace _paravirt_ident_64(u64 x)
|
2009-01-29 05:35:02 +07:00
|
|
|
{
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2009-08-20 18:19:57 +07:00
|
|
|
void __init default_banner(void)
|
2006-12-07 08:14:07 +07:00
|
|
|
{
|
|
|
|
printk(KERN_INFO "Booting paravirtualized kernel on %s\n",
|
2007-10-17 01:51:29 +07:00
|
|
|
pv_info.name);
|
2006-12-07 08:14:07 +07:00
|
|
|
}
|
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
/* Undefined instruction for dealing with missing ops pointers. */
|
|
|
|
static const unsigned char ud2a[] = { 0x0f, 0x0b };
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2007-07-22 16:12:31 +07:00
|
|
|
struct branch {
|
|
|
|
unsigned char opcode;
|
|
|
|
u32 delta;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
2007-08-11 03:31:03 +07:00
|
|
|
unsigned paravirt_patch_call(void *insnbuf,
|
|
|
|
const void *target, u16 tgt_clobbers,
|
|
|
|
unsigned long addr, u16 site_clobbers,
|
2007-05-03 00:27:14 +07:00
|
|
|
unsigned len)
|
|
|
|
{
|
2007-08-11 03:31:03 +07:00
|
|
|
struct branch *b = insnbuf;
|
|
|
|
unsigned long delta = (unsigned long)target - (addr+5);
|
2007-05-03 00:27:14 +07:00
|
|
|
|
|
|
|
if (tgt_clobbers & ~site_clobbers)
|
|
|
|
return len; /* target would clobber too much for this site */
|
|
|
|
if (len < 5)
|
|
|
|
return len; /* call too long for patch site */
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2007-08-11 03:31:03 +07:00
|
|
|
b->opcode = 0xe8; /* call */
|
|
|
|
b->delta = delta;
|
|
|
|
BUILD_BUG_ON(sizeof(*b) != 5);
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2007-05-03 00:27:14 +07:00
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
unsigned paravirt_patch_jmp(void *insnbuf, const void *target,
|
2007-08-11 03:31:03 +07:00
|
|
|
unsigned long addr, unsigned len)
|
2007-05-03 00:27:14 +07:00
|
|
|
{
|
2007-08-11 03:31:03 +07:00
|
|
|
struct branch *b = insnbuf;
|
|
|
|
unsigned long delta = (unsigned long)target - (addr+5);
|
2007-05-03 00:27:14 +07:00
|
|
|
|
|
|
|
if (len < 5)
|
|
|
|
return len; /* call too long for patch site */
|
|
|
|
|
2007-08-11 03:31:03 +07:00
|
|
|
b->opcode = 0xe9; /* jmp */
|
|
|
|
b->delta = delta;
|
2007-05-03 00:27:14 +07:00
|
|
|
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
/* Neat trick to map patch type back to the call within the
|
|
|
|
* corresponding structure. */
|
|
|
|
static void *get_call_destination(u8 type)
|
|
|
|
{
|
|
|
|
struct paravirt_patch_template tmpl = {
|
|
|
|
.pv_init_ops = pv_init_ops,
|
|
|
|
.pv_time_ops = pv_time_ops,
|
|
|
|
.pv_cpu_ops = pv_cpu_ops,
|
|
|
|
.pv_irq_ops = pv_irq_ops,
|
|
|
|
.pv_mmu_ops = pv_mmu_ops,
|
x86: Fix performance regression caused by paravirt_ops on native kernels
Xiaohui Xin and some other folks at Intel have been looking into what's
behind the performance hit of paravirt_ops when running native.
It appears that the hit is entirely due to the paravirtualized
spinlocks introduced by:
| commit 8efcbab674de2bee45a2e4cdf97de16b8e609ac8
| Date: Mon Jul 7 12:07:51 2008 -0700
|
| paravirt: introduce a "lock-byte" spinlock implementation
The extra call/return in the spinlock path is somehow
causing an increase in the cycles/instruction of somewhere around 2-7%
(seems to vary quite a lot from test to test). The working theory is
that the CPU's pipeline is getting upset about the
call->call->locked-op->return->return, and seems to be failing to
speculate (though I haven't seen anything definitive about the precise
reasons). This doesn't entirely make sense, because the performance
hit is also visible on unlock and other operations which don't involve
locked instructions. But spinlock operations clearly swamp all the
other pvops operations, even though I can't imagine that they're
nearly as common (there's only a .05% increase in instructions
executed).
If I disable just the pv-spinlock calls, my tests show that pvops is
identical to non-pvops performance on native (my measurements show that
it is actually about .1% faster, but Xiaohui shows a .05% slowdown).
Summary of results, averaging 10 runs of the "mmperf" test, using a
no-pvops build as baseline:
nopv Pv-nospin Pv-spin
CPU cycles 100.00% 99.89% 102.18%
instructions 100.00% 100.10% 100.15%
CPI 100.00% 99.79% 102.03%
cache ref 100.00% 100.84% 100.28%
cache miss 100.00% 90.47% 88.56%
cache miss rate 100.00% 89.72% 88.31%
branches 100.00% 99.93% 100.04%
branch miss 100.00% 103.66% 107.72%
branch miss rt 100.00% 103.73% 107.67%
wallclock 100.00% 99.90% 102.20%
The clear effect here is that the 2% increase in CPI is
directly reflected in the final wallclock time.
(The other interesting effect is that the more ops are
out of line calls via pvops, the lower the cache access
and miss rates. Not too surprising, but it suggests that
the non-pvops kernel is over-inlined. On the flipside,
the branch misses go up correspondingly...)
So, what's the fix?
Paravirt patching turns all the pvops calls into direct calls, so
_spin_lock etc do end up having direct calls. For example, the compiler
generated code for paravirtualized _spin_lock is:
<_spin_lock+0>: mov %gs:0xb4c8,%rax
<_spin_lock+9>: incl 0xffffffffffffe044(%rax)
<_spin_lock+15>: callq *0xffffffff805a5b30
<_spin_lock+22>: retq
The indirect call will get patched to:
<_spin_lock+0>: mov %gs:0xb4c8,%rax
<_spin_lock+9>: incl 0xffffffffffffe044(%rax)
<_spin_lock+15>: callq <__ticket_spin_lock>
<_spin_lock+20>: nop; nop /* or whatever 2-byte nop */
<_spin_lock+22>: retq
One possibility is to inline _spin_lock, etc, when building an
optimised kernel (ie, when there's no spinlock/preempt
instrumentation/debugging enabled). That will remove the outer
call/return pair, returning the instruction stream to a single
call/return, which will presumably execute the same as the non-pvops
case. The downsides arel 1) it will replicate the
preempt_disable/enable code at eack lock/unlock callsite; this code is
fairly small, but not nothing; and 2) the spinlock definitions are
already a very heavily tangled mass of #ifdefs and other preprocessor
magic, and making any changes will be non-trivial.
The other obvious answer is to disable pv-spinlocks. Making them a
separate config option is fairly easy, and it would be trivial to
enable them only when Xen is enabled (as the only non-default user).
But it doesn't really address the common case of a distro build which
is going to have Xen support enabled, and leaves the open question of
whether the native performance cost of pv-spinlocks is worth the
performance improvement on a loaded Xen system (10% saving of overall
system CPU when guests block rather than spin). Still it is a
reasonable short-term workaround.
[ Impact: fix pvops performance regression when running native ]
Analysed-by: "Xin Xiaohui" <xiaohui.xin@intel.com>
Analysed-by: "Li Xin" <xin.li@intel.com>
Analysed-by: "Nakajima Jun" <jun.nakajima@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Xen-devel <xen-devel@lists.xensource.com>
LKML-Reference: <4A0B62F7.5030802@goop.org>
[ fixed the help text ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-05-14 07:16:55 +07:00
|
|
|
#ifdef CONFIG_PARAVIRT_SPINLOCKS
|
x86/paravirt: add hooks for spinlock operations
Ticket spinlocks have absolutely ghastly worst-case performance
characteristics in a virtual environment. If there is any contention
for physical CPUs (ie, there are more runnable vcpus than cpus), then
ticket locks can cause the system to end up spending 90+% of its time
spinning.
The problem is that (v)cpus waiting on a ticket spinlock will be
granted access to the lock in strict order they got their tickets. If
the hypervisor scheduler doesn't give the vcpus time in that order,
they will burn timeslices waiting for the scheduler to give the right
vcpu some time. In the worst case it could take O(n^2) vcpu scheduler
timeslices for everyone waiting on the lock to get it, not counting
new cpus trying to take the lock while the log-jam is sorted out.
These hooks allow a paravirt backend to replace the spinlock
implementation.
At the very least, this could revert the implementation back to the
old lock algorithm, which allows the next scheduled vcpu to take the
lock, and has basically fairly good performance.
It also allows the spinlocks to take advantages of the hypervisor
features to make locks more efficient (spin and block, for example).
The cost to native execution is an extra direct call when using a
spinlock function. There's no overhead if CONFIG_PARAVIRT is turned
off.
The lock structure is fixed at a single "unsigned int", initialized to
zero, but the spinlock implementation can use it as it wishes.
Thanks to Thomas Friebel's Xen Summit talk "Preventing Guests from
Spinning Around" for pointing out this problem.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Christoph Lameter <clameter@linux-foundation.org>
Cc: Petr Tesarik <ptesarik@suse.cz>
Cc: Virtualization <virtualization@lists.linux-foundation.org>
Cc: Xen devel <xen-devel@lists.xensource.com>
Cc: Thomas Friebel <thomas.friebel@amd.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-08 02:07:50 +07:00
|
|
|
.pv_lock_ops = pv_lock_ops,
|
x86: Fix performance regression caused by paravirt_ops on native kernels
Xiaohui Xin and some other folks at Intel have been looking into what's
behind the performance hit of paravirt_ops when running native.
It appears that the hit is entirely due to the paravirtualized
spinlocks introduced by:
| commit 8efcbab674de2bee45a2e4cdf97de16b8e609ac8
| Date: Mon Jul 7 12:07:51 2008 -0700
|
| paravirt: introduce a "lock-byte" spinlock implementation
The extra call/return in the spinlock path is somehow
causing an increase in the cycles/instruction of somewhere around 2-7%
(seems to vary quite a lot from test to test). The working theory is
that the CPU's pipeline is getting upset about the
call->call->locked-op->return->return, and seems to be failing to
speculate (though I haven't seen anything definitive about the precise
reasons). This doesn't entirely make sense, because the performance
hit is also visible on unlock and other operations which don't involve
locked instructions. But spinlock operations clearly swamp all the
other pvops operations, even though I can't imagine that they're
nearly as common (there's only a .05% increase in instructions
executed).
If I disable just the pv-spinlock calls, my tests show that pvops is
identical to non-pvops performance on native (my measurements show that
it is actually about .1% faster, but Xiaohui shows a .05% slowdown).
Summary of results, averaging 10 runs of the "mmperf" test, using a
no-pvops build as baseline:
nopv Pv-nospin Pv-spin
CPU cycles 100.00% 99.89% 102.18%
instructions 100.00% 100.10% 100.15%
CPI 100.00% 99.79% 102.03%
cache ref 100.00% 100.84% 100.28%
cache miss 100.00% 90.47% 88.56%
cache miss rate 100.00% 89.72% 88.31%
branches 100.00% 99.93% 100.04%
branch miss 100.00% 103.66% 107.72%
branch miss rt 100.00% 103.73% 107.67%
wallclock 100.00% 99.90% 102.20%
The clear effect here is that the 2% increase in CPI is
directly reflected in the final wallclock time.
(The other interesting effect is that the more ops are
out of line calls via pvops, the lower the cache access
and miss rates. Not too surprising, but it suggests that
the non-pvops kernel is over-inlined. On the flipside,
the branch misses go up correspondingly...)
So, what's the fix?
Paravirt patching turns all the pvops calls into direct calls, so
_spin_lock etc do end up having direct calls. For example, the compiler
generated code for paravirtualized _spin_lock is:
<_spin_lock+0>: mov %gs:0xb4c8,%rax
<_spin_lock+9>: incl 0xffffffffffffe044(%rax)
<_spin_lock+15>: callq *0xffffffff805a5b30
<_spin_lock+22>: retq
The indirect call will get patched to:
<_spin_lock+0>: mov %gs:0xb4c8,%rax
<_spin_lock+9>: incl 0xffffffffffffe044(%rax)
<_spin_lock+15>: callq <__ticket_spin_lock>
<_spin_lock+20>: nop; nop /* or whatever 2-byte nop */
<_spin_lock+22>: retq
One possibility is to inline _spin_lock, etc, when building an
optimised kernel (ie, when there's no spinlock/preempt
instrumentation/debugging enabled). That will remove the outer
call/return pair, returning the instruction stream to a single
call/return, which will presumably execute the same as the non-pvops
case. The downsides arel 1) it will replicate the
preempt_disable/enable code at eack lock/unlock callsite; this code is
fairly small, but not nothing; and 2) the spinlock definitions are
already a very heavily tangled mass of #ifdefs and other preprocessor
magic, and making any changes will be non-trivial.
The other obvious answer is to disable pv-spinlocks. Making them a
separate config option is fairly easy, and it would be trivial to
enable them only when Xen is enabled (as the only non-default user).
But it doesn't really address the common case of a distro build which
is going to have Xen support enabled, and leaves the open question of
whether the native performance cost of pv-spinlocks is worth the
performance improvement on a loaded Xen system (10% saving of overall
system CPU when guests block rather than spin). Still it is a
reasonable short-term workaround.
[ Impact: fix pvops performance regression when running native ]
Analysed-by: "Xin Xiaohui" <xiaohui.xin@intel.com>
Analysed-by: "Li Xin" <xin.li@intel.com>
Analysed-by: "Nakajima Jun" <jun.nakajima@intel.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Xen-devel <xen-devel@lists.xensource.com>
LKML-Reference: <4A0B62F7.5030802@goop.org>
[ fixed the help text ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-05-14 07:16:55 +07:00
|
|
|
#endif
|
2007-10-17 01:51:29 +07:00
|
|
|
};
|
|
|
|
return *((void **)&tmpl + type);
|
|
|
|
}
|
|
|
|
|
2007-08-11 03:31:03 +07:00
|
|
|
unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
|
|
|
|
unsigned long addr, unsigned len)
|
2007-05-03 00:27:14 +07:00
|
|
|
{
|
2007-10-17 01:51:29 +07:00
|
|
|
void *opfunc = get_call_destination(type);
|
2007-05-03 00:27:14 +07:00
|
|
|
unsigned ret;
|
|
|
|
|
|
|
|
if (opfunc == NULL)
|
|
|
|
/* If there's no function, patch it with a ud2a (BUG) */
|
2007-10-17 01:51:29 +07:00
|
|
|
ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
|
2009-01-29 05:35:02 +07:00
|
|
|
else if (opfunc == _paravirt_nop)
|
2015-11-03 16:18:49 +07:00
|
|
|
ret = 0;
|
2009-01-29 05:35:02 +07:00
|
|
|
|
|
|
|
/* identity functions just return their single argument */
|
|
|
|
else if (opfunc == _paravirt_ident_32)
|
|
|
|
ret = paravirt_patch_ident_32(insnbuf, len);
|
|
|
|
else if (opfunc == _paravirt_ident_64)
|
|
|
|
ret = paravirt_patch_ident_64(insnbuf, len);
|
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) ||
|
2008-06-25 11:19:28 +07:00
|
|
|
type == PARAVIRT_PATCH(pv_cpu_ops.usergs_sysret64))
|
2007-05-03 00:27:14 +07:00
|
|
|
/* If operation requires a jmp, then jmp */
|
2007-10-17 01:51:29 +07:00
|
|
|
ret = paravirt_patch_jmp(insnbuf, opfunc, addr, len);
|
2007-05-03 00:27:14 +07:00
|
|
|
else
|
|
|
|
/* Otherwise call the function; assume target could
|
|
|
|
clobber any caller-save reg */
|
2007-08-11 03:31:03 +07:00
|
|
|
ret = paravirt_patch_call(insnbuf, opfunc, CLBR_ANY,
|
|
|
|
addr, clobbers, len);
|
2007-05-03 00:27:14 +07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2007-08-11 03:31:03 +07:00
|
|
|
unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
|
2007-05-03 00:27:14 +07:00
|
|
|
const char *start, const char *end)
|
|
|
|
{
|
|
|
|
unsigned insn_len = end - start;
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2007-05-03 00:27:14 +07:00
|
|
|
if (insn_len > len || start == NULL)
|
|
|
|
insn_len = len;
|
|
|
|
else
|
2007-08-11 03:31:03 +07:00
|
|
|
memcpy(insnbuf, start, insn_len);
|
2006-12-07 08:14:08 +07:00
|
|
|
|
|
|
|
return insn_len;
|
|
|
|
}
|
|
|
|
|
2007-02-13 19:26:25 +07:00
|
|
|
static void native_flush_tlb(void)
|
2006-12-07 08:14:08 +07:00
|
|
|
{
|
|
|
|
__native_flush_tlb();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Global pages have to be flushed a bit differently. Not a real
|
|
|
|
* performance problem because this does not happen often.
|
|
|
|
*/
|
2007-02-13 19:26:25 +07:00
|
|
|
static void native_flush_tlb_global(void)
|
2006-12-07 08:14:08 +07:00
|
|
|
{
|
|
|
|
__native_flush_tlb_global();
|
|
|
|
}
|
|
|
|
|
2007-05-03 00:27:14 +07:00
|
|
|
static void native_flush_tlb_single(unsigned long addr)
|
2006-12-07 08:14:08 +07:00
|
|
|
{
|
|
|
|
__native_flush_tlb_single(addr);
|
|
|
|
}
|
|
|
|
|
2012-02-24 14:31:31 +07:00
|
|
|
struct static_key paravirt_steal_enabled;
|
|
|
|
struct static_key paravirt_steal_rq_enabled;
|
2011-07-12 02:28:15 +07:00
|
|
|
|
|
|
|
static u64 native_steal_clock(int cpu)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-12-07 08:14:07 +07:00
|
|
|
/* These are in entry.S */
|
2007-02-13 19:26:25 +07:00
|
|
|
extern void native_iret(void);
|
2008-06-25 11:19:28 +07:00
|
|
|
extern void native_usergs_sysret64(void);
|
2006-12-07 08:14:07 +07:00
|
|
|
|
2007-07-18 08:37:04 +07:00
|
|
|
static struct resource reserve_ioports = {
|
|
|
|
.start = 0,
|
|
|
|
.end = IO_SPACE_LIMIT,
|
|
|
|
.name = "paravirt-ioport",
|
|
|
|
.flags = IORESOURCE_IO | IORESOURCE_BUSY,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reserve the whole legacy IO space to prevent any legacy drivers
|
|
|
|
* from wasting time probing for their hardware. This is a fairly
|
|
|
|
* brute-force approach to disabling all non-virtual drivers.
|
|
|
|
*
|
|
|
|
* Note that this must be called very early to have any effect.
|
|
|
|
*/
|
|
|
|
int paravirt_disable_iospace(void)
|
|
|
|
{
|
2008-03-28 07:28:40 +07:00
|
|
|
return request_resource(&ioport_resource, &reserve_ioports);
|
2007-07-18 08:37:04 +07:00
|
|
|
}
|
|
|
|
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LAZY_NONE;
|
|
|
|
|
|
|
|
static inline void enter_lazy(enum paravirt_lazy_mode mode)
|
|
|
|
{
|
2012-05-11 14:35:27 +07:00
|
|
|
BUG_ON(this_cpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
|
2012-05-11 14:35:27 +07:00
|
|
|
this_cpu_write(paravirt_lazy_mode, mode);
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
}
|
|
|
|
|
2009-02-18 14:46:21 +07:00
|
|
|
static void leave_lazy(enum paravirt_lazy_mode mode)
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
{
|
2012-05-11 14:35:27 +07:00
|
|
|
BUG_ON(this_cpu_read(paravirt_lazy_mode) != mode);
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
|
2012-05-11 14:35:27 +07:00
|
|
|
this_cpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
void paravirt_enter_lazy_mmu(void)
|
|
|
|
{
|
|
|
|
enter_lazy(PARAVIRT_LAZY_MMU);
|
|
|
|
}
|
|
|
|
|
|
|
|
void paravirt_leave_lazy_mmu(void)
|
|
|
|
{
|
2009-02-18 14:46:21 +07:00
|
|
|
leave_lazy(PARAVIRT_LAZY_MMU);
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
}
|
|
|
|
|
2013-03-23 20:36:36 +07:00
|
|
|
void paravirt_flush_lazy_mmu(void)
|
|
|
|
{
|
|
|
|
preempt_disable();
|
|
|
|
|
|
|
|
if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
|
|
|
|
arch_leave_lazy_mmu_mode();
|
|
|
|
arch_enter_lazy_mmu_mode();
|
|
|
|
}
|
|
|
|
|
|
|
|
preempt_enable();
|
|
|
|
}
|
|
|
|
|
2009-02-19 02:18:57 +07:00
|
|
|
void paravirt_start_context_switch(struct task_struct *prev)
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
{
|
2009-02-18 14:53:19 +07:00
|
|
|
BUG_ON(preemptible());
|
|
|
|
|
2012-05-11 14:35:27 +07:00
|
|
|
if (this_cpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
|
2009-02-18 14:46:21 +07:00
|
|
|
arch_leave_lazy_mmu_mode();
|
2009-02-19 02:18:57 +07:00
|
|
|
set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
|
2009-02-18 14:46:21 +07:00
|
|
|
}
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
enter_lazy(PARAVIRT_LAZY_CPU);
|
|
|
|
}
|
|
|
|
|
2009-02-19 02:18:57 +07:00
|
|
|
void paravirt_end_context_switch(struct task_struct *next)
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
{
|
2009-02-18 14:53:19 +07:00
|
|
|
BUG_ON(preemptible());
|
|
|
|
|
2009-02-18 14:46:21 +07:00
|
|
|
leave_lazy(PARAVIRT_LAZY_CPU);
|
|
|
|
|
2009-02-19 02:18:57 +07:00
|
|
|
if (test_and_clear_ti_thread_flag(task_thread_info(next), TIF_LAZY_MMU_UPDATES))
|
2009-02-18 14:46:21 +07:00
|
|
|
arch_enter_lazy_mmu_mode();
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
|
|
|
|
{
|
2009-02-18 14:05:19 +07:00
|
|
|
if (in_interrupt())
|
|
|
|
return PARAVIRT_LAZY_NONE;
|
|
|
|
|
2012-05-11 14:35:27 +07:00
|
|
|
return this_cpu_read(paravirt_lazy_mode);
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
}
|
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
struct pv_info pv_info = {
|
2006-12-07 08:14:07 +07:00
|
|
|
.name = "bare hardware",
|
|
|
|
.kernel_rpl = 0,
|
[PATCH] i386: PARAVIRT: Allow paravirt backend to choose kernel PMD sharing
Normally when running in PAE mode, the 4th PMD maps the kernel address space,
which can be shared among all processes (since they all need the same kernel
mappings).
Xen, however, does not allow guests to have the kernel pmd shared between page
tables, so parameterize pgtable.c to allow both modes of operation.
There are several side-effects of this. One is that vmalloc will update the
kernel address space mappings, and those updates need to be propagated into
all processes if the kernel mappings are not intrinsically shared. In the
non-PAE case, this is done by maintaining a pgd_list of all processes; this
list is used when all process pagetables must be updated. pgd_list is
threaded via otherwise unused entries in the page structure for the pgd, which
means that the pgd must be page-sized for this to work.
Normally the PAE pgd is only 4x64 byte entries large, but Xen requires the PAE
pgd to page aligned anyway, so this patch forces the pgd to be page
aligned+sized when the kernel pmd is unshared, to accomodate both these
requirements.
Also, since there may be several distinct kernel pmds (if the user/kernel
split is below 3G), there's no point in allocating them from a slab cache;
they're just allocated with get_free_page and initialized appropriately. (Of
course the could be cached if there is just a single kernel pmd - which is the
default with a 3G user/kernel split - but it doesn't seem worthwhile to add
yet another case into this code).
[ Many thanks to wli for review comments. ]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: William Lee Irwin III <wli@holomorphy.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Christoph Lameter <clameter@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2007-05-03 00:27:13 +07:00
|
|
|
.shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */
|
2011-08-03 20:31:53 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
.extra_user_64bit_cs = __USER_CS,
|
|
|
|
#endif
|
2007-10-17 01:51:29 +07:00
|
|
|
};
|
2006-12-07 08:14:07 +07:00
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
struct pv_init_ops pv_init_ops = {
|
|
|
|
.patch = native_patch,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pv_time_ops pv_time_ops = {
|
|
|
|
.sched_clock = native_sched_clock,
|
2011-07-12 02:28:15 +07:00
|
|
|
.steal_clock = native_steal_clock,
|
2007-10-17 01:51:29 +07:00
|
|
|
};
|
|
|
|
|
2013-08-06 05:02:46 +07:00
|
|
|
__visible struct pv_irq_ops pv_irq_ops = {
|
x86/paravirt: add register-saving thunks to reduce caller register pressure
Impact: Optimization
One of the problems with inserting a pile of C calls where previously
there were none is that the register pressure is greatly increased.
The C calling convention says that the caller must expect a certain
set of registers may be trashed by the callee, and that the callee can
use those registers without restriction. This includes the function
argument registers, and several others.
This patch seeks to alleviate this pressure by introducing wrapper
thunks that will do the register saving/restoring, so that the
callsite doesn't need to worry about it, but the callee function can
be conventional compiler-generated code. In many cases (particularly
performance-sensitive cases) the callee will be in assembler anyway,
and need not use the compiler's calling convention.
Standard calling convention is:
arguments return scratch
x86-32 eax edx ecx eax ?
x86-64 rdi rsi rdx rcx rax r8 r9 r10 r11
The thunk preserves all argument and scratch registers. The return
register is not preserved, and is available as a scratch register for
unwrapped callee code (and of course the return value).
Wrapped function pointers are themselves wrapped in a struct
paravirt_callee_save structure, in order to get some warning from the
compiler when functions with mismatched calling conventions are used.
The most common paravirt ops, both statically and dynamically, are
interrupt enable/disable/save/restore, so handle them first. This is
particularly easy since their calls are handled specially anyway.
XXX Deal with VMI. What's their calling convention?
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2009-01-29 05:35:05 +07:00
|
|
|
.save_fl = __PV_IS_CALLEE_SAVE(native_save_fl),
|
|
|
|
.restore_fl = __PV_IS_CALLEE_SAVE(native_restore_fl),
|
|
|
|
.irq_disable = __PV_IS_CALLEE_SAVE(native_irq_disable),
|
|
|
|
.irq_enable = __PV_IS_CALLEE_SAVE(native_irq_enable),
|
2007-10-17 01:51:29 +07:00
|
|
|
.safe_halt = native_safe_halt,
|
|
|
|
.halt = native_halt,
|
2008-06-25 11:19:31 +07:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
.adjust_exception_frame = paravirt_nop,
|
|
|
|
#endif
|
2007-10-17 01:51:29 +07:00
|
|
|
};
|
2006-12-07 08:14:07 +07:00
|
|
|
|
2013-08-06 05:02:46 +07:00
|
|
|
__visible struct pv_cpu_ops pv_cpu_ops = {
|
2006-12-07 08:14:07 +07:00
|
|
|
.cpuid = native_cpuid,
|
|
|
|
.get_debugreg = native_get_debugreg,
|
|
|
|
.set_debugreg = native_set_debugreg,
|
|
|
|
.read_cr0 = native_read_cr0,
|
|
|
|
.write_cr0 = native_write_cr0,
|
|
|
|
.read_cr4 = native_read_cr4,
|
|
|
|
.write_cr4 = native_write_cr4,
|
2008-01-30 19:33:19 +07:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
.read_cr8 = native_read_cr8,
|
|
|
|
.write_cr8 = native_write_cr8,
|
|
|
|
#endif
|
2006-12-07 08:14:07 +07:00
|
|
|
.wbinvd = native_wbinvd,
|
2016-04-02 21:01:38 +07:00
|
|
|
.read_msr = native_read_msr,
|
|
|
|
.write_msr = native_write_msr,
|
2016-04-02 21:01:36 +07:00
|
|
|
.read_msr_safe = native_read_msr_safe,
|
|
|
|
.write_msr_safe = native_write_msr_safe,
|
2006-12-07 08:14:07 +07:00
|
|
|
.read_pmc = native_read_pmc,
|
|
|
|
.load_tr_desc = native_load_tr_desc,
|
|
|
|
.set_ldt = native_set_ldt,
|
|
|
|
.load_gdt = native_load_gdt,
|
|
|
|
.load_idt = native_load_idt,
|
|
|
|
.store_idt = native_store_idt,
|
|
|
|
.store_tr = native_store_tr,
|
|
|
|
.load_tls = native_load_tls,
|
2008-06-25 11:19:32 +07:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
.load_gs_index = native_load_gs_index,
|
|
|
|
#endif
|
2008-01-30 19:31:13 +07:00
|
|
|
.write_ldt_entry = native_write_ldt_entry,
|
2008-01-30 19:31:13 +07:00
|
|
|
.write_gdt_entry = native_write_gdt_entry,
|
2008-01-30 19:31:12 +07:00
|
|
|
.write_idt_entry = native_write_idt_entry,
|
2008-07-24 04:21:18 +07:00
|
|
|
|
|
|
|
.alloc_ldt = paravirt_nop,
|
|
|
|
.free_ldt = paravirt_nop,
|
|
|
|
|
2008-01-30 19:31:02 +07:00
|
|
|
.load_sp0 = native_load_sp0,
|
2006-12-07 08:14:07 +07:00
|
|
|
|
2008-06-25 11:19:28 +07:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
.usergs_sysret64 = native_usergs_sysret64,
|
2008-06-25 11:19:26 +07:00
|
|
|
#endif
|
2007-10-17 01:51:29 +07:00
|
|
|
.iret = native_iret,
|
2008-01-30 19:32:08 +07:00
|
|
|
.swapgs = native_swapgs,
|
2007-10-17 01:51:29 +07:00
|
|
|
|
2006-12-07 08:14:07 +07:00
|
|
|
.set_iopl_mask = native_set_iopl_mask,
|
|
|
|
.io_delay = native_io_delay,
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
|
2009-02-19 02:18:57 +07:00
|
|
|
.start_context_switch = paravirt_nop,
|
|
|
|
.end_context_switch = paravirt_nop,
|
2007-10-17 01:51:29 +07:00
|
|
|
};
|
2006-12-07 08:14:07 +07:00
|
|
|
|
2014-04-17 15:17:19 +07:00
|
|
|
/* At this point, native_get/set_debugreg has real function entries */
|
2014-04-17 15:17:05 +07:00
|
|
|
NOKPROBE_SYMBOL(native_get_debugreg);
|
2014-04-17 15:17:19 +07:00
|
|
|
NOKPROBE_SYMBOL(native_set_debugreg);
|
|
|
|
NOKPROBE_SYMBOL(native_load_idt);
|
2014-04-17 15:17:05 +07:00
|
|
|
|
2009-01-29 05:35:02 +07:00
|
|
|
#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
|
|
|
|
/* 32-bit pagetable entries */
|
2009-01-29 05:35:07 +07:00
|
|
|
#define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_32)
|
2009-01-29 05:35:02 +07:00
|
|
|
#else
|
|
|
|
/* 64-bit pagetable entries */
|
2009-01-29 05:35:07 +07:00
|
|
|
#define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_64)
|
2009-01-29 05:35:02 +07:00
|
|
|
#endif
|
|
|
|
|
2016-08-09 06:29:06 +07:00
|
|
|
struct pv_mmu_ops pv_mmu_ops __ro_after_init = {
|
[PATCH] i386: PARAVIRT: Hooks to set up initial pagetable
This patch introduces paravirt_ops hooks to control how the kernel's
initial pagetable is set up.
In the case of a native boot, the very early bootstrap code creates a
simple non-PAE pagetable to map the kernel and physical memory. When
the VM subsystem is initialized, it creates a proper pagetable which
respects the PAE mode, large pages, etc.
When booting under a hypervisor, there are many possibilities for what
paging environment the hypervisor establishes for the guest kernel, so
the constructon of the kernel's pagetable depends on the hypervisor.
In the case of Xen, the hypervisor boots the kernel with a fully
constructed pagetable, which is already using PAE if necessary. Also,
Xen requires particular care when constructing pagetables to make sure
all pagetables are always mapped read-only.
In order to make this easier, kernel's initial pagetable construction
has been changed to only allocate and initialize a pagetable page if
there's no page already present in the pagetable. This allows the Xen
paravirt backend to make a copy of the hypervisor-provided pagetable,
allowing the kernel to establish any more mappings it needs while
keeping the existing ones.
A slightly subtle point which is worth highlighting here is that Xen
requires all kernel mappings to share the same pte_t pages between all
pagetables, so that updating a kernel page's mapping in one pagetable
is reflected in all other pagetables. This makes it possible to
allocate a page and attach it to a pagetable without having to
explicitly enumerate that page's mapping in all pagetables.
And:
+From: "Eric W. Biederman" <ebiederm@xmission.com>
If we don't set the leaf page table entries it is quite possible that
will inherit and incorrect page table entry from the initial boot
page table setup in head.S. So we need to redo the effort here,
so we pick up PSE, PGE and the like.
Hypervisors like Xen require that their page tables be read-only,
which is slightly incompatible with our low identity mappings, however
I discussed this with Jeremy he has modified the Xen early set_pte
function to avoid problems in this area.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: William Irwin <bill.irwin@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
2007-05-03 00:27:13 +07:00
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
.read_cr2 = native_read_cr2,
|
|
|
|
.write_cr2 = native_write_cr2,
|
|
|
|
.read_cr3 = native_read_cr3,
|
|
|
|
.write_cr3 = native_write_cr3,
|
|
|
|
|
2006-12-07 08:14:08 +07:00
|
|
|
.flush_tlb_user = native_flush_tlb,
|
|
|
|
.flush_tlb_kernel = native_flush_tlb_global,
|
|
|
|
.flush_tlb_single = native_flush_tlb_single,
|
2007-05-03 00:27:15 +07:00
|
|
|
.flush_tlb_others = native_flush_tlb_others,
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2008-06-25 11:19:12 +07:00
|
|
|
.pgd_alloc = __paravirt_pgd_alloc,
|
|
|
|
.pgd_free = paravirt_nop,
|
|
|
|
|
2008-03-18 06:37:01 +07:00
|
|
|
.alloc_pte = paravirt_nop,
|
|
|
|
.alloc_pmd = paravirt_nop,
|
2008-03-18 06:37:02 +07:00
|
|
|
.alloc_pud = paravirt_nop,
|
2008-03-18 06:37:01 +07:00
|
|
|
.release_pte = paravirt_nop,
|
|
|
|
.release_pmd = paravirt_nop,
|
2008-03-18 06:37:02 +07:00
|
|
|
.release_pud = paravirt_nop,
|
2007-02-13 19:26:21 +07:00
|
|
|
|
2006-12-07 08:14:08 +07:00
|
|
|
.set_pte = native_set_pte,
|
|
|
|
.set_pte_at = native_set_pte_at,
|
|
|
|
.set_pmd = native_set_pmd,
|
2011-01-14 06:46:36 +07:00
|
|
|
.set_pmd_at = native_set_pmd_at,
|
2007-05-03 00:27:13 +07:00
|
|
|
.pte_update = paravirt_nop,
|
2007-05-03 00:27:13 +07:00
|
|
|
|
2008-06-16 18:30:01 +07:00
|
|
|
.ptep_modify_prot_start = __ptep_modify_prot_start,
|
|
|
|
.ptep_modify_prot_commit = __ptep_modify_prot_commit,
|
|
|
|
|
2015-04-15 05:46:14 +07:00
|
|
|
#if CONFIG_PGTABLE_LEVELS >= 3
|
2006-12-07 08:14:08 +07:00
|
|
|
#ifdef CONFIG_X86_PAE
|
|
|
|
.set_pte_atomic = native_set_pte_atomic,
|
|
|
|
.pte_clear = native_pte_clear,
|
|
|
|
.pmd_clear = native_pmd_clear,
|
2008-01-30 19:33:20 +07:00
|
|
|
#endif
|
|
|
|
.set_pud = native_set_pud,
|
2017-02-25 05:57:02 +07:00
|
|
|
.set_pud_at = native_set_pud_at,
|
2009-01-29 05:35:07 +07:00
|
|
|
|
|
|
|
.pmd_val = PTE_IDENT,
|
|
|
|
.make_pmd = PTE_IDENT,
|
2008-01-30 19:33:20 +07:00
|
|
|
|
2015-04-15 05:46:14 +07:00
|
|
|
#if CONFIG_PGTABLE_LEVELS == 4
|
2009-01-29 05:35:07 +07:00
|
|
|
.pud_val = PTE_IDENT,
|
|
|
|
.make_pud = PTE_IDENT,
|
|
|
|
|
2008-01-30 19:33:20 +07:00
|
|
|
.set_pgd = native_set_pgd,
|
2006-12-07 08:14:08 +07:00
|
|
|
#endif
|
2015-04-15 05:46:14 +07:00
|
|
|
#endif /* CONFIG_PGTABLE_LEVELS >= 3 */
|
2006-12-07 08:14:08 +07:00
|
|
|
|
2009-01-29 05:35:07 +07:00
|
|
|
.pte_val = PTE_IDENT,
|
|
|
|
.pgd_val = PTE_IDENT,
|
2007-05-03 00:27:13 +07:00
|
|
|
|
2009-01-29 05:35:07 +07:00
|
|
|
.make_pte = PTE_IDENT,
|
|
|
|
.make_pgd = PTE_IDENT,
|
2007-05-03 00:27:13 +07:00
|
|
|
|
2007-05-03 00:27:14 +07:00
|
|
|
.dup_mmap = paravirt_nop,
|
|
|
|
.exit_mmap = paravirt_nop,
|
|
|
|
.activate_mm = paravirt_nop,
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
|
|
|
|
.lazy_mode = {
|
|
|
|
.enter = paravirt_nop,
|
|
|
|
.leave = paravirt_nop,
|
2013-03-23 20:36:36 +07:00
|
|
|
.flush = paravirt_nop,
|
paravirt: clean up lazy mode handling
Currently, the set_lazy_mode pv_op is overloaded with 5 functions:
1. enter lazy cpu mode
2. leave lazy cpu mode
3. enter lazy mmu mode
4. leave lazy mmu mode
5. flush pending batched operations
This complicates each paravirt backend, since it needs to deal with
all the possible state transitions, handling flushing, etc. In
particular, flushing is quite distinct from the other 4 functions, and
seems to just cause complication.
This patch removes the set_lazy_mode operation, and adds "enter" and
"leave" lazy mode operations on mmu_ops and cpu_ops. All the logic
associated with enter and leaving lazy states is now in common code
(basically BUG_ONs to make sure that no mode is current when entering
a lazy mode, and make sure that the mode is current when leaving).
Also, flush is handled in a common way, by simply leaving and
re-entering the lazy mode.
The result is that the Xen, lguest and VMI lazy mode implementations
are much simpler.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Zach Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Anthony Liguory <aliguori@us.ibm.com>
Cc: "Glauber de Oliveira Costa" <glommer@gmail.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>
2007-10-17 01:51:29 +07:00
|
|
|
},
|
2008-06-18 01:42:01 +07:00
|
|
|
|
|
|
|
.set_fixmap = native_set_fixmap,
|
2006-12-07 08:14:07 +07:00
|
|
|
};
|
2007-01-23 11:40:36 +07:00
|
|
|
|
2007-10-17 01:51:29 +07:00
|
|
|
EXPORT_SYMBOL_GPL(pv_time_ops);
|
x86/paravirt: revert exports to restore old behaviour
Subdividing the paravirt_ops structure caused a regression in certain
non-GPL modules which try to use mmu_ops and cpu_ops. This restores the
old behaviour, and makes it consistent with the non-CONFIG_PARAVIRT case.
Takashi Iwai <tiwai@suse.de> adds:
> I took at this problem (as I have an nvidia card on one of my
> workstations), and found out that the following suffer from
> EXPORT_SYMBOL_GPL changes:
>
> * local_disable_irq(), local_irq_save*(), etc.
> * MSR-related macros like rdmsr(), wrmsr(), read_cr0(), etc.
> wbinvd(), too.
> * pmd_val(), pgd_val(), etc are all involved with pv_mm_ops.
> pmd_large() and pmd_bad() is also indirectly involved.
> __flush_tlb() and friends suffer, too.
Christoph Hellwig objects to this patch on the grounds that modules
shouldn't be using these operations anyway. I don't think this is a
particularly good reason to reject the patch, for several reasons:
1. These operations are still available to modules when not using
CONFIG_PARAVIRT, since they are implicitly exported as inline
functions via the kernel headers. Exporting the same functionality as
GPL-only symbols just adds a gratuitious difference between
CONFIG_PARAVIRT and non-CONFIG_PARAVIRT configurations. If we really
think these operations are not for module use (or non-GPL module use),
then we should solve the problem in a general way.
2. It's a regression from previous kernels, which would work these
modules even with CONFIG_PARAVIRT enabled.
3. The operations in question seem pretty reasonable for modules to
use. The control registers/MSRs can be accessed directly anyway, so there's
no benefit in preventing modules from using standard interfaces. And it seems
reasonable to allow a graphics driver to create its own mappings if it wants.
Therefore, I think this patch should go in for 2.6.24. If people
really think that these operations should not be available to modules,
then we can address that separately.
Signed-off-by: Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>
Cc: Tobias Powalowski <t.powa@gmx.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-29 07:22:11 +07:00
|
|
|
EXPORT_SYMBOL (pv_cpu_ops);
|
|
|
|
EXPORT_SYMBOL (pv_mmu_ops);
|
2007-10-17 01:51:29 +07:00
|
|
|
EXPORT_SYMBOL_GPL(pv_info);
|
|
|
|
EXPORT_SYMBOL (pv_irq_ops);
|