]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
9 years agocpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable
Vitaly Kuznetsov [Wed, 5 Aug 2015 07:52:47 +0000 (00:52 -0700)]
cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable

Hyper-V module needs to disable cpu hotplug (offlining) as there is no
support from hypervisor side to reassign already opened event channels
to a different CPU. Currently it is been done by altering
smp_ops.cpu_disable but it is hackish.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 32145c4677d2c46b9d877a33ae82c6fcacd002f9)

As hv driver depends on it
Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoclockevents: Add helpers to check the state of a clockevent device
Viresh Kumar [Thu, 21 May 2015 08:03:45 +0000 (13:33 +0530)]
clockevents: Add helpers to check the state of a clockevent device

Some clockevent drivers, once migrated to use per-state callbacks,
need to check the state of the clockevent device in their callbacks or
interrupt handler.

Add accessor functions clockevent_state_*() to get this information.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/04a717d490335c688dd7af899fbcede97e1bb8ee.1432192527.git.viresh.kumar@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
(cherry picked from commit 3434d23b694e5cb6e44e966914563406c31c4053)

As hv drivers depends on it
Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoclockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state
Viresh Kumar [Fri, 3 Apr 2015 03:34:04 +0000 (09:04 +0530)]
clockevents: Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state

When no timers/hrtimers are pending, the expiry time is set to a
special value: 'KTIME_MAX'. This normally happens with
NO_HZ_{IDLE|FULL} in both LOWRES/HIGHRES modes.

When 'expiry == KTIME_MAX', we either cancel the 'tick-sched' hrtimer
(NOHZ_MODE_HIGHRES) or skip reprogramming clockevent device
(NOHZ_MODE_LOWRES).  But, the clockevent device is already
reprogrammed from the tick-handler for next tick.

As the clock event device is programmed in ONESHOT mode it will at
least fire one more time (unnecessarily). Timers on few
implementations (like arm_arch_timer, etc.) only support PERIODIC mode
and their drivers emulate ONESHOT over that. Which means that on these
platforms we will get spurious interrupts periodically (at last
programmed interval rate, normally tick rate).

In order to avoid spurious interrupts, the clockevent device should be
stopped or its interrupts should be masked.

A simple (yet hacky) solution to get this fixed could be: update
hrtimer_force_reprogram() to always reprogram clockevent device and
update clockevent drivers to STOP generating events (or delay it to
max time) when 'expires' is set to KTIME_MAX. But the drawback here is
that every clockevent driver has to be hacked for this particular case
and its very easy for new ones to miss this.

However, Thomas suggested to add an optional state ONESHOT_STOPPED to
solve this problem: lkml.org/lkml/2014/5/9/508.

This patch adds support for ONESHOT_STOPPED state in clockevents
core. It will only be available to drivers that implement the
state-specific callbacks instead of the legacy ->set_mode() callback.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Preeti U. Murthy <preeti@linux.vnet.ibm.com>
Cc: linaro-kernel@lists.linaro.org
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/b8b383a03ac07b13312c16850b5106b82e4245b5.1428031396.git.viresh.kumar@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
(cherry picked from commit 8fff52fd50934580c5108afed12043a774edf728)

As hv driver depends on it
Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: util: introduce hv_utils_transport abstraction
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:51 +0000 (18:07 -0700)]
Drivers: hv: util: introduce hv_utils_transport abstraction

The intention is to make KVP/VSS drivers work through misc char devices.
Introduce an abstraction for kernel/userspace communication to make the
migration smoother. Transport operational mode (netlink or char device)
is determined by the first received message. To support driver upgrades
the switch from netlink to chardev operational mode is supported.

Every hv_util daemon is supposed to register 2 callbacks:
1) on_msg() to get notified when the userspace daemon sent a message;
2) on_reset() to get notified when the userspace daemon drops the connection.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 14b50f80c32dd4e84b6baeaa8bf4049cc5ecf56d)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: util: introduce state machine for util drivers
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:46 +0000 (18:07 -0700)]
Drivers: hv: util: introduce state machine for util drivers

KVP/VSS/FCOPY drivers work in fully serialized mode: we wait till userspace
daemon registers, wait for a message from the host, send this message to the
daemon, get the reply, send it back to host, wait for another message.
Introduce enum hvutil_device_state to represend this state in all 3 drivers.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 636c88da6df3bb2f978b48d3a7ed55423da84d19)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: use cpu_hotplug_enable/disable
Vitaly Kuznetsov [Wed, 5 Aug 2015 07:52:48 +0000 (00:52 -0700)]
Drivers: hv: vmbus: use cpu_hotplug_enable/disable

Commit e513229b4c38 ("Drivers: hv: vmbus: prevent cpu offlining on newer
hypervisors") was altering smp_ops.cpu_disable to prevent CPU offlining.
We can bo better by using cpu_hotplug_enable/disable functions instead of
such hard-coding.

Reported-by: Radim Kr.má <rkrcmar@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f39c4280a3872b0e6c7b01076132c12ad7a90392)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: add a sysfs attr to show the binding of channel/VP
Dexuan Cui [Wed, 5 Aug 2015 07:52:43 +0000 (00:52 -0700)]
Drivers: hv: vmbus: add a sysfs attr to show the binding of channel/VP

This is useful to analyze performance issue.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 042ab0313bbb7e776e9510da3f07fb300d08a8ba)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Implement a clocksource based on the TSC page
K. Y. Srinivasan [Wed, 5 Aug 2015 07:52:42 +0000 (00:52 -0700)]
Drivers: hv: vmbus: Implement a clocksource based on the TSC page

The current Hyper-V clock source is based on the per-partition reference counter
and this counter is being accessed via s synthetic MSR - HV_X64_MSR_TIME_REF_COUNT.
Hyper-V has a more efficient way of computing the per-partition reference
counter value that does not involve reading a synthetic MSR. We implement
a time source based on this mechanism.

Tested-by: Vivek Yadav <vyadav@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ca9357bd26c2f8e7b909321eedd651f52cc30d04)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agodrivers/hv: Migrate to new 'set-state' interface
Viresh Kumar [Wed, 5 Aug 2015 07:52:41 +0000 (00:52 -0700)]
drivers/hv: Migrate to new 'set-state' interface

Migrate hv driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: devel@linuxdriverproject.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit bc609cb47fb2e74654e23cef0a1d4db38b6570a3)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv_vmbus: Fix signal to host condition
Christopher Oo [Wed, 5 Aug 2015 07:52:40 +0000 (00:52 -0700)]
Drivers: hv_vmbus: Fix signal to host condition

Fixes a bug where previously hv_ringbuffer_read would pass in the old
number of bytes available to read instead of the expected old read index
when calculating when to signal to the host that the ringbuffer is empty.
Since the previous write size is already saved, also changes the
hv_need_to_signal_on_read to use the previously read value rather than
recalculating it.

Signed-off-by: Christopher Oo <t-chriso@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a5cca686ce0ef4909deaee4ed46dd991e3a9ece4)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Improve the CPU affiliation for channels
K. Y. Srinivasan [Wed, 5 Aug 2015 07:52:38 +0000 (00:52 -0700)]
Drivers: hv: vmbus: Improve the CPU affiliation for channels

The current code tracks the assigned CPUs within a NUMA node in the context of
the primary channel. So, if we have a VM with a single NUMA node with 8 VCPUs, we may
end up unevenly distributing the channel load. Fix the issue by tracking affiliations
globally.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9f01ec53458d9e9b68f1c555e773b5d1a1f66e94)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agodrivers:hv: Move MMIO range picking from hyper_fb to hv_vmbus
Jake Oshins [Wed, 5 Aug 2015 07:52:37 +0000 (00:52 -0700)]
drivers:hv: Move MMIO range picking from hyper_fb to hv_vmbus

This patch deletes the logic from hyperv_fb which picked a range of MMIO space
for the frame buffer and adds new logic to hv_vmbus which picks ranges for
child drivers.  The new logic isn't quite the same as the old, as it considers
more possible ranges.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3546448338e76a52d4f86eb3680cb2934e22d89b)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agodrivers:hv: Modify hv_vmbus to search for all MMIO ranges available.
Jake Oshins [Wed, 5 Aug 2015 07:52:36 +0000 (00:52 -0700)]
drivers:hv: Modify hv_vmbus to search for all MMIO ranges available.

