a critical issue cause by QCOM hypervisor HAB

we will share a critical issue which casue by qcom hab module, with this issue occur, the ais_be_server will termine itself when it receive a hab signal.

TODO

ais_server_cmd_thread
	ais_conn_recv_hv
		habmm_socket_recv
			hab_DevCtl
				hab_vchan_recv
					hab_msg_dequeue
						vchan->otherend_closed=1 --->	{hab_vchan_stop
														/* wake up local waiting Q, so stop-vchan can be processed */
														}
														{hab_pchan_stop
														/*
														 * A physical channel enters the "stopped" state in some cases. The current
														 * one is when the remote pair goes away(e.g., in GVM restart case). So some
														 * relevant actions should be taken, including waking up the openQ and
														 * stopping any further read/write over this pchan.
														 */
														}
														
														
														
														
ais_be_server:main
	---》ais_conn_accept_hv:return -4
		2023-01-02 01:43:43.279       AIS.827448                    ais_be_server              415   ais_conn_accept_hv:199 MED E 38c050e850 316ac58ab8 0, 这里开始进入
		2023-01-02 01:43:43.497       AIS.827448                    ais_be_server              415   ais_conn_accept_hv:230 ERR 38c050e850 -19 3 0 , 这里开始报-19错误
		2023-01-02 01:43:43.497       AIS.827448                    ais_be_server              415   ais_conn_accept_hv:260 ERR X 38c050e850 316ac58ab8 0 -4   这里报-4 退出
		----》habmm_socket_open:在下面的log中调用habmm_socket_open函数,从结果来看应该是失败了的
			2023-01-02 01:43:43.497       AIS.827448                    ais_be_server              163   ais_be_server[uhab.c:484]: habmm_socket_open: fd 7, refcnt 3, return -19, vcid 0
			如果是正常的日志,可以看到habmm_socket_open会快速成功返回
			2023-08-21 12:31:09.050       AIS.839737                    ais_be_server              415   ais_conn_accept_hv:199 MED E a37f96750 3ecd9646f0 1
			2023-08-21 12:31:09.050       AIS.839737                    ais_be_server              163   ais_be_server[uhab.c:503]: habmm_socket_open: opened fd 7, refcnt 20, return 0, vcid c9023f4
			2023-08-21 12:31:09.050       AIS.839737                    ais_be_server              415   ais_conn_accept_hv:260 MED X a37f96750 3ecd9646f0 1 0
			---》hab_DevCtl(IOCTL_HAB_VC_OPEN
				2023-01-02 01:43:43.497       AIS.827448                    ais_be_server              163   ais_be_server[uhab.c:222]: hab_DevCtl: MsgSendv failed to send message (device_id:0x316ac588b8, type:0x900), return -19
				---》io_msg-->case IOCTL_HAB_VC_OPEN(hab_ldd.c):
						---》hab_vchan_open
							2023-01-02 01:43:43.497       hab.32793                     slog                         0   hab[hab_ldd.c:241]: Error:hab:failed to create virtual channel on mmid 201
								---》vchan = backend_listen(ctx, mmid, timeout);
									2023-01-02 01:43:43.497       hab.32793                     slog                         0   hab[hab.c:599]: Error:hab:listen on mmid 201 failed
									在函数backend_listen中检测到ctx正在关闭:
									2023-01-02 01:43:43.496       hab.32793                     slog                         0   hab[hab.c:481]: Error:hab:open request wait failed ctx closing 1
									2023-01-02 01:43:43.496       hab.32793                     slog                         0   hab[hab_open.c:204]: Warning:hab:local closing during open ret 0
							2023-01-02 01:43:43.497       hab.32793                     slog                         0   hab[hab.c:853]: Error:hab:vchan open failed mmid=201  这里退出hab_vchan_open函数
			ais_uninitialize
			
			
			
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[hab.c:660]: Error:hab:run in hab_vchan_send, vcid:c9023d2
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:70]: Error:hab:run in physical_channel_send 70, name:vm2-hab_cam1, id:0, vcid:c9023d2
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:78]: Error:hab:run in physical_channel_send 78, name:vm2-hab_cam1, id:0, vcid:c9023d2
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:101]: Error:hab:run in physical_channel_send 101, name:vm2-hab_cam1, id:0, vcid:c9023d2
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:153]: Error:hab:run in physical_channel_send 153, name:vm2-hab_cam1, id:0, vcid:c9023d2
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[hab.c:660]: Error:hab:run in hab_vchan_send, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[hab.c:672]: Error:hab:run in hab_vchan_send, vcid:c9023d2, err out will not call schedule!!!!
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:70]: Error:hab:run in physical_channel_send 70, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:78]: Error:hab:run in physical_channel_send 78, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:101]: Error:hab:run in physical_channel_send 101, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:153]: Error:hab:run in physical_channel_send 153, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[hab.c:672]: Error:hab:run in hab_vchan_send, vcid:c9023d3, err out will not call schedule!!!!
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[hab_ldd.c:152]: Error:hab:>> io_unblock is called for pid =684089 reciv=524365
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:70]: Error:hab:run in physical_channel_send 70, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:78]: Error:hab:run in physical_channel_send 78, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:101]: Error:hab:run in physical_channel_send 101, name:vm2-hab_cam1, id:0, vcid:c9023d3
2023-01-05 03:27:07.216       hab.32793                     slog                         0   hab[qvm_comm.c:153]: Error:hab:run in physical_channel_send 153, name:vm2-hab_cam1, id:0, vcid:c9023d3




ais_conn_send_hv		[client]
	habmm_socket_send
		hab_DevCtl(IOCTL_HAB_SEND,
			MsgSendv_r
				|
				|
				|
		RESOURCE_MANAGER
				|
				|
				|
io_msg:IOCTL_HAB_SEND	[hab-cam201-server]
	hab_vchan_send
		physical_channel_send
			MsgReplyv