12 Jan, 2012
4 commits
-
To ensure we don't receive any more interrupts from the host after we
enter the freeze function, disable all vq interrupts.There wasn't any problem seen due to this in tests, but applying this
patch makes the freeze case more robust.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Remove all vqs and associated buffers in the freeze callback which
prepares us to go into hibernation state. On restore, re-create all the
vqs and populate the input vqs with buffers to get to the pre-hibernate
state.Note: Any outstanding unconsumed buffers are discarded; which means
there's a possibility of data loss in case the host or the guest didn't
consume any data already present in the vqs. This can be addressed in a
later patch series, perhaps in virtio common code.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
This common code will be shared with the PM freeze function.
Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Remove wrapper functions. This makes the allocation type explicit in
all callers; I used GPF_KERNEL where it seemed obvious, left it at
GFP_ATOMIC otherwise.Signed-off-by: Rusty Russell
Reviewed-by: Christoph Hellwig
07 Nov, 2011
1 commit
-
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
Revert "tracing: Include module.h in define_trace.h"
irq: don't put module.h into irq.h for tracking irqgen modules.
bluetooth: macroize two small inlines to avoid module.h
ip_vs.h: fix implicit use of module_get/module_put from module.h
nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
include: replace linux/module.h with "struct module" wherever possible
include: convert various register fcns to macros to avoid include chaining
crypto.h: remove unused crypto_tfm_alg_modname() inline
uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
pm_runtime.h: explicitly requires notifier.h
linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
miscdevice.h: fix up implicit use of lists and types
stop_machine.h: fix implicit use of smp.h for smp_processor_id
of: fix implicit use of errno.h in include/linux/of.h
of_platform.h: delete needless include
acpi: remove module.h include from platform/aclinux.h
miscdevice.h: delete unnecessary inclusion of module.h
device_cgroup.h: delete needless include
net: sch_generic remove redundant use of
net: inet_timewait_sock doesnt need
...Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
- drivers/media/dvb/frontends/dibx000_common.c
- drivers/media/video/{mt9m111.c,ov6650.c}
- drivers/mfd/ab3550-core.c
- include/linux/dmaengine.h
02 Nov, 2011
10 commits
-
On s390 I have seen some random
"Warning: unable to open an initial console"
boot failure. Turns out that tty_open fails, because the
hvc_alloc was not yet done. In former times this could not happen,
since the probe function automatically called hvc_alloc. With newer
versions (multiport) some hostguest interaction is required
before hvc_alloc is called. This might be too late, especially if
an initramfs is involved. Lets use a completion if we have
multiport and an early console.[Amit:
* Use NULL instead of 0 for pointer comparison
* Rename 'port_added' to 'early_console_added'
* Re-format, re-word commit message
* Rebase patch on top of current queue]Signed-off-by: Christian Borntraeger
Signed-off-by: Amit Shah
Acked-by: Chrstian Borntraeger
Signed-off-by: Rusty Russell -
This commit adds port-specific stats for the number of bytes received,
sent and discarded. They're exposed via the debugfs interface. This
data can be used to check for data loss bugs (or disprove such claims).
It can also be used for accounting, if there's such a need.The stats remain valid throughout the lifetime of the port. Unplugging
a port will reset the stats. The numbers are not reset across port
opens/closes.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
discard_port_data() used virtqueue_get_buf() directly instead of using
get_inbuf(). Fix this, so that we get accounting for all received
bytes. This also simplifies the code a lot.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
'ret' is a misnomer in discard_port_data() since we don't return the
value. Rename it to 'err'.
Signed-off-by: Rusty Russell -
Instead of pulling in a buffer from the vq each time it's called,
get_inbuf() now checks if the current active buffer, in port->inbuf is
valid. If it is, just returns a pointer to it. This ends up
simplifying a lot of code calling get_inbuf() since the check for
port->inbuf being valid was done by all the callers.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
get_inbuf() returns void *. There's no reason to return void pointers
instead of the correct struct port_buffer *.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Get ready to support suspend/resume by using the freezable calls so that
blocking read/write syscalls are handled properly across suspend/resume.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
We don't allow port name changes dynamically for a port. So any
requests by the host to change the name are ignored.Before this patch, if the hypervisor sent a port name while we had one
set already, we would leak memory equivalent to the size of the old
name.This scenario wasn't expected so far, but with the suspend-resume
support, we'll send the VIRTIO_CONSOLE_PORT_READY message after restore,
which can get us into this situation.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Convert spaces to tabs and fix indentation for an if statement split
into multiple lines.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
This patch modifies virtio-console to use virtio_config_val() instead
of a 'if(virtio_has_feature()) vdev->config->get()' construct to retrieve
optional values from the config space.Cc: Amit Shah
Cc: "Michael S. Tsirkin"
Cc: Rusty Russell
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Sasha Levin
Signed-off-by: Rusty Russell
01 Nov, 2011
1 commit
-
A pending cleanup will mean that module.h won't be implicitly
everywhere anymore. Make sure the modular drivers in char are
actually calling out for explicitly in advance.Signed-off-by: Paul Gortmaker
30 May, 2011
1 commit
-
That's already been done by the virtio infrastructure before the probe
function is called.Reported-by: alexey.kardashevskiy@au1.ibm.com
Acked-by: Amit Shah
Tested-by: Amit Shah
Signed-off-by: Rusty Russell
21 Apr, 2011
1 commit
-
This call was disabled as hot-unplugging one virtconsole port led to
another virtconsole port freezing.Upon testing it again, this now works, so enable it.
In addition, a bug was found in qemu wherein removing a port of one type
caused the guest output from another port to stop working. I doubt it
was just this bug that caused it (since disabling the hvc_remove() call
did allow other ports to continue working), but since it's all solved
now, we're fine with hot-unplugging of virtconsole ports.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell
07 Mar, 2011
1 commit
-
If a virtio-console device gets unplugged while a port is open, a
subsequent close() call on the port accesses vqs to free up buffers.
This can lead to a crash.The buffers are already freed up as a result of the call to
unplug_ports() from virtcons_remove(). The fix is to simply not access
vq information if port->portdev is NULL.Reported-by: juzhang
CC: stable@kernel.org
Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell
Signed-off-by: Linus Torvalds
11 Feb, 2011
1 commit
-
* 'tty-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
serial: bfin_5xx: split uart RX lock from uart port lock to avoid deadlock
68360serial: Plumb in rs_360_get_icount()
n_gsm: copy mtu over when configuring via ioctl interface
virtio: console: Move file back to drivers/char/
04 Feb, 2011
1 commit
-
Commit 728674a7e466628df2aeec6d11a2ae1ef968fb67 moved virtio_console.c
to drivers/tty/hvc/ under the perception of this being an hvc driver.
It was such once, but these days it has generic communication
capabilities as well, so move it to drivers/char/.In the future, the hvc part from this file can be split off and moved
under drivers/tty/hvc/.Signed-off-by: Amit Shah
CC: Rusty Russell
Acked-by: Arnd Bergmann
Signed-off-by: Greg Kroah-Hartman
14 Jan, 2011
1 commit
-
As requested by Arnd Bergmann, the hvc drivers are now
moved to the drivers/tty/hvc/ directory. The virtio_console.c driver
was also moved, as it required the hvc_console.h file to be able to be
built, and it really is a hvc driver.Cc: Arnd Bergmann
Signed-off-by: Greg Kroah-Hartman
24 Nov, 2010
1 commit
-
Stanse found that in init_vqs, memory is leaked under certain
circumstanses (the fail path order is incorrect). Fix that by checking
allocations in one turn and free all of them at once if some fails
(some may be NULL, but this is OK).Signed-off-by: Jiri Slaby
Cc: Amit Shah
Cc: virtualization@lists.linux-foundation.org
Cc: Greg Kroah-Hartman
Signed-off-by: Rusty Russell
21 Oct, 2010
17 commits
-
The ports are char devices; do not have seeking capabilities. Calling
nonseekable_open() from the fops_open() call and setting the llseek fops
pointer to no_llseek ensures an lseek() call from userspace returns
-ESPIPE.Signed-off-by: Amit Shah
CC: Arnd Bergmann
Signed-off-by: Rusty Russell -
If a port has registered for SIGIO signals, let the application
know that the port is getting unplugged.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Send a SIGIO signal when new data arrives on a port. This is sent only
when the process has requested for the signal to be sent using fcntl().Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
A process can request for SIGIO on host connect / disconnect events
using the O_ASYNC file flag using fcntl().If that's requested, and if the guest-side connection for the port is
open, any host-side open/close events for that port will raise a SIGIO.
The process can then use poll() within the signal handler to find out
which port triggered the signal.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Explain in a comment why there's no need to reference-count the portdev
struct: when a device is yanked out, we can't do anything more with it
anyway so just give up doing anything more with the data or the vqs and
exit cleanly.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
When a port got hot-unplugged, when a port was open, any file operation
after the unplugging resulted in a crash. This is fixed by ref-counting
the port structure, and releasing it only when the file is closed.This splits the unplug operation in two parts: first marks the port
as unavailable, removes all the buffers in the vqs and removes the port
from the per-device list of ports. The second stage, invoked when all
references drop to zero, releases the chardev and frees all other memory.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
This moves to using cdev on the heap instead of it being embedded in the
ports struct. This helps individual refcounting and will allow us to
properly remove cdev structs after hot-unplugs and close operations.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
To convert to using cdev as a pointer to avoid kref troubles, we have to
use a different method to get to a port from an inode than the current
container_of method.Add find_port_by_devt() that looks up all portdevs and ports with those
portdevs to find the right port.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
The virtio_console.c driver is capable of handling multiple devices at a
time. Maintain a list of devices for future traversal.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
Just re-arrange code for future patches.
Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
When a port is removed, we have to assume the port is gone. So a
success/failure return value doesn't make sense.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
When a port is hot-unplugged while an app was blocked on a write() call,
the call was unblocked but would not get an error returned.Return -ENODEV to ensure the app knows the port has gone away.
Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
When a port is hot-unplugged while an app was blocked on a read() call,
the call was unblocked but would not get an error returned.Return -ENODEV to ensure the app knows the port has gone away.
Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
When a port is hot-unplugged while an app is blocked on poll(), unblock
the poll() and return.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
If a chardev is closed, any blocked read / poll calls should just return
and not attempt to use other state.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
A portdev may have been hot-unplugged while a port was open()ed. Skip
sending control messages when the portdev isn't valid.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell -
If a portdev isn't using multiport support, it won't have any control vq
data to remove.Signed-off-by: Amit Shah
Signed-off-by: Rusty Russell