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: <intel-wired-lan@osuosl.org>
Subject: Re: [Intel-wired-lan] [PATCH net-next v6 4/5] ice: disable FW logging on driver unload
Date: Wed, 18 Jan 2023 11:11:35 -0800	[thread overview]
Message-ID: <aa49973f-4d0c-49fa-9cea-db43ee124e21@intel.com> (raw)
In-Reply-To: <ba037a29-15bd-ade7-8b3e-551f4bc7e53e@intel.com>

On 1/13/2023 4:24 PM, Jacob Keller wrote:
> 
> 
> On 1/13/2023 2:23 PM, 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.
>>
> 
> You could also catch this IO error and handle it if that is the only way
> to get IO error? 

I'm not sure if this is the only way to get this error or not. The error 
comes when we register for FW logging events. The documentation doesn't 
provide any info on what could cause an error or what errors we might 
see so I'm nervous on relying on this since other things may return the 
same error.

> Is there a way to check if firmware logging is already
> active after a driver reload? That might still be useful in the event
> that firmware logging gets enabled via some other version of the driver
> which doesn't disable it on unload...

Yes, but by the time we would check that (when we register for FW lgging 
events), we wouldn't know it without introducing some other flag for 
that purpose. I'm not sure it's worth adding a flag just for this...

> 
> Something like checking the adminq error and if its EIO then confirm
> that we are enabled and report success in that case.
> 
> Thanks,
> Jake
> 
>> 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 9e610827966f..f24693e42e35 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_main.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
>> @@ -4497,6 +4497,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);
>> +	}
>> +}
>> +
>>   /**
>>    * ice_cfg_netdev - Allocate, configure and register a netdev
>>    * @vsi: the VSI associated with the new netdev
>> @@ -5234,6 +5261,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);
> _______________________________________________
> 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-18 19:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 22:23 [Intel-wired-lan] [PATCH net-next v6 0/5] add v2 FW logging for ice driver Paul M Stillwell Jr
2023-01-13 22:23 ` [Intel-wired-lan] [PATCH net-next v6 1/5] ice: remove FW logging code Paul M Stillwell Jr
2023-01-13 22:23 ` [Intel-wired-lan] [PATCH net-next v6 2/5] ice: enable devlink to check FW logging status Paul M Stillwell Jr
2023-01-14  0:21   ` Jacob Keller
2023-01-18 17:45     ` Paul M Stillwell Jr
2023-01-13 22:23 ` [Intel-wired-lan] [PATCH net-next v6 3/5] ice: add ability to query/set FW log level and resolution Paul M Stillwell Jr
2023-01-13 22:23 ` [Intel-wired-lan] [PATCH net-next v6 4/5] ice: disable FW logging on driver unload Paul M Stillwell Jr
2023-01-14  0:24   ` Jacob Keller
2023-01-18 19:11     ` Paul M Stillwell Jr [this message]
2023-01-13 22:23 ` [Intel-wired-lan] [PATCH net-next v6 5/5] ice: use debugfs to output FW log data Paul M Stillwell Jr
2023-01-14  0:31   ` Jacob Keller
2023-01-14  0:32 ` [Intel-wired-lan] [PATCH net-next v6 0/5] add v2 FW logging for ice driver Jacob Keller

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=aa49973f-4d0c-49fa-9cea-db43ee124e21@intel.com \
    --to=paul.m.stillwell.jr@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /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