mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-13 04:06:50 +07:00
9951903e61
This patch reduces the size of struct hpsb_host and also removes semaphores from ieee1394_transactions.c. On i386, struct hpsb_host shrinks from 10656 bytes to 6688 bytes. This is accomplished by - using a single wait_queue for hpsb_get_tlabel instead of many instances of semaphores, - using a single lock to serialize access to all tlabel pools (the protected code regions are small, i.e. lock contention very low), - omitting the sysfs attribute tlabels_allocations. Drawback: In the rare case that a process needs to sleep because all transaction labels for the node are temporarily exhausted, it is also woken up if a tlabel for a different node became free, checks for an available tlabel, and is put to sleep again. The check is not costly and the situation occurs extremely rarely. (Tlabels are typically only exhausted if there was no context switch to the khpsbpkt thread which recycles tlables.) Therefore the benefit of reduced tpool size outweighs this drawback. The sysfs attributes tlabels_free and tlabels_mask are not compiled anymore unless CONFIG_IEEE1394_VERBOSEDEBUG is set. The by far biggest member of struct hpsb_host, the struct csr_control csr (5272 bytes on i386), is now placed at the end of struct hpsb_host. Note, hpsb_get_tlabel calls the macro wait_event_interruptible with a condition argument which has a side effect (allocation of a tlabel and manipulation of the packet). This side effect happens only if the condition is true. The patch relies on wait_event_interruptible not evaluating the condition again after it became true. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
61 lines
2.4 KiB
C
61 lines
2.4 KiB
C
#ifndef _IEEE1394_TRANSACTIONS_H
|
|
#define _IEEE1394_TRANSACTIONS_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include "ieee1394_types.h"
|
|
|
|
struct hpsb_packet;
|
|
struct hpsb_host;
|
|
|
|
int hpsb_get_tlabel(struct hpsb_packet *packet);
|
|
void hpsb_free_tlabel(struct hpsb_packet *packet);
|
|
struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
|
|
u64 addr, size_t length);
|
|
struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node,
|
|
u64 addr, int extcode, quadlet_t *data,
|
|
quadlet_t arg);
|
|
struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host,
|
|
nodeid_t node, u64 addr, int extcode,
|
|
octlet_t *data, octlet_t arg);
|
|
struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data);
|
|
struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int length,
|
|
int channel, int tag, int sync);
|
|
struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host,
|
|
nodeid_t node, u64 addr,
|
|
quadlet_t *buffer, size_t length);
|
|
struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer,
|
|
int length, int channel, int tag,
|
|
int sync);
|
|
|
|
/*
|
|
* hpsb_packet_success - Make sense of the ack and reply codes and
|
|
* return more convenient error codes:
|
|
* 0 success
|
|
* -EBUSY node is busy, try again
|
|
* -EAGAIN error which can probably resolved by retry
|
|
* -EREMOTEIO node suffers from an internal error
|
|
* -EACCES this transaction is not allowed on requested address
|
|
* -EINVAL invalid address at node
|
|
*/
|
|
int hpsb_packet_success(struct hpsb_packet *packet);
|
|
|
|
/*
|
|
* The generic read and write functions. All recognize the local node ID
|
|
* and act accordingly. Read and write automatically use quadlet commands if
|
|
* length == 4 and and block commands otherwise (however, they do not yet
|
|
* support lengths that are not a multiple of 4). You must explicitly specifiy
|
|
* the generation for which the node ID is valid, to avoid sending packets to
|
|
* the wrong nodes when we race with a bus reset.
|
|
*/
|
|
int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
|
|
u64 addr, quadlet_t *buffer, size_t length);
|
|
int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation,
|
|
u64 addr, quadlet_t *buffer, size_t length);
|
|
|
|
#ifdef HPSB_DEBUG_TLABELS
|
|
extern spinlock_t hpsb_tlabel_lock;
|
|
#endif
|
|
|
|
#endif /* _IEEE1394_TRANSACTIONS_H */
|