This patch changes the logic in hv_vmbus to record all of the ranges in the
VM's firmware (BIOS or UEFI) that offer regions of memory-mapped I/O space for
use by paravirtual front-end drivers.  The old logic just found one range
above 4GB and called it good.  This logic will find any ranges above 1MB.

It would have been possible with this patch to just use existing resource
allocation functions, rather than keep track of the entire set of Hyper-V
related MMIO regions in VMBus.  This strategy, however, is not sufficient
when the resource allocator needs to be aware of the constraints of a
Hyper-V virtual machine, which is what happens in the next patch in the series.
So this first patch exists to show the first steps in reworking the MMIO
allocation paths for Hyper-V front-end drivers.

Signed-off-by: Jake Oshins <jakeo@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7f163a6fd957a85f7f66a129db1ad243a44399ee)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Consider ND NIC in binding channels to CPUs
K. Y. Srinivasan [Sat, 1 Aug 2015 23:08:21 +0000 (16:08 -0700)]
Drivers: hv: vmbus: Consider ND NIC in binding channels to CPUs

We cycle through all the "high performance" channels to distribute
load across the available CPUs. Process the NetworkDirect as a
high performance device.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 379e4f756b915bcc35958365e5d1326b3b54efce)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agomshyperv: fix recognition of Hyper-V guest crash MSR's
Denis V. Lunev [Sat, 1 Aug 2015 23:08:20 +0000 (16:08 -0700)]
mshyperv: fix recognition of Hyper-V guest crash MSR's

Hypervisor Top Level Functional Specification v3.1/4.0 notes that cpuid
(0x40000003) EDX's 10th bit should be used to check that Hyper-V guest
crash MSR's functionality available.

This patch should fix this recognition. Currently the code checks EAX
register instead of EDX.

Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit cc2dd4027a43bb36c846f195a764edabc0828602)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: prefer 'die' notification chain to 'panic'
Vitaly Kuznetsov [Sat, 1 Aug 2015 23:08:10 +0000 (16:08 -0700)]
Drivers: hv: vmbus: prefer 'die' notification chain to 'panic'

current_pt_regs() sometimes returns regs of the userspace process and in
case of a kernel crash this is not what we need to report. E.g. when we
trigger crash with sysrq we see the following:
...
 RIP: 0010:[<ffffffff815b8696>]  [<ffffffff815b8696>] sysrq_handle_crash+0x16/0x20
 RSP: 0018:ffff8800db0a7d88  EFLAGS: 00010246
 RAX: 000000000000000f RBX: ffffffff820a0660 RCX: 0000000000000000
...
at the same time current_pt_regs() give us:
ip=7f899ea7e9e0, ax=ffffffffffffffda, bx=26c81a0, cx=7f899ea7e9e0, ...
These registers come from the userspace process triggered the crash. As we
don't even know which process it was this information is rather useless.

When kernel crash happens through 'die' proper regs are being passed to
all receivers on the die_chain (and panic_notifier_list is being notified
with the string passed to panic() only). If panic() is called manually
(e.g. on BUG()) we won't get 'die' notification so keep the 'panic'
notification reporter as well but guard against double reporting.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 510f7aef65bb7ed22cf9c7f94f955727f963ede4)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: unregister panic notifier on module unload
Vitaly Kuznetsov [Thu, 23 Apr 2015 04:31:29 +0000 (21:31 -0700)]
Drivers: hv: vmbus: unregister panic notifier on module unload

Commit 96c1d0581d00f7abe033350edb021a9d947d8d81 ("Drivers: hv: vmbus: Add
support for VMBus panic notifier handler") introduced
atomic_notifier_chain_register() call on module load. We also need to call
atomic_notifier_chain_unregister() on module unload as otherwise the following
crash is observed when we bring hv_vmbus back:

[   39.788877] BUG: unable to handle kernel paging request at ffffffffa00078a8
[   39.788877] IP: [<ffffffff8109d63f>] notifier_call_chain+0x3f/0x80
...
[   39.788877] Call Trace:
[   39.788877]  [<ffffffff8109de7d>] __atomic_notifier_call_chain+0x5d/0x90
...
[   39.788877]  [<ffffffff8109d788>] ? atomic_notifier_chain_register+0x38/0x70
[   39.788877]  [<ffffffff8109d767>] ? atomic_notifier_chain_register+0x17/0x70
[   39.788877]  [<ffffffffa002814f>] hv_acpi_init+0x14f/0x1000 [hv_vmbus]
[   39.788877]  [<ffffffff81002144>] do_one_initcall+0xd4/0x210

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 096c605feb3d85b309e95db2afc01584b967cc23)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: fix typo in hv_port_info struct
Nik Nyby [Sat, 1 Aug 2015 23:08:18 +0000 (16:08 -0700)]
Drivers: hv: vmbus: fix typo in hv_port_info struct

This fixes a typo: base_flag_bumber to base_flag_number

Signed-off-by: Nik Nyby <nikolas@gnu.org>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e26009aad095feae45a6e79bb022c55a969ecded)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Permit sending of packets without payload
K. Y. Srinivasan [Sat, 1 Aug 2015 23:08:14 +0000 (16:08 -0700)]
Drivers: hv: vmbus: Permit sending of packets without payload

The guest may have to send a completion packet back to the host.
To support this usage, permit sending a packet without a payload -
we would be only sending the descriptor in this case.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b81658cf5d44e07c70c93e3b2aefe848eaaba99f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: balloon: Enable dynamic memory protocol negotiation with Windows 10...
Alex Ng [Sat, 1 Aug 2015 23:08:13 +0000 (16:08 -0700)]
Drivers: hv: balloon: Enable dynamic memory protocol negotiation with Windows 10 hosts

Support Win10 protocol for Dynamic Memory. Thia patch allows guests on Win10 hosts
to hot-add memory even when dynamic memory is not enabled on the guest.

Signed-off-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b6ddeae1603dfa55e857ba1520f5acea83f8cf1c)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: don't do hypercalls when hypercall_page is NULL
Vitaly Kuznetsov [Sat, 1 Aug 2015 23:08:08 +0000 (16:08 -0700)]
Drivers: hv: don't do hypercalls when hypercall_page is NULL

At the very late stage of kexec a driver (which are not being unloaded) can
try to post a message or signal an event. This will crash the kernel as we
already did hv_cleanup() and the hypercall page is NULL.

Move all common (between 32 and 64 bit code) declarations to the beginning
of the do_hypercall() function. Unfortunately we have to write the
!hypercall_page check twice to not mix declarations and code.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit d7646eaa7678fe5adc42247b4bdfbe9d9db8c253)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: add special kexec handler
Vitaly Kuznetsov [Sat, 1 Aug 2015 23:08:07 +0000 (16:08 -0700)]
Drivers: hv: vmbus: add special kexec handler

When general-purpose kexec (not kdump) is being performed in Hyper-V guest
the newly booted kernel fails with an MCE error coming from the host. It
is the same error which was fixed in the "Drivers: hv: vmbus: Implement
the protocol for tearing down vmbus state" commit - monitor pages remain
special and when they're being written to (as the new kernel doesn't know
these pages are special) bad things happen. We need to perform some
minimalistic cleanup before booting a new kernel on kexec. To do so we
need to register a special machine_ops.shutdown handler to be executed
before the native_machine_shutdown(). Registering a shutdown notification
handler via the register_reboot_notifier() call is not sufficient as it
happens to early for our purposes. machine_ops is not being exported to
modules (and I don't think we want to export it) so let's do this in
mshyperv.c

The minimalistic cleanup consists of cleaning up clockevents, synic MSRs,
guest os id MSR, and hypercall MSR.

Kdump doesn't require all this stuff as it lives in a separate memory
space.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2517281d63a2b09d94aedfb522943617048f337e)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: remove hv_synic_free_cpu() call from hv_synic_cleanup()
Vitaly Kuznetsov [Sat, 1 Aug 2015 23:08:05 +0000 (16:08 -0700)]
Drivers: hv: vmbus: remove hv_synic_free_cpu() call from hv_synic_cleanup()

