Skip to content

Commit 6e4a90d

Browse files
Alex Elderroxanan1996
authored andcommitted
net: ipa: only reset hashed tables when supported
BugLink: https://bugs.launchpad.net/bugs/2037005 commit e11ec2b upstream. Last year, the code that manages GSI channel transactions switched from using spinlock-protected linked lists to using indexes into the ring buffer used for a channel. Recently, Google reported seeing transaction reference count underflows occasionally during shutdown. Doug Anderson found a way to reproduce the issue reliably, and bisected the issue to the commit that eliminated the linked lists and the lock. The root cause was ultimately determined to be related to unused transactions being committed as part of the modem shutdown cleanup activity. Unused transactions are not normally expected (except in error cases). The modem uses some ranges of IPA-resident memory, and whenever it shuts down we zero those ranges. In ipa_filter_reset_table() a transaction is allocated to zero modem filter table entries. If hashing is not supported, hashed table memory should not be zeroed. But currently nothing prevents that, and the result is an unused transaction. Something similar occurs when we zero routing table entries for the modem. By preventing any attempt to clear hashed tables when hashing is not supported, the reference count underflow is avoided in this case. Note that there likely remains an issue with properly freeing unused transactions (if they occur due to errors). This patch addresses only the underflows that Google originally reported. Cc: <[email protected]> # 6.1.x Fixes: d338ae2 ("net: ipa: kill all other transaction lists") Tested-by: Douglas Anderson <[email protected]> Signed-off-by: Alex Elder <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 5b84b5a commit 6e4a90d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

drivers/net/ipa/ipa_table.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,16 +273,15 @@ static int ipa_filter_reset(struct ipa *ipa, bool modem)
273273
if (ret)
274274
return ret;
275275

276-
ret = ipa_filter_reset_table(ipa, true, false, modem);
277-
if (ret)
276+
ret = ipa_filter_reset_table(ipa, false, true, modem);
277+
if (ret || !ipa_table_hash_support(ipa))
278278
return ret;
279279

280-
ret = ipa_filter_reset_table(ipa, false, true, modem);
280+
ret = ipa_filter_reset_table(ipa, true, false, modem);
281281
if (ret)
282282
return ret;
283-
ret = ipa_filter_reset_table(ipa, true, true, modem);
284283

285-
return ret;
284+
return ipa_filter_reset_table(ipa, true, true, modem);
286285
}
287286

288287
/* The AP routes and modem routes are each contiguous within the
@@ -291,12 +290,13 @@ static int ipa_filter_reset(struct ipa *ipa, bool modem)
291290
* */
292291
static int ipa_route_reset(struct ipa *ipa, bool modem)
293292
{
293+
bool hash_support = ipa_table_hash_support(ipa);
294294
u32 modem_route_count = ipa->modem_route_count;
295295
struct gsi_trans *trans;
296296
u16 first;
297297
u16 count;
298298

299-
trans = ipa_cmd_trans_alloc(ipa, 4);
299+
trans = ipa_cmd_trans_alloc(ipa, hash_support ? 4 : 2);
300300
if (!trans) {
301301
dev_err(&ipa->pdev->dev,
302302
"no transaction for %s route reset\n",
@@ -313,10 +313,12 @@ static int ipa_route_reset(struct ipa *ipa, bool modem)
313313
}
314314

315315
ipa_table_reset_add(trans, false, false, false, first, count);
316-
ipa_table_reset_add(trans, false, true, false, first, count);
317-
318316
ipa_table_reset_add(trans, false, false, true, first, count);
319-
ipa_table_reset_add(trans, false, true, true, first, count);
317+
318+
if (hash_support) {
319+
ipa_table_reset_add(trans, false, true, false, first, count);
320+
ipa_table_reset_add(trans, false, true, true, first, count);
321+
}
320322

321323
gsi_trans_commit_wait(trans);
322324

0 commit comments

Comments
 (0)