Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net-next v5 4/5] ice: disable FW logging on driver unload
Date: Fri, 13 Jan 2023 14:13:04 -0800	[thread overview]
Message-ID: <7188138f-3f07-97f3-33df-9c64a76e7895@intel.com> (raw)
In-Reply-To: <Y7/lpDzq6q+SWRxK@localhost.localdomain>

On 1/12/2023 2:49 AM, Michal Swiatkowski wrote:
> On Wed, Jan 11, 2023 at 11:19:05AM -0800, Paul M Stillwell Jr wrote:
>> The FW is running in it's own context irregardless of what the driver
>> is doing. In this case, if the driver previously registered for FW
>> log events and then the driver unloads without informing the FW to
>> unregister for FW log events then the FW still has a timer running to
>> output FW logs.
>>
>> The next time the driver loads and tries to register for FW log events
>> then the FW returns an error, but still enables the continued
>> outputting of FW logs. This causes an IO error to devlink which isn't
>> intuitive since the logs are still being output.
>>
>> Fix this by disabling FW logging when the driver is being unloaded.
>>
>> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
>> ---
>>   drivers/net/ethernet/intel/ice/ice_main.c | 29 +++++++++++++++++++++++
>>   1 file changed, 29 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
>> index 1b5debc3109d..593efc064f5b 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_main.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
>> @@ -4500,6 +4500,33 @@ static void ice_unregister_netdev(struct ice_vsi *vsi)
>>   	clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state);
>>   }
>>   
>> +/**
>> + * ice_pf_fwlog_deinit - clear FW logging metadata on device exit
>> + * @pf: pointer to the PF struct
>> + */
>> +static void ice_pf_fwlog_deinit(struct ice_pf *pf)
>> +{
>> +	struct ice_hw *hw = &pf->hw;
>> +
>> +	/* make sure FW logging is disabled to not put the FW in a weird state
>> +	 * for the next driver load
>> +	 */
>> +	if (hw->fwlog_ena) {
>> +		int status;
>> +
>> +		hw->fwlog_cfg.options &= ~ICE_FWLOG_OPTION_ARQ_ENA;
>> +		status = ice_fwlog_set(hw, &hw->fwlog_cfg);
>> +		if (status)
>> +			dev_warn(ice_pf_to_dev(pf), "Unable to turn off FW logging, status: %d\n",
>> +				 status);
>> +
>> +		status = ice_fwlog_unregister(hw);
>> +		if (status)
>> +			dev_warn(ice_pf_to_dev(pf), "Unable to unregister FW logging, status: %d\n",
>> +				 status);
> Shouldn't hw->fwlog_cfg be free on deinit? Or if not here, where does
> this happen?
> 

No need to free hw->fwlog_cfg since it's not a pointer with memory 
allocated, it's a member of ice_hw. See ice_type.h, 863

>> +	}
>> +}
>> +
>>   /**
>>    * ice_cfg_netdev - Allocate, configure and register a netdev
>>    * @vsi: the VSI associated with the new netdev
>> @@ -5237,6 +5264,8 @@ static void ice_remove(struct pci_dev *pdev)
>>   		msleep(100);
>>   	}
>>   
>> +	ice_pf_fwlog_deinit(pf);
>> +
>>   	if (test_bit(ICE_FLAG_SRIOV_ENA, pf->flags)) {
>>   		set_bit(ICE_VF_RESETS_DISABLED, pf->state);
>>   		ice_free_vfs(pf);
>> -- 
>> 2.35.1
>>
>> _______________________________________________
>> Intel-wired-lan mailing list
>> Intel-wired-lan@osuosl.org
>> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2023-01-13 22:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 19:19 [Intel-wired-lan] [PATCH net-next v5 0/5] add v2 FW logging for ice driver Paul M Stillwell Jr
2023-01-11 19:19 ` [Intel-wired-lan] [PATCH net-next v5 1/5] ice: remove FW logging code Paul M Stillwell Jr
2023-01-11 19:19 ` [Intel-wired-lan] [PATCH net-next v5 2/5] ice: enable devlink to check FW logging status Paul M Stillwell Jr
2023-01-12  9:38   ` Michal Swiatkowski
2023-01-12 22:53     ` Paul M Stillwell Jr
2023-01-13  6:10       ` Michal Swiatkowski
2023-01-11 19:19 ` [Intel-wired-lan] [PATCH net-next v5 3/5] ice: add ability to query/set FW log level and resolution Paul M Stillwell Jr
2023-01-12 10:00   ` Michal Swiatkowski
2023-01-13 22:07     ` Paul M Stillwell Jr
2023-01-11 19:19 ` [Intel-wired-lan] [PATCH net-next v5 4/5] ice: disable FW logging on driver unload Paul M Stillwell Jr
2023-01-12 10:49   ` Michal Swiatkowski
2023-01-13 22:13     ` Paul M Stillwell Jr [this message]
2023-01-16  7:41       ` Michal Swiatkowski
2023-01-11 19:19 ` [Intel-wired-lan] [PATCH net-next v5 5/5] ice: use debugfs to output FW log data Paul M Stillwell Jr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7188138f-3f07-97f3-33df-9c64a76e7895@intel.com \
    --to=paul.m.stillwell.jr@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=michal.swiatkowski@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox