-/*
- * for flight recording. must be called after relay_commit.
- * This function decrements de subbuffer's lost_size each time the commit count
- * reaches back the reserve offset (module subbuffer size). It is useful for
- * crash dump.
- * We use slot_size - 1 to make sure we deal correctly with the case where we
- * fill the subbuffer completely (so the subbuf index stays in the previous
- * subbuffer).
- */
-//ust// #ifdef CONFIG_LTT_VMCORE
-static /*inline*/ void ltt_write_commit_counter(struct rchan_buf *buf,
- long buf_offset, size_t slot_size)
-{
- struct ltt_channel_struct *ltt_channel =
- (struct ltt_channel_struct *)buf->chan->private_data;
- struct ltt_channel_buf_struct *ltt_buf = ltt_channel->buf;
- struct ltt_subbuffer_header *header;
- long offset, subbuf_idx, commit_count;
- uint32_t lost_old, lost_new;
-
- subbuf_idx = SUBBUF_INDEX(buf_offset - 1, buf->chan);
- offset = buf_offset + slot_size;
- header = (struct ltt_subbuffer_header *)
- ltt_relay_offset_address(buf,
- subbuf_idx * buf->chan->subbuf_size);
- for (;;) {
- lost_old = header->lost_size;
- commit_count =
- local_read(<t_buf->commit_count[subbuf_idx]);
- /* SUBBUF_OFFSET includes commit_count_mask */
- if (!SUBBUF_OFFSET(offset - commit_count, buf->chan)) {
- lost_new = (uint32_t)buf->chan->subbuf_size
- - SUBBUF_OFFSET(commit_count, buf->chan);
- lost_old = cmpxchg_local(&header->lost_size, lost_old,
- lost_new);
- if (lost_old <= lost_new)
- break;
- } else {
- break;
- }
- }
-}
-//ust// #else
-//ust// static inline void ltt_write_commit_counter(struct rchan_buf *buf,
-//ust// long buf_offset, size_t slot_size)
-//ust// {
-//ust// }
-//ust// #endif
-
-/*
- * Atomic unordered slot commit. Increments the commit count in the
- * specified sub-buffer, and delivers it if necessary.
- *
- * Parameters:
- *
- * @ltt_channel : channel structure
- * @transport_data: transport-specific data
- * @buf_offset : offset following the event header.
- * @slot_size : size of the reserved slot.
- */
-static notrace void ltt_relay_commit_slot(
- struct ltt_channel_struct *ltt_channel,
- void **transport_data, long buf_offset, size_t slot_size)
-{
- struct rchan_buf *buf = *transport_data;
- struct ltt_channel_buf_struct *ltt_buf = ltt_channel->buf;
- struct rchan *rchan = buf->chan;
- long offset_end = buf_offset;
- long endidx = SUBBUF_INDEX(offset_end - 1, rchan);
- long commit_count;
-
- /* Must write slot data before incrementing commit count */
- smp_wmb();
- commit_count = local_add_return(slot_size,
- <t_buf->commit_count[endidx]);
- /* Check if all commits have been done */
- if ((BUFFER_TRUNC(offset_end - 1, rchan)
- >> ltt_channel->n_subbufs_order)
- - ((commit_count - rchan->subbuf_size)
- & ltt_channel->commit_count_mask) == 0)
- ltt_deliver(buf, endidx, NULL);
- /*
- * Update lost_size for each commit. It's needed only for extracting
- * ltt buffers from vmcore, after crash.
- */
- ltt_write_commit_counter(buf, buf_offset, slot_size);
-
- DBG("commited slot. now commit count is %ld", commit_count);
-}
-