We already have hv_synic_free() which frees all per-cpu pages for all
CPUs, let's remove the hv_synic_free_cpu() call from hv_synic_cleanup()
so it will be possible to do separate cleanup (writing to MSRs) and final
freeing. This is going to be used to assist kexec.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 06210b42f33ea1c29a90f4db2d88be91c511154b)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: kill tasklets on module unload
Vitaly Kuznetsov [Thu, 7 May 2015 00:47:41 +0000 (17:47 -0700)]
Drivers: hv: vmbus: kill tasklets on module unload

Explicitly kill tasklets we create on module unload.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1959a28e2671004c1e9c30ccd2914b868f100742)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Add structs and handlers for VF messages
Haiyang Zhang [Fri, 24 Jul 2015 17:08:40 +0000 (10:08 -0700)]
hv_netvsc: Add structs and handlers for VF messages

This patch adds data structures and handlers for messages related
to SRIOV Virtual Function.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 71790a2792c8772e29bf5aa726215d9256ef93dc)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Wait for sub-channels to be processed during probe
KY Srinivasan [Wed, 22 Jul 2015 18:42:32 +0000 (11:42 -0700)]
hv_netvsc: Wait for sub-channels to be processed during probe

The current code returns from probe without waiting for the proper handling
of subchannels that may be requested. If the netvsc driver were to be rapidly
loaded/unloaded, we can  trigger a panic as the unload will be tearing
down state that may not have been fully setup yet. We fix this issue by making
sure that we return from the probe call only after ensuring that the
sub-channel offers in flight are properly handled.

Reviewed-and-tested-by: Haiyang Zhang <haiyangz@microsoft.com
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b3e6b82a0099dfef038e40c630a554ed1e402504)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Add close of RNDIS filter into change mtu call
Haiyang Zhang [Mon, 13 Jul 2015 20:09:16 +0000 (13:09 -0700)]
hv_netvsc: Add close of RNDIS filter into change mtu call

The current change mtu call only stops tx before removing RNDIS filter.
In case ringbufer is not empty, the rndis_filter_device_remove() may
hang on removing the buffers.

This patch adds close of RNDIS filter before removing it, also a
gradual waiting loop until the ring is empty. The change_mtu hang
issue under heavy traffic is solved by this patch.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2de8530ba0c71a2fba02590681af0f3a2a187a9b)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agox86: hyperv: add CPUID bit for crash handlers
Paolo Bonzini [Tue, 7 Jul 2015 10:17:36 +0000 (12:17 +0200)]
x86: hyperv: add CPUID bit for crash handlers

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 5d75a747596be046546eeb9d6ba39a3af851a1af)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Add support to set MTU reservation from guest side
Haiyang Zhang [Mon, 6 Jul 2015 21:11:37 +0000 (14:11 -0700)]
hv_netvsc: Add support to set MTU reservation from guest side

When packet encapsulation is in use, the MTU needs to be reduced for
headroom reservation.
The existing code takes the updated MTU value only from the host side.
But vSwitch extensions, such as Open vSwitch, require the flexibility
to change the MTU to different values from within a guest during the
lifecycle of a vNIC, when the encapsulation protocol is changed. The
patch supports this kind of MTU changes.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f9cbce34c34bcc05ea0dd78c8999bfe88b5b6b86)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agokvm: add hyper-v crash msrs values
Andrey Smetanin [Thu, 2 Jul 2015 16:07:46 +0000 (19:07 +0300)]
kvm: add hyper-v crash msrs values

Added Hyper-V crash msrs values - HV_X64_MSR_CRASH*.

Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Peter Hornyack <peterhornyack@google.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Gleb Natapov <gleb@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit a88464a8b0ffb2f8dfb69d3ab982169578b50f22)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agostorvsc: use shost_for_each_device() instead of open coding
Vitaly Kuznetsov [Wed, 1 Jul 2015 09:31:27 +0000 (11:31 +0200)]
storvsc: use shost_for_each_device() instead of open coding

Comment in struct Scsi_Host says that drivers are not supposed to access
__devices directly. storvsc_host_scan() doesn't happen in irq context
so we can just use shost_for_each_device().

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Long Li <longli@microsoft.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 8d6a9f5676f0e734967ac3739f5c6a28a0b047d9)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agostorvsc: be more picky about scmnd->sc_data_direction
Vitaly Kuznetsov [Thu, 25 Jun 2015 16:12:11 +0000 (18:12 +0200)]
storvsc: be more picky about scmnd->sc_data_direction

Under the 'default' case in scmnd->sc_data_direction we have 3 options:
- DMA_NONE which we handle correctly.
- DMA_BIDIRECTIONAL which is never supposed to be set by SCSI stack.
- Garbage value.

Do WARN() and return -EINVAL in the last two cases. virtio_scsi does
BUG_ON() here but it looks like an overkill.

Reported-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit cb1cf0804fe582f8a626c3cc591cb3127536137c)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion
K. Y. Srinivasan [Mon, 1 Jun 2015 04:27:03 +0000 (21:27 -0700)]
Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion

Allocate ring buffer memory from the NUMA node assigned to the channel.
Since this is a performance and not a correctness issue, if the node specific
allocation were to fail, fall back and allocate without specifying the node.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 294409d20572e9bcf857328286433f851168d54a)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Implement NUMA aware CPU affinity for channels
K. Y. Srinivasan [Sun, 31 May 2015 06:37:48 +0000 (23:37 -0700)]
Drivers: hv: vmbus: Implement NUMA aware CPU affinity for channels

Channels/sub-channels can be affinitized to VCPUs in the guest. Implement
this affinity in a way that is NUMA aware. The current protocol distributed
the primary channels uniformly across all available CPUs. The new protocol
is NUMA aware: primary channels are distributed across the available NUMA
nodes while the sub-channels within a primary channel are distributed amongst
CPUs within the NUMA node assigned to the primary channel.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1f656ff3fdddc2f59649cc84b633b799908f1f7b)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0
K. Y. Srinivasan [Sun, 31 May 2015 06:37:47 +0000 (23:37 -0700)]
Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0

Map target_cpu to target_vcpu using the mapping table.
We should use the mapping table to transform guest CPU ID to VP Index
as is done for the non-performance critical channels.
While the value CPU 0 is special and will
map to VP index 0, it is good to be consistent.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9c6e64adf200d3bac0dd47d52cdbd3bd428384a5)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: distribute subchannels among all vcpus
Vitaly Kuznetsov [Thu, 7 May 2015 00:47:46 +0000 (17:47 -0700)]
Drivers: hv: vmbus: distribute subchannels among all vcpus

Primary channels are distributed evenly across all vcpus we have. When the host
asks us to create subchannels it usually makes us num_cpus-1 offers and we are
supposed to distribute the work evenly among the channel itself and all its
subchannels. Make sure they are all assigned to different vcpus.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ce59fec836a9b4dc51cbcf9cb245b59e0ef53bea)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: balloon: check if ha_region_mutex was acquired in MEM_CANCEL_ONLINE...
Vitaly Kuznetsov [Fri, 29 May 2015 18:18:02 +0000 (11:18 -0700)]
Drivers: hv: balloon: check if ha_region_mutex was acquired in MEM_CANCEL_ONLINE case

Memory notifiers are being executed in a sequential order and when one of
them fails returning something different from NOTIFY_OK the remainder of
the notification chain is not being executed. When a memory block is being
onlined in online_pages() we do memory_notify(MEM_GOING_ONLINE, ) and if
one of the notifiers in the chain fails we end up doing
memory_notify(MEM_CANCEL_ONLINE, ) so it is possible for a notifier to see
MEM_CANCEL_ONLINE without seeing the corresponding MEM_GOING_ONLINE event.
E.g. when CONFIG_KASAN is enabled the kasan_mem_notifier() is being used
to prevent memory hotplug, it returns NOTIFY_BAD for all MEM_GOING_ONLINE
events. As kasan_mem_notifier() comes before the hv_memory_notifier() in
the notification chain we don't see the MEM_GOING_ONLINE event and we do
not take the ha_region_mutex. We, however, see the MEM_CANCEL_ONLINE event
and unconditionally try to release the lock, the following is observed:

