Lines Matching defs:aux

1380 static inline unsigned long aux_sdb_index(struct aux_buffer *aux,
1383 return i % aux->sfb.num_sdb;
1391 static inline unsigned long aux_sdb_num_alert(struct aux_buffer *aux)
1393 return aux_sdb_num(aux->head, aux->alert_mark);
1396 static inline unsigned long aux_sdb_num_empty(struct aux_buffer *aux)
1398 return aux_sdb_num(aux->head, aux->empty_mark);
1404 static struct hws_trailer_entry *aux_sdb_trailer(struct aux_buffer *aux,
1409 index = aux_sdb_index(aux, index);
1410 sdb = aux->sdb_index[index];
1426 struct aux_buffer *aux;
1429 aux = perf_get_aux(handle);
1430 if (!aux)
1433 range_scan = aux_sdb_num_alert(aux);
1434 for (i = 0, idx = aux->head; i < range_scan; i++, idx++) {
1435 te = aux_sdb_trailer(aux, idx);
1443 te = aux_sdb_trailer(aux, aux->alert_mark);
1447 __func__, i, range_scan, aux->head);
1460 struct aux_buffer *aux,
1469 aux->head = handle->head >> PAGE_SHIFT;
1475 * SDBs between aux->head and aux->empty_mark are already ready
1480 __func__, range, aux->head, aux->alert_mark,
1481 aux->empty_mark);
1482 if (range > aux_sdb_num_empty(aux)) {
1483 range_scan = range - aux_sdb_num_empty(aux);
1484 idx = aux->empty_mark + 1;
1486 te = aux_sdb_trailer(aux, idx);
1492 aux->empty_mark = aux->head + range - 1;
1496 aux->alert_mark = aux->head + range/2 - 1;
1497 te = aux_sdb_trailer(aux, aux->alert_mark);
1501 head = aux_sdb_index(aux, aux->head);
1502 base = aux->sdbt_index[head / CPUM_SF_SDB_PER_TABLE];
1505 cpuhw->lsctl.dear = virt_to_phys((void *)aux->sdb_index[head]);
1509 aux->head, aux->alert_mark, aux->empty_mark,
1522 static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index,
1528 te = aux_sdb_trailer(aux, alert_index);
1551 * @aux: The AUX buffer to set
1552 * @range: The range of SDBs to scan started from aux->head
1555 * Set alert indicator on the SDB at index of aux->alert_mark. If this SDB is
1560 * Scan the SDBs in AUX buffer from behind aux->empty_mark. They are used
1563 * If aux->alert_mark fall in this area, just set it. Overflow count is
1566 * SDBs between aux->head and aux->empty_mark are already reset at last time.
1571 static bool aux_reset_buffer(struct aux_buffer *aux, unsigned long range,
1580 "empty %ld\n", __func__, range, aux->head,
1581 aux->alert_mark, aux->empty_mark);
1582 if (range <= aux_sdb_num_empty(aux))
1588 return aux_set_alert(aux, aux->alert_mark, overflow);
1590 if (aux->alert_mark <= aux->empty_mark)
1595 if (!aux_set_alert(aux, aux->alert_mark, overflow))
1603 range_scan = range - aux_sdb_num_empty(aux);
1604 idx_old = idx = aux->empty_mark + 1;
1606 te = aux_sdb_trailer(aux, idx);
1614 if (idx == aux->alert_mark)
1624 aux->empty_mark = aux->head + range - 1;
1628 idx - 1, aux->empty_mark);
1637 struct aux_buffer *aux;
1644 aux = perf_get_aux(handle);
1645 if (WARN_ON_ONCE(!aux))
1649 size = aux_sdb_num_alert(aux) << PAGE_SHIFT;
1654 num_sdb = aux->sfb.num_sdb;
1657 aux = perf_aux_output_begin(handle, cpuhw->event);
1664 if (WARN_ON_ONCE(!aux))
1668 aux->head = handle->head >> PAGE_SHIFT;
1671 aux->alert_mark = aux->head;
1673 aux->alert_mark = aux->head + range/2 - 1;
1675 if (aux_reset_buffer(aux, range, &overflow)) {
1683 "pages to overflow\n", aux->sfb.num_sdb);
1686 aux->head, range, overflow);
1688 size = aux_sdb_num_alert(aux) << PAGE_SHIFT;
1693 aux->head, aux->alert_mark);
1699 "empty %ld\n", __func__, aux->head,
1700 aux->alert_mark, aux->empty_mark);
1708 struct aux_buffer *aux = data;
1711 if (!aux)
1715 num_sdbt = aux->sfb.num_sdbt;
1717 free_page(aux->sdbt_index[i]);
1719 kfree(aux->sdbt_index);
1720 kfree(aux->sdb_index);
1721 kfree(aux);
1755 struct aux_buffer *aux;
1775 aux = kzalloc(sizeof(struct aux_buffer), GFP_KERNEL);
1776 if (!aux)
1778 sfb = &aux->sfb;
1782 aux->sdbt_index = kmalloc_array(n_sdbt, sizeof(void *), GFP_KERNEL);
1783 if (!aux->sdbt_index)
1787 aux->sdb_index = kmalloc_array(nr_pages, sizeof(void *), GFP_KERNEL);
1788 if (!aux->sdb_index)
1796 aux->sdbt_index[sfb->num_sdbt++] = (unsigned long)sfb->sdbt;
1808 aux->sdbt_index[sfb->num_sdbt++] = (unsigned long)new;
1815 aux->sdb_index[i] = (unsigned long)pages[i];
1829 aux->empty_mark = sfb->num_sdb - 1;
1834 return aux;
1839 free_page(aux->sdbt_index[i]);
1840 kfree(aux->sdb_index);
1842 kfree(aux->sdbt_index);
1844 kfree(aux);
1938 struct aux_buffer *aux;
1973 aux = perf_aux_output_begin(&cpuhw->handle, event);
1974 if (!aux) {
1978 err = aux_output_begin(&cpuhw->handle, aux, cpuhw);