]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
9 years agobe2iscsi: Fix to use atomic bit operations for tag_state
Jitendra Bhivare [Wed, 20 Jan 2016 08:40:47 +0000 (14:10 +0530)]
be2iscsi: Fix to use atomic bit operations for tag_state

Orabug: 22725588

beiscsi_mccq_compl sets MCC_TAG_STATE_TIMEOUT before setting up
tag_mem_state. be_mcc_compl_process_isr checks for MCC_TAG_STATE_TIMEOUT
first then accesses tag_mem_state which might be still getting populated
in the process context.

Fix: Set MCC_TAG_STATE_TIMEOUT after tag_mem_state is populated.
Removed MCC_TAG_STATE_COMPLETED. When posted its in running state and
the running state is cleared in be_mcc_compl_process_isr.  be_mcc_notify
now takes tag argument to set it to running state.  Use bit operations
for tag_state. Use barriers before setting the state.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agobe2iscsi: Fix mbox synchronization replacing spinlock with mutex
Jitendra Bhivare [Wed, 20 Jan 2016 08:40:46 +0000 (14:10 +0530)]
be2iscsi: Fix mbox synchronization replacing spinlock with mutex

Orabug: 22725588

This is second part of actual fix for soft lockup.

All mbox cmds issued using BMBX and MCC are synchronized using mutex
mbox_lock instead of spin_lock. Used mutex_lock_interruptible where ever
possible.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agobe2iscsi: Fix soft lockup in mgmt_get_all_if_id path using bmbx
Jitendra Bhivare [Wed, 20 Jan 2016 08:40:45 +0000 (14:10 +0530)]
be2iscsi: Fix soft lockup in mgmt_get_all_if_id path using bmbx

Orabug: 22725588

We are taking mbox_lock spinlock which disables pre-emption before we
poll for mbox completion. Waiting there with spinlock held in excess of
20s will cause soft lockup.

Actual fix is to change mbox_lock to mutex. The changes are done in
phases. This is the first part.

1. Changed mgmt_get_all_if_id to use MCC where after posting lock is
released.

2. Changed be_mbox_db_ready_wait to busy wait for 12s max and removed
wait_event_timeout. Added error handling code for IO reads.
OPCODE_COMMON_QUERY_FIRMWARE_CONFIG mbox command takes 8s time when
unreachable boot targets configured.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agobe2iscsi: Fix bogus WARN_ON length check
Tim Gardner [Fri, 30 Oct 2015 18:22:58 +0000 (12:22 -0600)]
be2iscsi: Fix bogus WARN_ON length check

Orabug: 22725588

drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous':
drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
  WARN_ON(!length > 0);

gcc version 5.2.1

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Cc: Jayamohan Kallickal <jayamohan.kallickal@avagotech.com>
Cc: Minh Tran <minh.tran@avagotech.com>
Cc: John Soni Jose <sony.john-n@avagotech.com>
Cc: "James E.J. Bottomley" <JBottomley@odin.com>
Reported-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agoscsi_transport_iscsi: Add 25G and 40G speed definition
Jitendra Bhivare [Wed, 20 Jan 2016 08:40:57 +0000 (14:10 +0530)]
scsi_transport_iscsi: Add 25G and 40G speed definition

Orabug: 22725588

iscsi_port_speed and iscsi_port_speed_names have new entries for
25Gbps and 40Gbps link speeds.

Signed-off-by: Jitendra Bhivare <jitendra.bhivare@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agobe2iscsi : Fix the retry count for boot targets
John Soni Jose [Sat, 25 Apr 2015 02:46:57 +0000 (08:16 +0530)]
be2iscsi : Fix the retry count for boot targets

Orabug: 22725588

 Increment the retry count to get the boot target info when
 port async event is received by the driver. Update sysfs enteries
 with the boot target  parameters.

Signed-off-by: Minh Tran <minhduc.tran@emulex.com>
Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agobe2net: don't report EVB for older chipsets when SR-IOV is disabled
Ivan Vecera [Thu, 11 Feb 2016 11:42:26 +0000 (12:42 +0100)]
be2net: don't report EVB for older chipsets when SR-IOV is disabled