[  110.850927] =====================================
[  110.850927] [ BUG: bad unlock balance detected! ]
[  110.850927] 4.1.0-rc3_bugxxxxxxx_test_xxxx #595 Not tainted
[  110.850927] -------------------------------------
[  110.850927] systemd-udevd/920 is trying to release lock
(&dm_device.ha_region_mutex) at:
[  110.850927] [<ffffffff81acda0e>] mutex_unlock+0xe/0x10
[  110.850927] but there are no more locks to release!

At the same time we can have the ha_region_mutex taken when we get the
MEM_CANCEL_ONLINE event in case one of the memory notifiers after the
hv_memory_notifier() in the notification chain failed so we need to add
the mutex_is_locked() check. In case of MEM_ONLINE we are always supposed
to have the mutex locked.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 4e4bd36f97b1492f19b3329ac74ed313da13de34)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Allocate the sendbuf in a NUMA aware way
K. Y. Srinivasan [Fri, 29 May 2015 00:08:07 +0000 (17:08 -0700)]
hv_netvsc: Allocate the sendbuf in a NUMA aware way

Allocate the send buffer in a NUMA aware way.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5defde5946676ee23cd6a9d0e1de899410f4a33f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Allocate the receive buffer from the correct NUMA node
K. Y. Srinivasan [Fri, 29 May 2015 00:08:06 +0000 (17:08 -0700)]
hv_netvsc: Allocate the receive buffer from the correct NUMA node

Allocate the receive bufer from the NUMA node assigned to the primary
channel.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0a726c2b499e390b1c1fc3092bd789f2192a2d03)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Properly size the vrss queues
KY Srinivasan [Wed, 27 May 2015 20:16:57 +0000 (13:16 -0700)]
hv_netvsc: Properly size the vrss queues

The current algorithm for deciding on the number of VRSS channels is
not optimal since we open up the min of number of CPUs online and the
number of VRSS channels the host is offering. So on a 32 VCPU guest
we could potentially open 32 VRSS subchannels. Experimentation has
shown that it is best to limit the number of VRSS channels to the number
of CPUs within a NUMA node.

Here is the new algorithm for deciding on the number of sub-channels we
would open up:
        1) Pick the minimum of what the host is offering and what the driver
           in the guest is specifying as the default value.
        2) Pick the minimum of (1) and the numbers of CPUs in the NUMA
           node the primary channel is bound to.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e01ec2199ef22e2cabd7d6e68a192f3eb728029f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus:Update preferred vmbus protocol version to windows 10.
Keith Mange [Tue, 26 May 2015 21:23:01 +0000 (14:23 -0700)]
Drivers: hv: vmbus:Update preferred vmbus protocol version to windows 10.

Add support for Windows 10.

Signed-off-by: Keith Mange <keith.mange@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6c4e5f9c9ff41ea997fd0f345b3b2b88c113eb68)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: use per_cpu stats to calculate TX/RX data
sixiao@microsoft.com [Thu, 14 May 2015 08:00:25 +0000 (01:00 -0700)]
hv_netvsc: use per_cpu stats to calculate TX/RX data

Current code does not lock anything when calculating the TX and RX stats.
As a result, the RX and TX data reported by ifconfig are not accuracy in a
system with high network throughput and multiple CPUs (in my test,
RX/TX = 83% between 2 HyperV VM nodes which have 8 vCPUs and 40G Ethernet).

This patch fixed the above issue by using per_cpu stats.
netvsc_get_stats64() summarizes TX and RX data by iterating over all CPUs
to get their respective stats.

This v2 patch addressed David's comments on the cleanup path when
netdev_alloc_pcpu_stats() failed.

Signed-off-by: Simon Xiao <sixiao@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7eafd9b4005643cfc24f1daf78f4dd56ff71f559)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agohv_netvsc: Use the xmit_more skb flag to optimize signaling the host
KY Srinivasan [Mon, 11 May 2015 22:39:46 +0000 (15:39 -0700)]
hv_netvsc: Use the xmit_more skb flag to optimize signaling the host

Based on the information given to this driver (via the xmit_more skb flag),
we can defer signaling the host if more packets are on the way. This will help
make the host more efficient since it can potentially process a larger batch of
packets. Implement this optimization.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 82fa3c776e5abba7ed6e4b4f4983d14731c37d6a)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: move init_vp_index() call to vmbus_process_offer()
Vitaly Kuznetsov [Thu, 7 May 2015 00:47:45 +0000 (17:47 -0700)]
Drivers: hv: vmbus: move init_vp_index() call to vmbus_process_offer()

We need to call init_vp_index() after we added the channel to the appropriate
list (global or subchannel) to be able to use this information when assigning
the channel to the particular vcpu. To do so we need to move a couple of
functions around. The only real change is the init_vp_index() call. This is a
small refactoring without a functional change.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f38e7dd72337d83cced910cfbf6016475ef85bf7)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: briefly comment num_sc and next_oc
Vitaly Kuznetsov [Thu, 7 May 2015 00:47:43 +0000 (17:47 -0700)]
Drivers: hv: vmbus: briefly comment num_sc and next_oc

next_oc and num_sc fields of struct vmbus_channel deserve a description. Move
them closer to sc_list as these fields are related to it.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit fea844a2b0edd6540d5cde2cd54a8a3c86e9c53f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: unify calls to percpu_channel_enq()
Vitaly Kuznetsov [Thu, 7 May 2015 00:47:42 +0000 (17:47 -0700)]
Drivers: hv: vmbus: unify calls to percpu_channel_enq()

Remove some code duplication, no functional change intended.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8dfd332674758135039d0d2d2a7479934ff0b9c5)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: do cleanup on all vmbus_open() failure paths
Vitaly Kuznetsov [Thu, 7 May 2015 00:47:40 +0000 (17:47 -0700)]
Drivers: hv: vmbus: do cleanup on all vmbus_open() failure paths

In case there was an error reported in the response to the CHANNELMSG_OPENCHANNEL
call we need to do the cleanup as a vmbus_open() user won't be doing it after
receiving an error. The cleanup should be done on all failure paths. We also need
to avoid returning open_info->response.open_result.status as the return value as
all other errors we return from vmbus_open() are -EXXX and vmbus_open() callers
are not supposed to analyze host error codes.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ffc151f3c83c25ec06d5ad13a78d0fc066c7167e)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: vmbus: Implement the protocol for tearing down vmbus state
K. Y. Srinivasan [Thu, 23 Apr 2015 04:31:32 +0000 (21:31 -0700)]
Drivers: hv: vmbus: Implement the protocol for tearing down vmbus state

Implement the protocol for tearing down the monitor state established with
the host.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Tested-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2db84eff127e3f4b3635edc589cd6a56db8755a3)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agodrivers: hv: vmbus: Get rid of some unused definitions
K. Y. Srinivasan [Thu, 23 Apr 2015 04:31:31 +0000 (21:31 -0700)]
drivers: hv: vmbus: Get rid of some unused definitions

Get rid of some unused definitions.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit db9ba2088f6507fee370904f02db1eb9b49bd088)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: fcopy: full handshake support
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:58 +0000 (18:07 -0700)]
Drivers: hv: fcopy: full handshake support

Introduce FCOPY_VERSION_1 to support kernel replying to the negotiation
message with its own version.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit a4d1ee5b0255a135fead1d62a7fc7e6fe718b66e)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoTools: hv: vss: use misc char device to communicate with kernel
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:56 +0000 (18:07 -0700)]
Tools: hv: vss: use misc char device to communicate with kernel

Use /dev/vmbus/hv_vss instead of netlink.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f5722b9bd418e29b7429bd9a43bd100599b26d4f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoTools: hv: kvp: use misc char device to communicate with kernel
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:55 +0000 (18:07 -0700)]
Tools: hv: kvp: use misc char device to communicate with kernel

