<div dir="ltr"><div dir="ltr">On Fri, Jun 2, 2023 at 10:18 AM HAGIO KAZUHITO(萩尾 一仁) <<a href="mailto:k-hagio-ab@nec.com">k-hagio-ab@nec.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2023/05/30 21:30, lijiang wrote:<br>
> On Mon, May 29, 2023 at 9:03 AM HAGIO KAZUHITO(萩尾 一仁) <<a href="mailto:k-hagio-ab@nec.com" target="_blank">k-hagio-ab@nec.com</a>><br>
> wrote:<br>
> <br>
>>><br>
>>> +                                       for (j = MOD_TEXT; j <<br>
>>>> MOD_MEM_NUM_TYPES; j++) {<br>
>>>> +                                               lm->load_symtable[j] =<br>
>>>> NULL;<br>
>>>> +                                               lm->load_symend[j] =<br>
>> NULL;<br>
>>>> +                                       }<br>
>>>> +                               } else { /* somehow this function runs<br>
>> for<br>
>>>> unloaded modules */<br>
>>>><br>
>>><br>
>>> Could you please explain why it may get into the "else" code path? And<br>
>> why<br>
>>> do we need to handle this situation for now? But not needed before the<br>
>>> module memory changes.<br>
>><br>
>> This path is used by "mod -d|-D" and reinit_modules() for unloaded modules.<br>
>><br>
>> The old procedure always does the cleanup and reinstall of the hash<br>
>> entries, so kept it as it is.<br>
>><br>
> <br>
> I tried to add some debug information in the above code path, but did not<br>
> observe any output(via the mod -d/-D). It's strange.<br>
<br>
With this change,<br>
<br>
--- a/symbols.c<br>
+++ b/symbols.c<br>
@@ -13951,6 +13951,7 @@ delete_load_module(ulong base_addr)<br>
                                                 lm->load_symend[j] = NULL;<br>
                                         }<br>
                                 } else { /* somehow this function runs for unloaded modules */<br>
+                                       fprintf(fp, "in the else block (-D)\n");<br>
                                         for (j = MOD_TEXT; j < MOD_MEM_NUM_TYPES; j++) {<br>
                                                 if (!lm->symtable[j])<br>
                                                         continue;<br>
@@ -14016,6 +14017,7 @@ delete_load_module(ulong base_addr)<br>
                                                 lm->load_symend[j] = NULL;<br>
                                         }<br>
                                 } else { /* somehow this function runs for unloaded modules */<br>
+                                       fprintf(fp, "in the else block (-d)\n");<br>
                                         for (j = MOD_TEXT; j < MOD_MEM_NUM_TYPES; j++) {<br>
                                                 if (!lm->symtable[j])<br>
                                                         continue;<br>
<br>
These should be printed:<br>
<br>
crash-6.4> mod -s dm_mod<br>
      MODULE       NAME                     TEXT_BASE         SIZE  OBJECT FILE<br>
ffffffffc042fd00  dm_mod                ffffffffc0418000   237568  dm-mod.ko<br>
crash-6.4> mod -d dm_mod<br>
crash-6.4> mod -d dm_mod<br></blockquote><div> </div><div>Ah, I know why I did not see any output(via the mod -d/-D), because I only ran the "mod -d/-D" *once*. And for now I can see the debug information after running the mod -d/-D *twice*.</div><div><br></div><div>Thank you for the explanation, Kazu.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
in the else block (-d)<br>
crash-6.4> mod -d dm_log<br>
in the else block (-d)<br>
crash-6.4> mod -D | head<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
in the else block (-D)<br>
<br>
Thanks,<br>
Kazu</blockquote></div></div>