The EVB (virtual bridge) functionality should be disabled on older BE3
and Lancer chips if SR-IOV is disabled in the NIC's BIOS. This setting
is identified by the zero value of total VFs reported by the card.
The GET_HSW_CONFIG command cannot be used as it is not supported by
these older chipset's FW.

v2: added the comment

Cc: Sathya Perla <sathya.perla@broadcom.com>
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>
Cc: Padmanabh Ratnakar <padmanabh.ratnakar@broadcom.com>
Cc: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Sathya Perla <sathya.perla@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug : 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Interpret and log new data that's added to the port misconfigure async event
Ajit Khaparde [Wed, 10 Feb 2016 17:15:54 +0000 (22:45 +0530)]
be2net: Interpret and log new data that's added to the port misconfigure async event

will carry more information about the event in the "data_word1"
and "data_word2" fields. This patch adds support in the driver to parse the
new information and log it accordingly. This patch also changes some of the
messages that are being logged currently.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Request RSS capability of Rx interface depending on number of Rx rings
Ajit Khaparde [Wed, 10 Feb 2016 17:15:53 +0000 (22:45 +0530)]
be2net: Request RSS capability of Rx interface depending on number of Rx rings

Currently we request RSS capability even if a single Rx ring is created.
As a result in few cases we unnecessarily consume an RSS capable interface
which is a limited resource in the chip.
This patch enables RSS on an interface only if more than one Rx ring
is created.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Fix interval calculation in interrupt moderation
Padmanabh Ratnakar [Wed, 3 Feb 2016 04:19:23 +0000 (09:49 +0530)]
be2net: Fix interval calculation in interrupt moderation

Interrupt moderation parameters need to be recalculated only
after a time interval of 1 ms. Interval calculation is wrong
when there is a rollover of jiffies. Using recommended way of interval
calculation using jiffies to fix this.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Add retry in case of error recovery failure
Padmanabh Ratnakar [Wed, 3 Feb 2016 04:19:22 +0000 (09:49 +0530)]
be2net: Add retry in case of error recovery failure

Retry error recovery MAX_ERR_RECOVERY_RETRY_COUNT times in case of
failure during error recovery.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Fix Lancer error recovery
Padmanabh Ratnakar [Wed, 3 Feb 2016 04:19:21 +0000 (09:49 +0530)]
be2net: Fix Lancer error recovery

After error is detected, wait for adapter to move to ready state
before destroying queues and cleanup of other resources. Also
skip performing any cleanup for non-Lancer chips and move debug
messages to correct routine.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Don't run ethtool self-tests for VFs
Somnath Kotur [Wed, 3 Feb 2016 04:19:20 +0000 (09:49 +0530)]
be2net: Don't run ethtool self-tests for VFs

The CMD_SUBSYSTEM_LOWLEVEL cmds need DEV_CFG Privilege to run
which VFs don't have by default.
Self-tests need to be issued only for PFs.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: SRIOV Queue distribution should factor in EQ-count of VFs
Sriharsha Basavapatna [Wed, 3 Feb 2016 04:19:19 +0000 (09:49 +0530)]
be2net: SRIOV Queue distribution should factor in EQ-count of VFs

The SRIOV resource distribution logic for RX/TX queue counts is not optimal
when a small number of VFs are enabled. It does not take into account the
VF's EQ count while computing the queue counts. Because of this, the VF
gets a large number of queues, though it doesn't have sufficient EQs,
resulting in wasted queue resources. And the PF gets a smaller share of
queues though it has more EQs. Fix this by capping the VF queue count at
its EQ count.

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Fix be_vlan_rem_vid() to check vlan id being removed
Sriharsha Basavapatna [Wed, 3 Feb 2016 04:19:18 +0000 (09:49 +0530)]
be2net: Fix be_vlan_rem_vid() to check vlan id being removed