Use /dev/vmbus/hv_kvp instead of netlink.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8ddca8088586303cfe3db4209a4682f7a4cf7d2d)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: fcopy: convert to hv_utils_transport
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:53 +0000 (18:07 -0700)]
Drivers: hv: fcopy: convert to hv_utils_transport

Unify the code with the recently introduced hv_utils_transport. Netlink
communication is disabled for fcopy.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c7e490fc23eb44e6ae6ab41b9fd450e361f8a01f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: fcopy: set .owner reference for file operations
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:50 +0000 (18:07 -0700)]
Drivers: hv: fcopy: set .owner reference for file operations

Get an additional reference otherwise a crash is observed when hv_utils module is being unloaded while
fcopy daemon is still running. .owner gives us an additional reference when
someone holds a descriptor for the device.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3f0dccf86cab38d96b67efdfc944954f5490d057)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: fcopy: switch to using the hvutil_device_state state machine
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:49 +0000 (18:07 -0700)]
Drivers: hv: fcopy: switch to using the hvutil_device_state state machine

Switch to using the hvutil_device_state state machine from using 3 different state variables:
fcopy_transaction.active, opened, and in_hand_shake.

State transitions are:
-> HVUTIL_DEVICE_INIT when driver loads or on device release
-> HVUTIL_READY if the handshake was successful
-> HVUTIL_HOSTMSG_RECEIVED when there is a non-negotiation message from the host
-> HVUTIL_USERSPACE_REQ after userspace daemon read the message
   -> HVUTIL_USERSPACE_RECV after/if userspace has replied
-> HVUTIL_READY after we respond to the host
-> HVUTIL_DEVICE_DYING on driver unload

In hv_fcopy_onchannelcallback() process ICMSGTYPE_NEGOTIATE messages even when
the userspace daemon is disconnected, otherwise we can make the host think
we don't support FCOPY and disable the service completely.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 4c93ccccf47e32d605b81207eb575cce3b12facc)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: fcopy: rename fcopy_work -> fcopy_timeout_work
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:45 +0000 (18:07 -0700)]
Drivers: hv: fcopy: rename fcopy_work -> fcopy_timeout_work

'fcopy_work' (and fcopy_work_func) is a misnomer as it sounds like we expect
this useful work to happen and in reality it is just an emergency escape when
timeout happens.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1d072339fa9e32365d282d8ade32822de7d21e5f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: fcopy: process deferred messages when we complete the transaction
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:42 +0000 (18:07 -0700)]
Drivers: hv: fcopy: process deferred messages when we complete the transaction

In theory, the host is not supposed to issue any requests before be reply to
the previous one. In KVP we, however, support the following scenarios:
1) A message was received before userspace daemon registered;
2) A message was received while the previous one is still being processed.
In FCOPY we support only the former. Add support for the later, use
hv_poll_channel() to do the job.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 242f31221d48793d07e161bc668e1aabd502c18b)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: kvp: switch to using the hvutil_device_state state machine
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:47 +0000 (18:07 -0700)]
Drivers: hv: kvp: switch to using the hvutil_device_state state machine

Switch to using the hvutil_device_state state machine from using 2 different state variables: kvp_transaction.active and
in_hand_shake.

State transitions are:
-> HVUTIL_DEVICE_INIT when driver loads or on device release
-> HVUTIL_READY if the handshake was successful
-> HVUTIL_HOSTMSG_RECEIVED when there is a non-negotiation message from the host
-> HVUTIL_USERSPACE_REQ after we sent the message to the userspace daemon
   -> HVUTIL_USERSPACE_RECV after/if the userspace daemon has replied
-> HVUTIL_READY after we respond to the host
-> HVUTIL_DEVICE_DYING on driver unload

In hv_kvp_onchannelcallback() process ICMSGTYPE_NEGOTIATE messages even when
the userspace daemon is disconnected, otherwise we can make the host think
we don't support KVP and disable the service completely.

Unfortunately there is no good way we can figure out that the userspace daemon
has died (unless we start treating all timeouts as such). In case the daemon
restarts we skip the negotiation procedure (so the daemon is supposed to has
the same version). This behavior is unchanged from in_handshake approach.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 97bf16cd309805ebf82ffcc4063a65e06169651f)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: kvp: rename kvp_work -> kvp_timeout_work
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:44 +0000 (18:07 -0700)]
Drivers: hv: kvp: rename kvp_work -> kvp_timeout_work

'kvp_work' (and kvp_work_func) is a misnomer as it sounds like we expect
this useful work to happen and in reality it is just an emergency escape when
timeout happens.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 68c8b39a0db71e0e76295bf277e8280ae36e7c10)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: kvp: move poll_channel() to hyperv_vmbus.h
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:41 +0000 (18:07 -0700)]
Drivers: hv: kvp: move poll_channel() to hyperv_vmbus.h

Move poll_channel() to hyperv_vmbus.h and make it inline and rename it to hv_poll_channel() so it can be reused
in other hv_util modules.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8efe78fdb1490e271615fab32433ebc0f15fa822)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: util: move kvp/vss function declarations to hyperv_vmbus.h
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:39 +0000 (18:07 -0700)]
Drivers: hv: util: move kvp/vss function declarations to hyperv_vmbus.h

These declarations are internal to hv_util module and hv_fcopy_* declarations
already reside there.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3647a83d9dcf00b8e17777ec8aa1e48f1ed4fe06)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoDrivers: hv: kvp: reset kvp_context
Vitaly Kuznetsov [Sun, 12 Apr 2015 01:07:40 +0000 (18:07 -0700)]
Drivers: hv: kvp: reset kvp_context

We set kvp_context when we want to postpone receiving a packet from vmbus due
to the previous transaction being unfinished. We, however, never reset this
state, all consequent kvp_respond_to_host() calls will result in poll_channel()
calling hv_kvp_onchannelcallback(). This doesn't cause real issues as:
1) Host is supposed to serialize transactions as well
2) If no message is pending vmbus_recvpacket() will return 0 recvlen.
This is just a cleanup.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 5fa97480b9b125bb9bdb446930289b3274ed7eb7)

Orabug: 21886720
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agonet/mlx4_core: Fix FMR unmapping to allow remapping afterward
Maor Gottlieb [Mon, 27 Apr 2015 10:47:56 +0000 (13:47 +0300)]
net/mlx4_core: Fix FMR unmapping to allow remapping afterward

According to device spec we only need to set ownership bit to SW at FMR
unmap, all other stuff we did are redundant and not essential.

This fix is ported from Mellanox OFED 3.1.

It covers some of the same issues fixed in UEK2 with the
following UEK2 commits:
 bbdc2821db04 "mlx4_core: Avoid recycling old FMR R_Keys too soon"
 5bddb281c0f1 "mlx4_ib: unmap FMR should update MPT status to 0xF"

Following comments from bbdc2821db04 patch by Olaf Kirch <okir@lst.de>
adds more useful information about impact of this change on RDS usage
in Oracle applications and copied here to retain useful context.

    When a FMR is unmapped, mlx4 resets the map count to 0, and clears the
    upper part of the R_Key which is used as the sequence counter.

    This poses a problem for RDS, which uses ib_fmr_unmap as a fence
    operation.  RDS assumes that after issuing an unmap, the old R_Keys
    will be invalid for a "reasonable" period of time. For instance,
    Oracle processes uses shared memory buffers allocated from a pool of
    buffers.  When a process dies, we want to reclaim these buffers -- but
    we must make sure there are no pending RDMA operations to/from those
    buffers.  The only way to achieve that is by using unmap and sync the
    TPT.

    However, when the sequence count is reset on unmap, there is a high
    likelihood that a new mapping will be given the same R_Key that was
    issued a few milliseconds ago.

    To prevent this, don't reset the sequence count when unmapping a FMR.

Orabug: 21473880

Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
9 years agoIPoIB: Protect tx_outstanding from parallel access
Wengang Wang [Fri, 15 Jan 2016 07:53:46 +0000 (15:53 +0800)]
IPoIB: Protect tx_outstanding from parallel access

Orabug: 22217400(UEK4)
quick ref: 21861366(UEK2) 22217399(UEK3)

