Content-Type: multipart/mixed; boundary="===============4395994146042607358==" MIME-Version: 1.0 From: sunshihao at huawei.com Subject: [SPDK] thread->msg_cache is not safe when multiple threads send messages to same spdk_thread Date: Tue, 15 Sep 2020 13:33:03 +0000 Message-ID: <20200915133303.2750.23591@ml01.vlan13.01.org> List-ID: To: spdk@lists.01.org --===============4395994146042607358== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable hello=EF=BC=8Cmaintainer=EF=BC=9A when i use spdk api spdk_thread_send_msg to send io read/write msg=EF=BC=8C= i found a bug=EF=BC=9A multiple threads send msg to one spdk_thread=EF=BC=8Cthey may get msg form = local_thread->msg_cache=EF=BC=8Cthere is not a lock or cas to = ensure the safety of the linked list=E3=80=82 = msg =3D NULL; if (local_thread !=3D NULL) { if (local_thread->msg_cache_count > 0) { msg =3D SLIST_FIRST(&local_thread->msg_cache); /* here maybe not thr= ead safe */ assert(msg !=3D NULL); SLIST_REMOVE_HEAD(&local_thread->msg_cache, link); local_thread->msg_cache_count--; } } i don't konw whether is my wrong way to use spdk_thread_send_msg or the li= st is not safe=EF=BC=8Cso please give me some advice=E3=80=82 Thank you=EF=BC=81 --===============4395994146042607358==--