The driver decrements its vlan count without checking if it is really
present in its list. This results in an invalid vlan count and impacts
subsequent vlan add/rem ops. The function be_vlan_rem_vid() should be
updated to fix this.

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: check for INSUFFICIENT_PRIVILEGES error
Suresh Reddy [Wed, 3 Feb 2016 04:19:17 +0000 (09:49 +0530)]
be2net: check for INSUFFICIENT_PRIVILEGES error

The driver currently logs the message "VF is not privileged to issue
opcode" by checking only the base_status field for UNAUTHORIZED_REQUEST.
Add check to look for INSUFFICIENT_PRIVILEGES in the additional status
field also as not all cmds fail with that base status.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: return error status from be_set_phys_id()
Suresh Reddy [Wed, 3 Feb 2016 04:19:16 +0000 (09:49 +0530)]
be2net: return error status from be_set_phys_id()

be_set_phys_id() returns 0 to ethtool when the command fails in the FW.

This patch fixes the set_phys_id() to return -EIO in case the FW cmd fails.

Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: Avoid accessing eq object in be_msix_register routine, when i < 0.
Venkat Duvvuru [Thu, 17 Dec 2015 20:10:50 +0000 (01:40 +0530)]
be2net: Avoid accessing eq object in be_msix_register routine, when i < 0.

When the first request_irq fails in be_msix_register, i value
would be zero. The current code decrements the i value and
accesses the eq object without validating the decremented
"i" value. This can cause an "invalid memory address access"
violation.

This patch fixes the problem by accessing the eq object after
validating the "i" value.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: bump up the driver version to 11.0.0.0
Suresh Reddy [Wed, 30 Dec 2015 06:29:05 +0000 (01:29 -0500)]
be2net: bump up the driver version to 11.0.0.0

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: support ethtool get-dump option
Venkat Duvvuru [Wed, 30 Dec 2015 06:29:04 +0000 (01:29 -0500)]
be2net: support ethtool get-dump option

This patch adds support for ethtool's --get-dump option in be2net,
to retrieve FW dump. In the past when this option was not yet available,
this feature was supported via the --register-dump option as a workaround.
This patch removes support for FW-dump via --register-dump option as it is
now available via --get-dump option. Even though the
"ethtool --register-dump" cmd which used to work earlier, will now fail
with ENOTSUPP error, we feel it is not an issue as this is used only
for diagnostics purpose.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: fix port-res desc query of GET_PROFILE_CONFIG FW cmd
Suresh Reddy [Wed, 30 Dec 2015 06:29:03 +0000 (01:29 -0500)]
be2net: fix port-res desc query of GET_PROFILE_CONFIG FW cmd