In IPoIB code, parallel access of tx_outstanding (send path VS event
process path) needs to be serialized. We use priv->lock to protect it. We
also use that lock to make the stop/open tx queue to be atomic with the
changing on tx_outstanding to protect the race between the opening of tx
queue from completion hander and the closing from the send path.

This patch also make sure the increase of tx_outstanding prior to the
calling of post_send to avoid the possible decreasing before increasing in
case the running of increasing is scheduled later than the event handler.

Impact on Throuput is ~1.5% drop.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
9 years agoRevert "i40e: Set defport behavior for the Main VSI when in promiscuous mode"
Brian Maly [Mon, 25 Jan 2016 15:53:22 +0000 (10:53 -0500)]
Revert "i40e: Set defport behavior for the Main VSI when in promiscuous mode"

Orabug: 22519254

This reverts mainline commit c0496c116b2d6a53f67e1795beca6e7f319a1657.

Conflicts:
drivers/net/ethernet/intel/i40e/i40e_main.c
Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoscsi: Fix a bdi reregistration race
Bart Van Assche [Sat, 19 Sep 2015 00:23:42 +0000 (17:23 -0700)]
scsi: Fix a bdi reregistration race

Unregister and reregister BDI devices in the proper order. This patch
avoids that the following kernel warning can get triggered:

WARNING: CPU: 7 PID: 203 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80()
sysfs: cannot create duplicate filename '/devices/virtual/bdi/8:32'
Workqueue: events_unbound async_run_entry_fn
Call Trace:
[<ffffffff814ff5a4>] dump_stack+0x4c/0x65
[<ffffffff810746ba>] warn_slowpath_common+0x8a/0xc0
[<ffffffff81074736>] warn_slowpath_fmt+0x46/0x50
[<ffffffff81237ca8>] sysfs_warn_dup+0x68/0x80
[<ffffffff81237d8e>] sysfs_create_dir_ns+0x7e/0x90
[<ffffffff81291f58>] kobject_add_internal+0xa8/0x320
[<ffffffff812923a0>] kobject_add+0x60/0xb0
[<ffffffff8138c937>] device_add+0x107/0x5e0
[<ffffffff8138d018>] device_create_groups_vargs+0xd8/0x100
[<ffffffff8138d05c>] device_create_vargs+0x1c/0x20
[<ffffffff8117f233>] bdi_register+0x63/0x2a0
[<ffffffff8117f497>] bdi_register_dev+0x27/0x30
[<ffffffff81281549>] add_disk+0x1a9/0x4e0
[<ffffffffa00c5739>] sd_probe_async+0x119/0x1d0 [sd_mod]
[<ffffffff8109a81a>] async_run_entry_fn+0x4a/0x140
[<ffffffff81091078>] process_one_work+0x1d8/0x7c0
[<ffffffff81091774>] worker_thread+0x114/0x460
[<ffffffff81097878>] kthread+0xf8/0x110
[<ffffffff8150801f>] ret_from_fork+0x3f/0x70

See also patch "block: destroy bdi before blockdev is unregistered"
(commit ID 6cd18e711dd8).

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit bf2cf3baa20b0a6cd2d08707ef05dc0e992a8aa0)

Orabug: 22250360
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
Conflicts:
drivers/scsi/scsi_sysfs.c

9 years agoi40e: Fix for recursive RTNL lock during PROMISC change
Anjali Singhai [Mon, 28 Sep 2015 20:37:12 +0000 (13:37 -0700)]
i40e: Fix for recursive RTNL lock during PROMISC change

The sync_vsi_filters function can be called directly under RTNL
or through the timer subtask without one. This was causing a deadlock.

If sync_vsi_filters is called from a thread which held the lock,
and in another thread the PROMISC setting got changed we would
be executing the PROMISC change in the thread which already held
the lock alongside the other filter update. The PROMISC change
requires a reset if we are on a VEB, which requires it to be called
under RTNL.

Earlier the driver would call reset for PROMISC change without
checking if we were already under RTNL and would try to grab it
causing a deadlock. This patch changes the flow to see if we are
already under RTNL before trying to grab it.

Orabug: 22328907

Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Guru Anbalagane <guru.anbalagane@oracle.com>
9 years agoixgbe: make a workaround to tx hang issue under dom
Ethan Zhao [Wed, 9 Dec 2015 10:50:41 +0000 (02:50 -0800)]
ixgbe: make a workaround to tx hang issue under dom

report 1 tx queue to net core to workaround the tx hang
issue reported in Xen  environment.
The change is only limited to dom0 and baremetal is left unchanged.

Orabug: 22171500
Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
Signed-off-by: Guru Anbalagane <guru.anbalagane@oracle.com>
9 years agoi40e: relax fw api minor version for fortville 4 nvm image
Brian Maly [Wed, 21 Oct 2015 21:04:10 +0000 (17:04 -0400)]
i40e: relax fw api minor version for fortville 4 nvm image

Orabug: 22074738

Change I40E_FW_API_VERSION_MINOR to be consistent with 1.3.38
sourceforge driver. Currently i40e driver is reporting NVM
image is too old with the latest production image from 1.3.38.

Signed-off-by: Brian Maly <brian.maly@oracle.com>
9 years agoMerge tag 'v4.1.10-18#bug22013781v1' of git://ca-git.us.oracle.com/linux-etzhao-publi...
Santosh Shilimkar [Fri, 23 Oct 2015 16:24:38 +0000 (09:24 -0700)]
Merge tag 'v4.1.10-18#bug22013781v1' of git://ca-git.us.oracle.com/linux-etzhao-public into topic/uek-4.1/drivers

9 years agoMerge tag 'v4.1.10-18#bug22066190v1' of git://ca-git.us.oracle.com/linux-etzhao-publi...
Santosh Shilimkar [Fri, 23 Oct 2015 16:21:32 +0000 (09:21 -0700)]
Merge tag 'v4.1.10-18#bug22066190v1' of git://ca-git.us.oracle.com/linux-etzhao-public into topic/uek-4.1/drivers

9 years agoMerge tag '4.1.6-12#22066196a1' of git://ca-git.us.oracle.com/linux-dduval-public...
Santosh Shilimkar [Thu, 22 Oct 2015 16:14:24 +0000 (09:14 -0700)]
Merge tag '4.1.6-12#22066196a1' of git://ca-git.us.oracle.com/linux-dduval-public into topic/uek-4.1/drivers

9 years agobnx2i: Fix call trace while device reset
Nilesh Javali [Tue, 19 May 2015 09:51:58 +0000 (05:51 -0400)]
bnx2i: Fix call trace while device reset

Orabug: 22066191

The driver waits for command completion event while cleanup of task
within the frwd lock and back locks. The frwd lock was still held
which caused the call trace while issuing a device reset.
Release the frwd lock along with the back lock
to avoid waiting in the lock context.

Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 35843048e7e979df3b7b9f2ad49e21797a11386b)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agobnx2i: Fixed firmware assert, during target logout.
Tej Parkash [Tue, 19 May 2015 09:51:57 +0000 (05:51 -0400)]
bnx2i: Fixed firmware assert, during target logout.

Orabug: 22066191

Fix the firmware assert, during target logout in
case driver received FIN from target before waiting for
asyncronous response.

Signed-off-by: Tej Parkash <tej.parkash@qlogic.com>
Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 5fc956c243852608db1e4ef74b92bb4445313912)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agoMerge branch 'topic-uek-4.1-drivers-b182e071.bug22029622' of git://ca-git.us.oracle...
Santosh Shilimkar [Thu, 22 Oct 2015 15:37:40 +0000 (08:37 -0700)]
Merge branch 'topic-uek-4.1-drivers-b182e071.bug22029622' of git://ca-git.us.oracle.com/linux-chander-public into topic/uek-4.1/drivers

9 years agoMerge tag 'v4.1.10-18#bug22049739' of git://ca-git.us.oracle.com/linux-zhaluo-public...
Santosh Shilimkar [Thu, 22 Oct 2015 15:36:23 +0000 (08:36 -0700)]
Merge tag 'v4.1.10-18#bug22049739' of git://ca-git.us.oracle.com/linux-zhaluo-public into topic/uek-4.1/drivers

