Hi Mike, On 3/17/25 4:55 PM, Dongli Zhang wrote: > The vhost-scsi I/O queue uses vhost_scsi_cmd. Allocate the log buffer > during vhost_scsi_cmd allocation or when VHOST_F_LOG_ALL is set. Free the > log buffer when vhost_scsi_cmd is reclaimed or when VHOST_F_LOG_ALL is > removed. > > Fail vhost_scsi_set_endpoint or vhost_scsi_set_features() on allocation > failure. > > The cached log buffer will be uses in upcoming patches to log write > descriptors for the I/O queue. The core idea is to cache the log in the > per-command log buffer in the submission path, and use them to log write > descriptors in the completion path. > > As a reminder, currently QEMU's vhost-scsi VHOST_SET_FEATURES handler > doesn't process the failure gracefully. Instead, it crashes immediately on > failure from VHOST_SET_FEATURES. > We have discussed the allocation of log buffer at: https://lore.kernel.org/all/b058d4c6-f8cf-456b-aa60-8a8ccedb277e@xxxxxxxxxx/ This patchset allocate and free log buffer during VHOST_SET_FEATURES/VHOST_SCSI_SET_ENDPOINT. Unfortunately, QEMU's VHOST_SET_FEATURES handler may crash QEMU if there is error from VHOST_SET_FEATURES (i.e. -ENOMEM).