Commit 72ef3a88fa8e ("be2net: set pci_func_num while issuing
GET_PROFILE_CONFIG cmd") passed a specific pf_num while issuing a
GET_PROFILE_CONFIG cmd as FW returns descriptors for all functions when
pf_num is zero. But, when pf_num is set to a non-zero value, FW does not
return the Port resource descriptor.
This patch fixes this by setting pf_num to 0 while issuing the query cmd
and adds code to pick the correct NIC resource descriptor from the list of
descriptors returned by FW.

Fixes: 72ef3a88fa8e ("be2net: set pci_func_num while issuing
     GET_PROFILE_CONFIG cmd")
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: remove unused error variables
Venkat Duvvuru [Wed, 30 Dec 2015 06:29:02 +0000 (01:29 -0500)]
be2net: remove unused error variables

eeh_error, fw_timeout, hw_error variables in the be_adapter structure are
not used anymore. An earlier patch that introduced adapter->err_flags to
store this information missed removing these variables.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: remove a line of code that has no effect
Sathya Perla [Wed, 30 Dec 2015 06:29:01 +0000 (01:29 -0500)]
be2net: remove a line of code that has no effect

This patch removes a line of code that changes adapter->recommended_prio
value followed by yet another assignment.
Also, the variable is used to store the vlan priority value that is already
shifted to the PCP bits position in the vlan tag format. Hence, the name of
this variable is changed to recommended_prio_bits.

Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: log digital signature errors while flashing FW image
Suresh Reddy [Wed, 30 Dec 2015 06:29:00 +0000 (01:29 -0500)]
be2net: log digital signature errors while flashing FW image

(based on a jumper setting on the adapter.) In this mode, the FW image when
flashed is authenticated with a digital signature. This patch logs
appropriate error messages and return a status to ethtool when errors
relating to FW image authentication occur.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: move FW flash cmd code to be_cmds.c
Suresh Reddy [Wed, 30 Dec 2015 06:28:59 +0000 (01:28 -0500)]
be2net: move FW flash cmd code to be_cmds.c

All code relating to FW cmds is in be_cmds.[ch] excepting FW flash cmd
related code. This patch moves these routines from be_main.c to be_cmds.c

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: cleanup FW flash image related macro defines
Suresh Reddy [Wed, 30 Dec 2015 06:28:58 +0000 (01:28 -0500)]
be2net: cleanup FW flash image related macro defines

Many constant definitions relating to the FW-image layout
(such as section offset values) were defined in decimal format rather than
hexa-decimal. This makes this part of the code un-readable. Also some
defines related to BE2 are labeld "g2" and defines related to BE3 are
labeled "g3".  This patch cleans up all of this to make this code more
readable.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: avoid configuring VEPA mode on BE3
Suresh Reddy [Wed, 30 Dec 2015 06:28:57 +0000 (01:28 -0500)]
be2net: avoid configuring VEPA mode on BE3

BE3 chip doesn't support VEPA mode.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: fix VF link state transition from disabled to auto
Suresh Reddy [Wed, 30 Dec 2015 06:28:56 +0000 (01:28 -0500)]
be2net: fix VF link state transition from disabled to auto

The VF link state setting transition from "disable" to "auto" does not work
due to a bug in SET_LOGICAL_LINK_CONFIG_V1 cmd in FW. This issue could not
be fixed in FW due to some backward compatibility issues it causes with
some released drivers. The issue has been fixed by introducing a new
version (v2) of the cmd from 10.6 FW onwards. In v2, to set the VF link
state to auto, both PLINK_ENABLE and PLINK_TRACK bits have to be set to 1.

The VF link state setting feature now works on Lancer chips too from
FW ver 10.6.315.0 onwards.

Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agonet: provide generic busy polling to all NAPI drivers
Eric Dumazet [Wed, 18 Nov 2015 14:31:03 +0000 (06:31 -0800)]
net: provide generic busy polling to all NAPI drivers

NAPI drivers no longer need to observe a particular protocol
to benefit from busy polling (CONFIG_NET_RX_BUSY_POLL=y)

napi_hash_add() and napi_hash_del() are automatically called
from core networking stack, respectively from
netif_napi_add() and netif_napi_del()

This patch depends on free_netdev() and netif_napi_del() being
called from process context, which seems to be the norm.

Drivers might still prefer to call napi_hash_del() on their
own, since they might combine all the rcu grace periods into
a single one, knowing their NAPI structures lifetime, while
core networking stack has no idea of a possible combining.

Once this patch proves to not bring serious regressions,
we will cleanup drivers to either remove napi_hash_del()
or provide appropriate rcu grace periods combining.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agonet: move skb_mark_napi_id() into core networking stack
Eric Dumazet [Wed, 18 Nov 2015 14:30:59 +0000 (06:30 -0800)]
net: move skb_mark_napi_id() into core networking stack

We would like to automatically provide busy polling support
to all NAPI drivers, without them having to implement anything.

skb_mark_napi_id() can be called from napi_gro_receive() and
napi_get_frags().

Few drivers are still calling skb_mark_napi_id() because
they use netif_receive_skb(). They should eventually call
napi_gro_receive() instead. I will leave this to drivers
maintainers.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: remove local variable 'status'
Ivan Vecera [Wed, 18 Nov 2015 13:06:34 +0000 (14:06 +0100)]
be2net: remove local variable 'status'

The lancer_cmd_get_file_len() uses lancer_cmd_read_object() to get
the current size of registers for ethtool registers dump. Returned status
value is stored but not checked. The check itself is not necessary as
the data_read output variable is initialized to 0 and status variable
can be removed.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: replace hardcoded values with existing define
Ivan Vecera [Fri, 13 Nov 2015 10:36:58 +0000 (11:36 +0100)]
be2net: replace hardcoded values with existing define

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agobe2net: remove unused local rsstable array
Ivan Vecera [Fri, 13 Nov 2015 10:36:57 +0000 (11:36 +0100)]
be2net: remove unused local rsstable array

Remove rsstable array and its initialization from be_set_rss_hash_opts().
The array became unused after "e255787 be2net: Support for configurable
RSS hash key". The initial RSS table is now filled and stored for later
usage during Rx queue creation.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Sathya Perla <sathya.perla@avagotech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agodrivers/net: get rid of unnecessary initializations in .get_drvinfo()
Ivan Vecera [Thu, 15 Oct 2015 19:28:52 +0000 (21:28 +0200)]
drivers/net: get rid of unnecessary initializations in .get_drvinfo()

Many drivers initialize uselessly n_priv_flags, n_stats, testinfo_len,
eedump_len & regdump_len fields in their .get_drvinfo() ethtool op.
It's not necessary as these fields is filled in ethtool_get_drvinfo().

v2: removed unused variable
v3: removed another unused variable

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Suresh Reddy <suresh.reddy@avagotech.com>
Signed-off-by: Suresh Reddy <suresh.reddy@broadcom.com>
Orabug: 22725582
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agoRevert "scsi: Fix a bdi reregistration race"
Dan Duval [Mon, 8 Feb 2016 22:03:32 +0000 (17:03 -0500)]
Revert "scsi: Fix a bdi reregistration race"

Orabug: 22679087

(this revert is commit e619e6cbecb7fe97a924d625e848605333457b13 upstream)

This reverts commit c8f01671e9a91837fc2b6be625f915977e786447.

The SCSI sd driver probes SCSI devices asynchronously. The sd_remove()
function, called indirectly by device_del(), waits until asynchronous
probing has finished. Since the block layer queue must only be cleaned
up after probing has finished, device_del() has to be called before
blk_cleanup_queue(). Hence revert commit bf2cf3b.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
9 years agovmxnet3: Bump up driver version number
Shreyas Bhatewara [Mon, 29 Jun 2015 11:14:43 +0000 (04:14 -0700)]
vmxnet3: Bump up driver version number

Bump up the driver version number to reflect the changes done to
work with vmxnet3 adapter version 2

Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a694717437c14efd489566540e821bc83ec234f3)

Orabug: 22380674
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agovmxnet3: Changes for vmxnet3 adapter version 2 (fwd)
Shreyas Bhatewara [Fri, 19 Jun 2015 20:38:29 +0000 (13:38 -0700)]
vmxnet3: Changes for vmxnet3 adapter version 2 (fwd)

Make the driver understand adapter version 2.

Cc: Rachel Lunnon <rachel_lunnon@stormagic.com>
Signed-off-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 45dac1d6ea045ae56e4df8d9c70c92c7412bd4fc)