9 years agofnic: Updating fnic driver version.
Jason Luo [Thu, 22 Oct 2015 06:23:50 +0000 (14:23 +0800)]
fnic: Updating fnic driver version.

From: Narsimhulu Musini <nmusini@cisco.com>

Update the driver versioin

Orabug: 22049739

Conflict:
    drivers/scsi/fnic/fnic.h

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agofnic: fix for fnic crash when blk-mq enabled in UEK4
Jason Luo [Thu, 22 Oct 2015 06:23:04 +0000 (14:23 +0800)]
fnic: fix for fnic crash when blk-mq enabled in UEK4

From: Narsimhulu Musini <nmusini@cisco.com>

fnic driver hits crash on accessing global tag set when blk-mq enabled.
fix disables blk-mq support for fnic.

Orabug: 22049739

Signed-off-by: Narsimhulu Musini <nmusini@cisco.com>
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agoMerge branch 'uek4-avago' of git://ca-git.us.oracle.com/linux-mkp-public into topic...
Santosh Shilimkar [Wed, 21 Oct 2015 00:53:40 +0000 (17:53 -0700)]
Merge branch 'uek4-avago' of git://ca-git.us.oracle.com/linux-mkp-public into topic/uek-4.1/drivers

* 'uek4-avago' of git://ca-git.us.oracle.com/linux-mkp-public: (76 commits)
  mpt3sas : Bump mpt3sas driver version to 9.100.00.00
  mpt3sas: When device is blocked followed by unblock fails, unfreeze the I/Os
  mpt3sas: Call dma_mapping_error() API after mapping an address with dma_map_single() API
  mpt3sas: Use alloc_ordered_workqueue() API instead of create_singlethread_workqueue() API
  mpt3sas: Added support for customer specific branding
  mpt3sas: Return host busy error status to SML when DMA mapping of scatter gather list fails for a SCSI command
  mpt3sas: Complete the SCSI command with DID_RESET status for log_info value 0x0x32010081
  mpt3sas: MPI 2.5 Rev K (2.5.6) specifications
  mpt3sas: Bump mpt3sas driver version to v6.100.00.00
  mpt3sas: Add branding string support for OEM custom HBA
  mpt3sas: Add branding string support for OEM's HBA
  mpt3sas: MPI 2.5 Rev J (2.5.5) specification and 2.00.34 header files
  mpt3sas: Update MPI2 strings to MPI2.5
  mpt3sas: Bump mpt3sas Driver version to v5.100.00.00
  mpt3sas: Provides the physical location of sas drives
  mpt3sas: MPI 2.5 Rev I (2.5.4) specifications.
  mpt3sas: Remove redundancy code while freeing the controller resources.
  mpt3sas: Don't block the drive when drive addition under the control of SML
  mpt3sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state.
  mpt3sas: Added Combined Reply Queue feature to extend up-to 96 MSIX vector support
  ...

9 years agompt3sas : Bump mpt3sas driver version to 9.100.00.00
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:06 +0000 (12:25 +0530)]
mpt3sas : Bump mpt3sas driver version to 9.100.00.00

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit c75683ca13d12a700531864bcd3118e94bc9eaa0)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: When device is blocked followed by unblock fails, unfreeze the I/Os
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:05 +0000 (12:25 +0530)]
mpt3sas: When device is blocked followed by unblock fails, unfreeze the I/Os

Issue: When the disks are getting discovered and assigned device
handles by the kernel, a device block followed by an unblock
(due to broadcast primitives) issued by the driver is
interspersed by the kernel changing the state of the device.
Therefore the unblock by the driver results in a no operation
within the kernel API.

To fix this one, the below patch checks the return of the unblock API
and performs a block followed by an unblock to unfreeze the block
layer's I/O queue. Sufficient checks and prints are also added in the
driver to identify this condition caused by the kernel.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit df838f92f3f5240dca54e1629e8547818e8ea646)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Call dma_mapping_error() API after mapping an address with dma_map_single...
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:04 +0000 (12:25 +0530)]
mpt3sas: Call dma_mapping_error() API after mapping an address with dma_map_single() API

Added dma_mapping_error() API after mapping an address with dma_map_single()
API.  Otherwise when CONFIG_DMA_API_DEBUG is enabled in the kernel, then it
complains about mpt3sas driver not calling dma_mapping_error after mapping an
address with dma_map_single

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 36814028ad720165a6febcf9ddd7de20833fd240)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Use alloc_ordered_workqueue() API instead of create_singlethread_workqueue...
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:03 +0000 (12:25 +0530)]
mpt3sas: Use alloc_ordered_workqueue() API instead of create_singlethread_workqueue() API

Created a thread using alloc_ordered_workqueue() API in order to process
the works from firmware Work-queue sequentially instead of
create_singlethread_workqueue() API.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit bdff785e4f593218816fa3677e043aae1481aa98)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Added support for customer specific branding
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:02 +0000 (12:25 +0530)]
mpt3sas: Added support for customer specific branding

"VendorID"   "DeviceID"  "SubsystemVendor ID"   "SubsystemDevice ID"  Cisco Branding String
0x1000         0x97           0x1137                 0x154           Cisco 9300-8i 12Gbps SAS HBA
0x1000         0x97           0x1137                 0x155           Cisco 12G Modular SAS Pass through Controller
0x1000         0x97           0x1137                 0x156           UCS C3X60 12G SAS Pass through Controller

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit d8eb4a47c70b4bab34b938d2f682044687f53c64)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Return host busy error status to SML when DMA mapping of scatter gather...
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:01 +0000 (12:25 +0530)]
mpt3sas: Return host busy error status to SML when DMA mapping of scatter gather list fails for a SCSI command

scsi_dma_map API will return a negative value (i.e. -ENOMEM)
if DMA mapping of sg lists fails and zero if the sg list in the
SCSI cmd is NULL. But drivers doesn't handled sg list DMA mapping
failure case properly.

So, Updated the code to return host busy error status to SCSI MID Layer(SML),
when DMA mapping of scatter gather list fails for a SCSI command.
So that SML will retry this SCSI cmd after some time.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 62f5c74c97037c7c00fdefb69dcfe39810c34a05)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Complete the SCSI command with DID_RESET status for log_info value 0x0x32010081
Sreekanth Reddy [Tue, 30 Jun 2015 06:55:00 +0000 (12:25 +0530)]
mpt3sas: Complete the SCSI command with DID_RESET status for log_info value 0x0x32010081

For any SCSI command, if the driver receives
IOC status = SCSI_IOC_TERMINATED and log info = 0x32010081 then
that command will be completed with DID_RESET host status.

The definition of this log info value is
"Virtual IO has failed and has to be retried".

Firmware will provide this log info value with IOC Status
"SCSI_IOC_TERMINATED", whenever a drive (with is a part of a volume)
is pulled and pushed back within some minimal delay.
With this log info value, firmware informs the driver to retry the
failed IO command infinite times, so to provide some time for the
firmware to discover the reinserted drive successfully instated of
just retrying failed command for five times(doesn't giving enough
time for firmware to complete the drive discovery) and failing the
IO permanently even though drive came back successfully.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 3898f08e8ccfc8b7b4c297960ecdde970869e950)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: MPI 2.5 Rev K (2.5.6) specifications
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:59 +0000 (12:24 +0530)]
mpt3sas: MPI 2.5 Rev K (2.5.6) specifications

Below are the new changes to MPI 2.5 Rev K(2.5.6) specification and 2.00.35
header files

1) Added a minimum size requirement for target mode command buffers.

2) Added MinMSIxIndex and MaxMSIxIndex fields to CommandBufferPostBase
   Request.

3) For BIOS Page 1, added SSUTimeout field, and added Product Name String
   Format bits to the BiosOptions field

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit a6f84009b9d7ca97c400ca929f9d58f43b0ece9d)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Bump mpt3sas driver version to v6.100.00.00
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:58 +0000 (12:24 +0530)]
mpt3sas: Bump mpt3sas driver version to v6.100.00.00

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 2b89669ae4addfa68a58e0fc16afdd24739720d8)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Add branding string support for OEM custom HBA
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:57 +0000 (12:24 +0530)]
mpt3sas: Add branding string support for OEM custom HBA