Orabug: 22380674
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agovmxnet3: Fix memory leaks in rx path (fwd)
Shreyas Bhatewara [Fri, 19 Jun 2015 20:37:03 +0000 (13:37 -0700)]
vmxnet3: Fix memory leaks in rx path (fwd)

If rcd length was zero, the page used for frag was not being released. It
was being replaced with a newly allocated page. This change takes care
of that memory leak.

Signed-off-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c41fcce997d2caa039a46495d40423348c51ad61)

Orabug: 22380674
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agovmxnet3: Register shutdown handler for device (fwd)
Shreyas Bhatewara [Fri, 19 Jun 2015 20:36:02 +0000 (13:36 -0700)]
vmxnet3: Register shutdown handler for device (fwd)

Implement a handler for pci shutdown so that the driver has an
opportunity to make sure that device is quiesced before the PCI
switches to legacy IRQs. This way the possibility of
"screaming interrupt" is avoided.

Acked-by: Shrikrishna Khare <skhare@vmware.com>
Signed-off-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e9ba47bfe381888d8dc79123a20b2ec8b6751a47)

Orabug: 22380674
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
9 years agolpfc driver updates for UEK4 R1 11.0.0.13
rkennedy [Tue, 2 Feb 2016 19:51:56 +0000 (11:51 -0800)]
lpfc driver updates for UEK4 R1 11.0.0.13

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Use kzalloc instead of kmalloc
Punit Vara [Wed, 16 Dec 2015 23:12:07 +0000 (18:12 -0500)]
lpfc: Use kzalloc instead of kmalloc

This patch is to the lpfc_els.c which resolves following warning
reported by coccicheck:

WARNING: kzalloc should be used for rdp_context, instead of
kmalloc/memset

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 699acd6220ea5b20b25d5eec0ab448827d745357)

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Add logging for misconfigured optics.
James Smart [Wed, 16 Dec 2015 23:12:05 +0000 (18:12 -0500)]
lpfc: Add logging for misconfigured optics.

Add logging for misconfigured optics acqe reported by fw.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 448193b5b5e2471fc90ea11e78c39bcfd167efb6)

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix external loopback failure.
James Smart [Wed, 16 Dec 2015 23:12:04 +0000 (18:12 -0500)]
lpfc: Fix external loopback failure.

Fix external loopback failure.

Rx sequence reassembly was incorrect.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 4360ca9c24388e44cb0e14861a62fff43cf225c0)

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix mbox reuse in PLOGI completion
James Smart [Wed, 16 Dec 2015 23:12:03 +0000 (18:12 -0500)]
lpfc: Fix mbox reuse in PLOGI completion

Fix mbox reuse in PLOGI completion. Moved allocations so that buffer
properly init'd.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 01c73bbcd7cc4f31f45a1b0caeacdba46acd9c9c)

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Use new FDMI speed definitions for 10G, 25G and 40G FCoE.
James Smart [Wed, 16 Dec 2015 23:12:02 +0000 (18:12 -0500)]
lpfc: Use new FDMI speed definitions for 10G, 25G and 40G FCoE.

Use new FDMI speed definitions for 10G, 25G and 40G FCoE.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a085e87c814567c94e5d375e7362f9f25030aac1)

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Make write check error processing more resilient
James Smart [Wed, 16 Dec 2015 23:12:01 +0000 (18:12 -0500)]
lpfc: Make write check error processing more resilient

Make write check error processing more resilient.

Checks to catch writes that fw reports weren't fully complete yet SCSI
status indicated fine needed correction.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 5afab6bbf3f026b7d50451acbfdc12300c5f4353)

Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix RDP ACC being too long.
James Smart [Wed, 16 Dec 2015 23:12:00 +0000 (18:12 -0500)]
lpfc: Fix RDP ACC being too long.

Fix RDP ACC being too long.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit eb8d68c9930f7f9c8f3f4a6059b051b32077a735)

Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix RDP Speed reporting.
James Smart [Wed, 16 Dec 2015 23:11:59 +0000 (18:11 -0500)]
lpfc: Fix RDP Speed reporting.

Fix RDP Speed reporting.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 81e7517723fc17396ba91f59312b3177266ddbda)

Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Modularize and cleanup FDMI code in driver
James Smart [Wed, 16 Dec 2015 23:11:58 +0000 (18:11 -0500)]
lpfc: Modularize and cleanup FDMI code in driver

Modularize, cleanup, add comments - for FDMI code in driver

Note: I don't like the comments with leading # - but as we have a lot if
present, I'm deferring to handle it in one big fix later.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 4258e98ee3862ca7036654b43c839ab7668043e0)

Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix crash in fcp command completion path.
James Smart [Wed, 16 Dec 2015 23:11:57 +0000 (18:11 -0500)]
lpfc: Fix crash in fcp command completion path.