Add the following OEM's branding to the mpt3sas driver.

"VendorID"   "DeviceID"  "SubsystemVendor ID"   "SubsystemDevice ID"  Cisco Branding String
0x1000         0x97         SVID = 0x1137             0x014C          Cisco 9300-8E 12G SAS HBA

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 38e4141ecb0e59c93d85ec5948f98d1f1e331a88)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Add branding string support for OEM's HBA
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:56 +0000 (12:24 +0530)]
mpt3sas: Add branding string support for OEM's HBA

Added the following Dell branding to the mpt3sas driver.

"VendorID"   "DeviceID"  "SubsystemVendor ID"  "SubsystemDevice ID"  Dell Branding String
0x1000        0x0097          0x1028                 0x1F46            DELL 12Gbps HBA

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit fb84dfc44718ef4099a827d147f738e428828d02)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: MPI 2.5 Rev J (2.5.5) specification and 2.00.34 header files
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:55 +0000 (12:24 +0530)]
mpt3sas: MPI 2.5 Rev J (2.5.5) specification and 2.00.34 header files

Following is the change set,

1. Added more defines for the BiosOptions field of MPI2_CONFIG_PAGE_BIOS_1.

2. Added MPI2_TOOLBOX_CLEAN_BIT26_PRODUCT_SPECIFIC definition.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 35c319b47884e49d9d0a84779097916ccb173947)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Update MPI2 strings to MPI2.5
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:54 +0000 (12:24 +0530)]
mpt3sas: Update MPI2 strings to MPI2.5

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 2e26c3853206ba166c3434e5f2ca4c82078ad84e)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Bump mpt3sas Driver version to v5.100.00.00
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:53 +0000 (12:24 +0530)]
mpt3sas: Bump mpt3sas Driver version to v5.100.00.00

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit f9d81cfc23151eb6e9e498663c9784c351646d0e)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Provides the physical location of sas drives
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:52 +0000 (12:24 +0530)]
mpt3sas: Provides the physical location of sas drives

This Patch will provide more details of the devices such as slot number,
enclosure logical id, enclosure level & connector name in the following
scenarios,

- When end device is added in the topology,

- When the end device is removed from the setup,

- When the SCSI mid layer issues TASK ABORT/ DEVICE RESET/ TARGET RESET during
  error handling,

- When any command to the device fails with Sense key Hardware error or Medium
  error or Unit Attention,

- When firmware returns device error or device not ready status for the end
  device,

- When a Predicted fault is detected on an end device.

This information can be used by the user to identify the location of the
desired drive in the topology.

Driver will get these information by reading the sas device page0.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit e6d45e3e7e6582fa206ef84631639ce70d50e5c5)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: MPI 2.5 Rev I (2.5.4) specifications.
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:51 +0000 (12:24 +0530)]
mpt3sas: MPI 2.5 Rev I (2.5.4) specifications.

Update MPI 2.5 Release: MPI 2.5 Rev I (2.5.4) specification and 2.00.33 header
files

Below is the change set from the MPI specification for I Rev

1) Added Base Enclosure Level bit to the Flags field of Manufacturing Page 7.

2) Updated description of the MaxTargetPortConnectTime field of SAS IO Unit
   Page 1.

3) Added EnclosureLevel and ConnectorName fields to SAS Device Page 0. Also,
   added EnclosureLevel and ConnectorName Valid bit to the Flags field.

4) Added EnclosureLevel field to SAS Enclosure Page 0. Also, added
   EnclosureLevel Valid bit to the Flags field.

5) Added value for BIOS image to HashImageType.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit a94bea343c2f747c62ef66b52d2430e6aeb75434)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Remove redundancy code while freeing the controller resources.
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:50 +0000 (12:24 +0530)]
mpt3sas: Remove redundancy code while freeing the controller resources.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 580d4e3153f0d7a9a9235b675b0b7b13e2185a8b)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Don't block the drive when drive addition under the control of SML
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:49 +0000 (12:24 +0530)]
mpt3sas: Don't block the drive when drive addition under the control of SML

During hot-plugging of a disk(having a flaky link), the disk addition
stops and any further disk addition or removal doesn't happen on that
controller.

This is because, when driver receives DELAY_NOT_RESPONDING event for a disk
while it is undergoing addition at the SCSI Transport layer, the driver
would block the I/O to that disk resulting in a deadlock. i.e the disk
addition work couldn't be completed at the SCSI Transport Layer as it
can't send any I/Os (such as Inquiry, Report LUNs etc) to the disk as
I/Os are blocked to this drive. Also any subsequent device removal
(TARGET_NOT_RESPONDING) or link update(RC_PHY_CHANGED) event couldn't be
processed as they are in the queue to get processed after disk addition
event.

Description of Change:
Don't block the drive when drive addition is under the control of SML.
So that SML won't be blocked of issuing the device dicovery commands
(such as Inquiry, Report LUNs etc).

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit e4bc7f5c21a18cab9acd30940df0ee791fcd7b9e)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Get IOC_FACTS information using handshake protocol only after HBA card gets...
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:48 +0000 (12:24 +0530)]
mpt3sas: Get IOC_FACTS information using handshake protocol only after HBA card gets into READY or Operational state.

Driver initialization fails if driver tries to send IOC facts request message
when the IOC is in reset or in a fault state.

This patch will make sure that

 1.Driver to send IOC facts request message only if HBA is in operational or
   ready state.

 2.If IOC is in fault state, a diagnostic reset would be issued.

 3.If IOC is in reset state then driver will wait for 10 seconds to exit out
   of reset state.  If the HBA continues to be in reset state, then the HBA
   wouldn't be claimed by the driver.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 4dc8c8087f0304ff8d06f862520406b11aac4a66)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt3sas: Added Combined Reply Queue feature to extend up-to 96 MSIX vector support
Sreekanth Reddy [Tue, 30 Jun 2015 06:54:47 +0000 (12:24 +0530)]
mpt3sas: Added Combined Reply Queue feature to extend up-to 96 MSIX vector support

In this patch, increased the number of MSIX vector support for SAS3 C0 HBAs to
up-to 96.

Following are changes that are done in this patch

1. This feature is enabled only for SAS3 C0 and higher revision cards and also
only when reply post free queue count is greater than 8.

2. To support this feature 12 SupplementalReplyPostHostIndex system interfaces
are used. MSI-X index numbered from 0 to 7 use the first
SupplementalReplyPostHostIndex system interface to update its corresponding
ReplyPostHostIndex values, MSI-X index numbered from 8 to 15 will use the
second SupplementalReplyPostHostIndex system interface and so on. These 12
SuppementalReplyPostHostIndex system interfaces address are saved in the array
replyPostRegisterIndex[].

3. As each SupplementalReplyPostHostIndex register supports 8 MSI-X
vectors. So MSIxIndex field in these register must contain a value between 0
and 7.

4. After processing the reply descriptors from a reply post free queues then
update the new reply post host index value in ReplyPostHostIndex field and
(msix_index mod 8) value in MSIxIndex field of SupplementalReplyPostHostIndex
register. The Address of this SupplementalReplyPostHostIndex register is
retrived from (msix_index/8)th entry of replyPostRegisterIndex[] array.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit fb77bb5376a55f4e6c8d9243249e82831a276ee5)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
9 years agompt2sas: Refcount fw_events and fix unsafe list usage
Calvin Owens [Fri, 14 Aug 2015 01:48:10 +0000 (18:48 -0700)]
mpt2sas: Refcount fw_events and fix unsafe list usage

The fw_event_work struct is concurrently referenced at shutdown, so
add a refcount to protect it, and refactor the code to use it.

Additionally, refactor _scsih_fw_event_cleanup_queue() such that it
no longer iterates over the list without holding the lock, since
_firmware_event_work() concurrently deletes items from the list.

Signed-off-by: Calvin Owens <calvinowens@fb.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
Tested-by: Chaitra Basappa <chaitra.basappa@avagotech.com>
Acked-by: Sreekanth Reddy <sreekanth.reddy@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 008549f6e8a1dc4aeea4a8d64184909786b27713)
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>