Fix crash in fcp command completion path.

Missed null check.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c90261dcd86e4eb5c9c1627fde037e902db8aefa)

Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix driver crash when module parameter lpfc_fcp_io_channel set to 16
James Smart [Wed, 16 Dec 2015 23:11:56 +0000 (18:11 -0500)]
lpfc: Fix driver crash when module parameter lpfc_fcp_io_channel set to 16

Fix driver crash when module parameter lpfc_fcp_io_channel set to 16

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6690e0d4fc5cccf74534abe0c9f9a69032bc02f0)

Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix RegLogin failed error seen on Lancer FC during port bounce
James Smart [Wed, 16 Dec 2015 23:11:55 +0000 (18:11 -0500)]
lpfc: Fix RegLogin failed error seen on Lancer FC during port bounce

Fix RegLogin failed error seen on Lancer FC during port bounce

Fix the statemachine and ref counting.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 4b7789b71c916f79a3366da080101014473234c3)

    Orabug: 22493326
Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix the FLOGI discovery logic to comply with T11 standards
James Smart [Wed, 16 Dec 2015 23:11:53 +0000 (18:11 -0500)]
lpfc: Fix the FLOGI discovery logic to comply with T11 standards

Fix the FLOGI discovery logic to comply with T11 standards

We weren't properly setting fabric parameters, such as R_A_TOV and E_D_TOV,
when we registered the vfi object in default configs and pt2pt configs.
Revise to now pass service params with the values to the firmware and
ensure they are reset on link bounce. Required reworking the call sequence
in the discovery threads.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit d6de08cc46269899988b4f40acc7337279693d4b)

Orabug: 22493326

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.
James Smart [Wed, 16 Dec 2015 23:11:52 +0000 (18:11 -0500)]
lpfc: Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.

Orabug: 22493326

Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit f5cb5304eb26d307c9b30269fb0e007e0b262b7d)

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: fix memory leak and NULL dereference
Sudip Mukherjee [Wed, 23 Sep 2015 13:32:32 +0000 (19:02 +0530)]
lpfc: fix memory leak and NULL dereference

Orabug: 22493326

kmalloc() can return NULL and without checking we were dereferencing it.
Moreover if kmalloc succeeds but the function fails in other parts then
we were returning the error code but we missed freeing lcb_context.
While at it fixed one related checkpatch warning.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: James Smart <james.smart@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit e79504236548e4c909959ba444f87a12224555ac)

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agolpfc: Fix rport leak.
James Smart [Thu, 21 May 2015 17:55:28 +0000 (13:55 -0400)]
lpfc: Fix rport leak.

Orabug: 22493326

Correct locking and refcounting in tracking our rports

Signed-off-by: Dick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: James Smart <james.smart@avagotech.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
(cherry picked from commit 466e840b7809e00ab3a1af9b4a5b5751e681730d)

Signed-off-by: Manjunath Govindashetty <manjunath.govindashetty@oracle.com>
9 years agoDrivers: hv: vmbus: Fix a Host signaling bug
K. Y. Srinivasan [Tue, 15 Dec 2015 00:01:54 +0000 (16:01 -0800)]
Drivers: hv: vmbus: Fix a Host signaling bug

Currently we have two policies for deciding when to signal the host:
One based on the ring buffer state and the other based on what the
VMBUS client driver wants to do. Consider the case when the client
wants to explicitly control when to signal the host. In this case,
if the client were to defer signaling, we will not be able to signal
the host subsequently when the client does want to signal since the
ring buffer state will prevent the signaling. Implement logic to
have only one signaling policy in force for a given channel.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Tested-by: Haiyang Zhang <haiyangz@microsoft.com>
Cc: <stable@vger.kernel.org> # v4.2+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8599846d73997cdbccf63f23394d871cfad1e5e6)

Orabug: 22725962
Signed-off-by: Jason Luo <zhangqing.luo@oracle.com>
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>